public async Task Consume(ConsumeContext <IUserActivated> context) { await _smsLogRepository.LogAsync(SmsLog.CreateInitialLog(context.Message)); await _notificationFacade.SendEmailAsync( context.Message, Template.AccountActivationEmailUser, context.Message.Email); await _notificationFacade.SendSmsAsync( context.Message, Template.AccountActivationSmsUser, context.Message.Phone); }
public async Task Consume(ConsumeContext <ISmsCreditAdded> context) { await _smsLogRepository.LogAsync(SmsLog.CreateSmsAdditionLog(context.Message)); await _notificationFacade.SendEmailAsync( context.Message, Template.SmsCreditAddedEmailUser, context.Message.Email); await _notificationFacade.SendSmsAsync( context.Message, Template.SmsCreditAddedSmsUser, context.Message.Phone); }
public async Task Consume(ConsumeContext <ISendSmsRequestReceived> context) { await _smsLogRepository.LogAsync(SmsLog.CreateUsageLog(context.Message)); var smsList = context.Message.SmsMessages.Select(s => new Sms(context.Message, s)); await StoreAsync(smsList); foreach (var message in smsList) { try { await _smsClient.SendAsync(message); } catch (Exception ex) { _logger.LogError(ex, "Error while sending sms"); await UpdateSmsStatusAsync(ex, message); await PublishSmsRequestFailedEventAsync(context, message, ex); } } }
public async Task Consume(ConsumeContext <IReferredUserActivated> context) { await _smsLogRepository.LogAsync(SmsLog.CreateSmsPromotionLogs(context.Message)); await _notificationFacade.SendEmailAsync( context.Message, Template.RefereeSmsCreditsAddedEmail, context.Message.RefereeEmail); await _notificationFacade.SendEmailAsync( context.Message, Template.ReferrerSmsCreditsAddedEmail, context.Message.ReferrerEmail); await _notificationFacade.SendSmsAsync( context.Message, Template.RefereeSmsCreditsAddedSms, context.Message.RefereePhone); await _notificationFacade.SendSmsAsync( context.Message, Template.ReferrerSmsCreditsAddedSms, context.Message.ReferrerPhone); }