From d0f752d172b9de13c337a99fc5f06226c7368664 Mon Sep 17 00:00:00 2001 From: Tanya Fomina Date: Sat, 26 Jul 2025 15:00:16 +0300 Subject: [PATCH 1/4] Fix messages --- src/billing/cloudpayments.ts | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/billing/cloudpayments.ts b/src/billing/cloudpayments.ts index 1c5150f7..b14f656d 100644 --- a/src/billing/cloudpayments.ts +++ b/src/billing/cloudpayments.ts @@ -557,14 +557,28 @@ plan monthly charge: ${data.cloudPayments?.recurrent.amount} ${body.Currency}` await this.sendReceipt(workspace, tariffPlan, userEmail); - this.handleSendingToTelegramError(telegram.sendMessage(`✅ [Billing / Pay] New payment + let messageText = '' + + if (data.cloudPayments?.recurrent.startDate) { + messageText = `✅ [Billing / Pay] New payment amount: ${+body.Amount} ${body.Currency} next payment date: ${data.cloudPayments?.recurrent.startDate} workspace id: ${workspace._id} date of operation: ${body.DateTime} subscription id: ${body.SubscriptionId}` - , TelegramBotURLs.Money)); + + } else { + messageText = `✅ [Billing / Pay] New Recurrent payment + +amount: ${+body.Amount} ${body.Currency} +workspace id: ${workspace._id} +date of operation: ${body.DateTime} +subscription id: ${body.SubscriptionId}` + + } + + this.handleSendingToTelegramError(telegram.sendMessage(messageText, TelegramBotURLs.Money)); } } catch (e) { const error = e as Error; @@ -676,7 +690,9 @@ subscription id: ${body.SubscriptionId}` console.log('💎 CloudPayments /recurrent request', body); - this.handleSendingToTelegramError(telegram.sendMessage(`✅ [Billing / Recurrent] New recurrent transaction + const emoji = [SubscriptionStatus.CANCELLED, SubscriptionStatus.REJECTED].includes(body.Status) ? '❌' : '✅'; + + this.handleSendingToTelegramError(telegram.sendMessage(`${emoji} [Billing / Recurrent] New recurrent transaction amount: ${+body.Amount} ${body.Currency} next payment date: ${body.NextTransactionDate} @@ -684,6 +700,7 @@ workspace id: ${body.AccountId} subscription id: ${body.Id} status: ${body.Status}` , TelegramBotURLs.Money)); + HawkCatcher.send(new Error(`[Billing / Recurrent] New recurrent event with ${body.Status} status`), req.body); switch (body.Status) { From 612491d5737a61d702fe81797e97c5b34f79e28c Mon Sep 17 00:00:00 2001 From: Tanya Fomina Date: Sat, 26 Jul 2025 15:00:28 +0300 Subject: [PATCH 2/4] Lint --- src/billing/cloudpayments.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/billing/cloudpayments.ts b/src/billing/cloudpayments.ts index b14f656d..ac60f7eb 100644 --- a/src/billing/cloudpayments.ts +++ b/src/billing/cloudpayments.ts @@ -557,7 +557,7 @@ plan monthly charge: ${data.cloudPayments?.recurrent.amount} ${body.Currency}` await this.sendReceipt(workspace, tariffPlan, userEmail); - let messageText = '' + let messageText = ''; if (data.cloudPayments?.recurrent.startDate) { messageText = `✅ [Billing / Pay] New payment @@ -566,16 +566,14 @@ amount: ${+body.Amount} ${body.Currency} next payment date: ${data.cloudPayments?.recurrent.startDate} workspace id: ${workspace._id} date of operation: ${body.DateTime} -subscription id: ${body.SubscriptionId}` - +subscription id: ${body.SubscriptionId}`; } else { messageText = `✅ [Billing / Pay] New Recurrent payment amount: ${+body.Amount} ${body.Currency} workspace id: ${workspace._id} date of operation: ${body.DateTime} -subscription id: ${body.SubscriptionId}` - +subscription id: ${body.SubscriptionId}`; } this.handleSendingToTelegramError(telegram.sendMessage(messageText, TelegramBotURLs.Money)); From 2bb0d0cf6273f5511d6d4acd07764a407650018e Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 26 Jul 2025 12:02:04 +0000 Subject: [PATCH 3/4] Bump version up to 1.1.29 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4f47295e..f9b32ca1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hawk.api", - "version": "1.1.28", + "version": "1.1.29", "main": "index.ts", "license": "UNLICENSED", "scripts": { From 2ba5d72423e4695e32b1e4e512ae2f0c3dfeb60b Mon Sep 17 00:00:00 2001 From: Tanya Fomina Date: Mon, 4 Aug 2025 19:01:28 +0300 Subject: [PATCH 4/4] Upd --- src/billing/cloudpayments.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/billing/cloudpayments.ts b/src/billing/cloudpayments.ts index ac60f7eb..0f54dee9 100644 --- a/src/billing/cloudpayments.ts +++ b/src/billing/cloudpayments.ts @@ -690,7 +690,7 @@ subscription id: ${body.SubscriptionId}`; const emoji = [SubscriptionStatus.CANCELLED, SubscriptionStatus.REJECTED].includes(body.Status) ? '❌' : '✅'; - this.handleSendingToTelegramError(telegram.sendMessage(`${emoji} [Billing / Recurrent] New recurrent transaction + this.handleSendingToTelegramError(telegram.sendMessage(`${emoji} [Billing / Recurrent] New recurrent event amount: ${+body.Amount} ${body.Currency} next payment date: ${body.NextTransactionDate}