@@ -185,6 +185,16 @@ userId: ${userId}`
185185 return ;
186186 }
187187
188+ this . handleSendingToTelegramError ( telegram . sendMessage ( `✅ [Billing / Compose payment]
189+
190+ card link operation: ${ isCardLinkOperation }
191+ amount: ${ + tariffPlan . monthlyCharge } RUB
192+ last charge date: ${ workspace . lastChargeDate ?. toISOString ( ) }
193+ next payment date: ${ nextPaymentDate . toISOString ( ) }
194+ workspace id: ${ workspace . _id . toString ( ) }
195+ debug: ${ Boolean ( workspace . isDebug ) } `
196+ , TelegramBotURLs . Money ) ) ;
197+
188198 res . send ( {
189199 invoiceId,
190200 plan : {
@@ -294,7 +304,7 @@ userId: ${userId}`
294304 status : BusinessOperationStatus . Pending ,
295305 payload : {
296306 workspaceId : workspace . _id ,
297- amount : + body . Amount ,
307+ amount : + body . Amount * PENNY_MULTIPLIER ,
298308 currency : body . Currency ,
299309 userId : member . _id ,
300310 tariffPlanId : plan . _id ,
@@ -531,7 +541,8 @@ userId: ${userId}`
531541workspace id: ${ workspace . _id }
532542date of operation: ${ body . DateTime }
533543first payment date: ${ data . cloudPayments ?. recurrent . startDate }
534- sum: ${ data . cloudPayments ?. recurrent . amount } ${ body . Currency } `
544+ card link charge: ${ + body . Amount } ${ body . Currency }
545+ plan monthly charge: ${ data . cloudPayments ?. recurrent . amount } ${ body . Currency } `
535546 , TelegramBotURLs . Money ) ) ;
536547 } else {
537548 /**
@@ -670,7 +681,8 @@ subscription id: ${body.SubscriptionId}`
670681amount: ${ + body . Amount } ${ body . Currency }
671682next payment date: ${ body . NextTransactionDate }
672683workspace id: ${ body . AccountId }
673- subscription id: ${ body . Id } `
684+ subscription id: ${ body . Id }
685+ status: ${ body . Status } `
674686 , TelegramBotURLs . Money ) ) ;
675687 HawkCatcher . send ( new Error ( `[Billing / Recurrent] New recurrent event with ${ body . Status } status` ) , req . body ) ;
676688
@@ -680,6 +692,10 @@ subscription id: ${body.Id}`
680692 let workspace ;
681693
682694 try {
695+ /**
696+ * If there is a workspace with subscription id then subscription was cancelled via CloudPayments admin panel (or other no garage way)
697+ * We need to remove subscription id from workspace
698+ */
683699 workspace = await context . factories . workspacesFactory . findBySubscriptionId ( body . Id ) ;
684700 } catch ( e ) {
685701 const error = e as Error ;
@@ -693,9 +709,10 @@ subscription id: ${body.Id}`
693709 }
694710
695711 if ( ! workspace ) {
696- this . sendError ( res , RecurrentCodes . SUCCESS , `[Billing / Recurrent] Workspace with subscription id ${ body . Id } not found` , {
697- body,
698- } ) ;
712+ /**
713+ * If no workspace found by subscription id then subscription is cancelled via garage and subscription id was set to null in mutation before this hook executed
714+ * No need to send error
715+ */
699716
700717 return ;
701718 }
0 commit comments