public Task PublishP2PSucceededForReceiverAsync(string customerId, Money18 amount, string senderEmail)
 {
     return(PublishAsync(new PushNotificationEvent
     {
         CustomerId = customerId,
         MessageTemplateId = _pushNotificationsSettingsService.P2PTransferSucceededForReceiverTemplateId,
         Source = $"{AppEnvironment.Name} - {AppEnvironment.Version}",
         TemplateParameters =
             new Dictionary <string, string> {
             { "Amount", _moneyFormatter.FormatAmountToDisplayString(amount) }, { "SenderEmail", senderEmail }
         },
         CustomPayload = new Dictionary <string, string> {
             { "route", "transaction-history" }
         },
     }));
 }
Ejemplo n.º 2
0
        public async Task ProcessWarningsForReferralStakes()
        {
            var referralStakesForWarning = await _referralStakesRepository.GetStakesForWarningAsync();

            foreach (var stake in referralStakesForWarning)
            {
                var campaignResult = await _campaignClient.History.GetEarnRuleByIdAsync(Guid.Parse(stake.CampaignId));

                if (campaignResult.ErrorCode != CampaignServiceErrorCodes.None)
                {
                    _log.Error(message: "Cannot find campaign for existing stake", context: stake);
                }

                var evt = new PushNotificationEvent
                {
                    CustomerId         = stake.CustomerId,
                    MessageTemplateId  = _pushNotificationsSettingsService.ReferralStakeWarningTemplateId,
                    Source             = _componentSourceName,
                    TemplateParameters =
                        new Dictionary <string, string>
                    {
                        { "Amount", _moneyFormatter.FormatAmountToDisplayString(stake.Amount) },
                        { "Offer", campaignResult.Name }
                    },
                };

                await _pushNotificationsPublisher.PublishAsync(evt);

                await _referralStakesRepository.SetWarningSentAsync(stake.ReferralId);
            }
        }
 public Task SendP2PSucceededForSenderAsync(string customerId,
                                            string transactionId,
                                            Money18 amount,
                                            DateTime timestamp,
                                            Money18 currentBalance,
                                            string receiverEmail)
 {
     return(PublishAsync(new EmailMessageEvent
     {
         CustomerId = customerId,
         MessageTemplateId = _emailNotificationsSettingsService.P2PSuccessForSenderTemplateSettings.MessageTemplateId,
         SubjectTemplateId = _emailNotificationsSettingsService.P2PSuccessForSenderTemplateSettings.SubjectTemplateId,
         Source = $"{AppEnvironment.Name} - {AppEnvironment.Version}",
         TemplateParameters = new Dictionary <string, string>
         {
             { "ReceiverEmail", receiverEmail },
             { "TransactionId", transactionId },
             { "Amount", _moneyFormatter.FormatAmountToDisplayString(amount) },
             { "Timestamp", timestamp.ToString(CultureInfo.InvariantCulture) },
             { "CurrentBalance", _moneyFormatter.FormatAmountToDisplayString(currentBalance) }
         }
     }));
 }