@@ -452,22 +452,44 @@ func (s *Server) SendMessage(ctx context.Context, req *messagingpb.SendMessageRe
452452 return nil , status .Errorf (codes .Internal , "failed to mark intent as fulfilled" )
453453 }
454454
455- _ , err = activity .SendNotification (
456- ctx ,
457- s .activityFeeds ,
458- activitypb .ActivityFeedType_TRANSACTION_HISTORY ,
459- userID ,
460- activity .NewSendListenerMessageNotificationBuilder (
455+ paymentAmount , err := intent .GetPaymentAmount (ctx , s .codeData , req .PaymentIntent )
456+ if err != nil {
457+ log .Warn ("Failed to get payment amount" , zap .Error (err ))
458+ return nil , status .Errorf (codes .Internal , "failed to get payment amount" )
459+ }
460+
461+ var notificationBuilder activity.NotificationBuilder
462+ switch req .Content [0 ].Type .(type ) {
463+ case * messagingpb.Content_Text , * messagingpb.Content_Reply :
464+ notificationBuilder = activity .NewSendListenerMessageNotificationBuilder (
461465 ctx ,
462466 userID ,
463467 req .ChatId ,
464468 sent .MessageId ,
465- flags . StartGroupFee ,
469+ paymentAmount ,
466470 sent .Ts .AsTime (),
467- ),
468- )
469- if err != nil {
470- log .Warn ("Failed to send activity feed notification" , zap .Error (err ))
471+ )
472+ case * messagingpb.Content_Tip :
473+ notificationBuilder = activity .NewSendTipNotificationBuilder (
474+ ctx ,
475+ userID ,
476+ req .ChatId ,
477+ sent .MessageId ,
478+ paymentAmount ,
479+ sent .Ts .AsTime (),
480+ )
481+ }
482+ if notificationBuilder != nil {
483+ _ , err = activity .SendNotification (
484+ ctx ,
485+ s .activityFeeds ,
486+ activitypb .ActivityFeedType_TRANSACTION_HISTORY ,
487+ userID ,
488+ notificationBuilder ,
489+ )
490+ if err != nil {
491+ log .Warn ("Failed to send activity feed notification" , zap .Error (err ))
492+ }
471493 }
472494 }
473495
0 commit comments