@@ -25,7 +25,6 @@ import {
2525 PlanDBScheme ,
2626 PlanProlongationPayload
2727} from '@hawk.so/types' ;
28- import { PENNY_MULTIPLIER } from 'codex-accounting-sdk' ;
2928import WorkspaceModel from '../models/workspace' ;
3029import HawkCatcher from '@hawk.so/nodejs' ;
3130import { publish } from '../rabbitmq' ;
@@ -45,6 +44,8 @@ import PlanModel from '../models/plan';
4544import { ClientApi , ClientService , CustomerReceiptItem , ReceiptApi , ReceiptTypes , TaxationSystem } from 'cloudpayments' ;
4645import { ComposePaymentPayload } from './types/composePaymentPayload' ;
4746
47+ const PENNY_MULTIPLIER = 100 ;
48+
4849interface ComposePaymentRequest extends express . Request {
4950 query : ComposePaymentPayload & { [ key : string ] : any } ;
5051 context : import ( '../types/graphql' ) . ResolverContextBase ;
@@ -525,8 +526,10 @@ userId: ${userId}`
525526
526527 this . handleSendingToTelegramError ( telegram . sendMessage ( `✅ [Billing / Pay] Card linked
527528Transaction details:
528- workspaceId: ${ workspace . _id }
529- date: ${ body . DateTime } `
529+ workspace id: ${ workspace . _id }
530+ date of operation: ${ body . DateTime }
531+ first payment date: ${ data . cloudPayments ?. recurrent . startDate }
532+ sum: ${ data . cloudPayments ?. recurrent . amount } ${ body . Currency } `
530533 , TelegramBotURLs . Money ) ) ;
531534 } else {
532535 /**
@@ -545,9 +548,10 @@ date: ${body.DateTime}`
545548Transaction details:
546549amount: ${ + body . Amount * PENNY_MULTIPLIER }
547550currency: ${ body . Currency }
548- workspaceId: ${ workspace . _id }
549- date: ${ body . DateTime }
550- subscriptionId: ${ body . SubscriptionId } `
551+ next payment date: ${ data . cloudPayments ?. recurrent . startDate }
552+ workspace id: ${ workspace . _id }
553+ date of operation: ${ body . DateTime }
554+ subscription id: ${ body . SubscriptionId } `
551555 , TelegramBotURLs . Money ) ) ;
552556
553557 }
@@ -639,7 +643,7 @@ subscriptionId: ${body.SubscriptionId}`
639643 return ;
640644 }
641645
642- this . handleSendingToTelegramError ( telegram . sendMessage ( `✅ [Billing / Fail] Transaction failed for «${ workspace . name } »` , TelegramBotURLs . Money ) ) ;
646+ this . handleSendingToTelegramError ( telegram . sendMessage ( `❌ [Billing / Fail] Transaction failed for «${ workspace . name } »` , TelegramBotURLs . Money ) ) ;
643647
644648 HawkCatcher . send ( new Error ( '[Billing / Fail] Transaction failed' ) , body as any ) ;
645649
@@ -661,7 +665,14 @@ subscriptionId: ${body.SubscriptionId}`
661665
662666 console . log ( '💎 CloudPayments /recurrent request' , body ) ;
663667
664- this . handleSendingToTelegramError ( telegram . sendMessage ( `[Billing / Recurrent] New recurrent event with ${ body . Status } status` , TelegramBotURLs . Money ) ) ;
668+ this . handleSendingToTelegramError ( telegram . sendMessage ( `✅ [Billing / Recurrent] New recurrent transaction
669+ Transaction details:
670+ amount: ${ + body . Amount * PENNY_MULTIPLIER }
671+ currency: ${ body . Currency }
672+ next payment date: ${ body . NextTransactionDate }
673+ workspace id: ${ body . AccountId }
674+ subscription id: ${ body . Id } `
675+ , TelegramBotURLs . Money ) ) ;
665676 HawkCatcher . send ( new Error ( `[Billing / Recurrent] New recurrent event with ${ body . Status } status` ) , req . body ) ;
666677
667678 switch ( body . Status ) {
0 commit comments