@@ -557,14 +557,26 @@ plan monthly charge: ${data.cloudPayments?.recurrent.amount} ${body.Currency}`
557557
558558 await this . sendReceipt ( workspace , tariffPlan , userEmail ) ;
559559
560- this . handleSendingToTelegramError ( telegram . sendMessage ( `✅ [Billing / Pay] New payment
560+ let messageText = '' ;
561+
562+ if ( data . cloudPayments ?. recurrent . startDate ) {
563+ messageText = `✅ [Billing / Pay] New payment
561564
562565amount: ${ + body . Amount } ${ body . Currency }
563566next payment date: ${ data . cloudPayments ?. recurrent . startDate }
564567workspace id: ${ workspace . _id }
565568date of operation: ${ body . DateTime }
566- subscription id: ${ body . SubscriptionId } `
567- , TelegramBotURLs . Money ) ) ;
569+ subscription id: ${ body . SubscriptionId } ` ;
570+ } else {
571+ messageText = `✅ [Billing / Pay] New Recurrent payment
572+
573+ amount: ${ + body . Amount } ${ body . Currency }
574+ workspace id: ${ workspace . _id }
575+ date of operation: ${ body . DateTime }
576+ subscription id: ${ body . SubscriptionId } ` ;
577+ }
578+
579+ this . handleSendingToTelegramError ( telegram . sendMessage ( messageText , TelegramBotURLs . Money ) ) ;
568580 }
569581 } catch ( e ) {
570582 const error = e as Error ;
@@ -676,14 +688,17 @@ subscription id: ${body.SubscriptionId}`
676688
677689 console . log ( '💎 CloudPayments /recurrent request' , body ) ;
678690
679- this . handleSendingToTelegramError ( telegram . sendMessage ( `✅ [Billing / Recurrent] New recurrent transaction
691+ const emoji = [ SubscriptionStatus . CANCELLED , SubscriptionStatus . REJECTED ] . includes ( body . Status ) ? '❌' : '✅' ;
692+
693+ this . handleSendingToTelegramError ( telegram . sendMessage ( `${ emoji } [Billing / Recurrent] New recurrent event
680694
681695amount: ${ + body . Amount } ${ body . Currency }
682696next payment date: ${ body . NextTransactionDate }
683697workspace id: ${ body . AccountId }
684698subscription id: ${ body . Id }
685699status: ${ body . Status } `
686700 , TelegramBotURLs . Money ) ) ;
701+
687702 HawkCatcher . send ( new Error ( `[Billing / Recurrent] New recurrent event with ${ body . Status } status` ) , req . body ) ;
688703
689704 switch ( body . Status ) {
0 commit comments