Skip to content

Commit 14607a7

Browse files
committed
Add info to telegram messages
1 parent 3201ad9 commit 14607a7

1 file changed

Lines changed: 20 additions & 4 deletions

File tree

src/billing/cloudpayments.ts

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,12 @@ export default class CloudPaymentsWebhooks {
105105
const userId = req.context.user.id;
106106

107107
if (!workspaceId || !tariffPlanId || !userId) {
108-
this.sendError(res, 1, `[Billing / Compose payment] No workspace, tariff plan or user id in request body`, req.query);
108+
this.sendError(res, 1, `[Billing / Compose payment] No workspace, tariff plan or user id in request body
109+
Details:
110+
workspaceId: ${workspaceId}
111+
tariffPlanId: ${tariffPlanId}
112+
userId: ${userId}`
113+
, req.query);
109114

110115
return;
111116
}
@@ -479,7 +484,6 @@ export default class CloudPaymentsWebhooks {
479484
* Refund the money that were charged to link a card
480485
*/
481486
if (data.isCardLinkOperation) {
482-
this.handleSendingToTelegramError(telegram.sendMessage(`✅ [Billing / Pay] Recurrent payments activated for «${workspace.name}». 1 RUB charged`, TelegramBotURLs.Money));
483487

484488
await cloudPaymentsApi.cancelPayment(body.TransactionId);
485489

@@ -503,7 +507,11 @@ export default class CloudPaymentsWebhooks {
503507
dtCreated: new Date(),
504508
});
505509

506-
this.handleSendingToTelegramError(telegram.sendMessage(`✅ [Billing / Pay] Recurrent payments activated for «${workspace.name}». 1 RUB returned`, TelegramBotURLs.Money));
510+
this.handleSendingToTelegramError(telegram.sendMessage(`✅ [Billing / Pay] Card linked
511+
Transaction details:
512+
workspaceId: ${workspace._id}
513+
date: ${body.DateTime}`
514+
, TelegramBotURLs.Money));
507515
} else {
508516
/**
509517
* Russia code from ISO 3166-1
@@ -517,7 +525,15 @@ export default class CloudPaymentsWebhooks {
517525

518526
await this.sendReceipt(workspace, tariffPlan, userEmail);
519527

520-
this.handleSendingToTelegramError(telegram.sendMessage(`✅ [Billing / Pay] Payment passed successfully for «${workspace.name}»`, TelegramBotURLs.Money));
528+
this.handleSendingToTelegramError(telegram.sendMessage(`✅ [Billing / Pay] New payment
529+
Transaction details:
530+
amount: ${+body.Amount * PENNY_MULTIPLIER}
531+
currency: ${body.Currency}
532+
workspaceId: ${workspace._id}
533+
date: ${body.DateTime}
534+
subscriptionId: ${body.SubscriptionId}`
535+
, TelegramBotURLs.Money));
536+
521537
}
522538
} catch (e) {
523539
const error = e as Error;

0 commit comments

Comments
 (0)