aboutsummaryrefslogtreecommitdiffstats
path: root/lib/payments.ts
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-09-23 20:26:50 -0700
committerAdam Soltys <[email protected]>2024-09-23 20:26:50 -0700
commit8c8c71d54d23960ffc4caa94619bae7c6a69514b (patch)
tree53c09335935c00ce7db89a62e59c6b804c0ae1a7 /lib/payments.ts
parent12ad5c9abb74cbe35c5d07233fdd9a7b7f5c2b70 (diff)
downloadcoinos-server-8c8c71d54d23960ffc4caa94619bae7c6a69514b.tar.gz
coinos-server-8c8c71d54d23960ffc4caa94619bae7c6a69514b.zip
translations helper
Diffstat (limited to 'lib/payments.ts')
-rw-r--r--lib/payments.ts11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/payments.ts b/lib/payments.ts
index 4bec9a93..6d83b28f 100644
--- a/lib/payments.ts
+++ b/lib/payments.ts
@@ -1,4 +1,3 @@
-import locales from "$lib/locales/index";
import config from "$config";
import { generate } from "$lib/invoices";
import { emit } from "$lib/sockets";
@@ -16,6 +15,7 @@ import {
SATS,
sats,
formatReceipt,
+ t,
} from "$lib/utils";
import { callWebhook } from "$lib/webhooks";
import got from "got";
@@ -289,10 +289,10 @@ export let completePayment = async (p, user) => {
}
}
- let t = locales[user.language || "en"];
+ let { paymentReceived } = t(user);
if (user.verified && user.notify) {
- mail(user, t.paymentReceived, templates.paymentReceived, {
- ...t,
+ mail(user, paymentReceived, templates.paymentReceived, {
+ ...t(user),
username,
payment: {
amount: fmt(p.amount),
@@ -318,7 +318,8 @@ export let completePayment = async (p, user) => {
}
};
-let pay = async ({ aid, amount, to, user }) => {
+let pay = async ({ aid = undefined, amount, to, user }) => {
+ if (!aid) aid = user.id;
amount = parseInt(amount) || 0;
let lnurl, pr;
if (to.includes("@") && to.includes(".")) {