private async Task Handle(TransactionProcessedEvent evt, ICommandSender sender) { ChaosKitty.Meow(); var clientAcc = await _clientAccountClient.GetByIdAsync(evt.ClientId); var sendEmailCommand = new SendNoRefundDepositDoneMailCommand { Email = clientAcc.Email, Amount = evt.Amount, AssetId = evt.Asset.Id }; sender.SendCommand(sendEmailCommand, "email"); ChaosKitty.Meow(); var pushSettings = await _clientAccountClient.GetPushNotificationAsync(evt.ClientId); if (pushSettings.Enabled) { var sendNotificationCommand = new SendNotificationCommand { NotificationId = clientAcc.NotificationsId, Type = NotificationType.TransactionConfirmed, Message = string.Format(TextResources.CashInSuccessText, new decimal(evt.Amount).TruncateDecimalPlaces(evt.Asset.Accuracy), evt.Asset.Id) }; sender.SendCommand(sendNotificationCommand, "notifications"); } }
public async Task <bool> IsPushEnabled(string clientId) { var pushSettings = await _clientAccountsClient.GetPushNotificationAsync(clientId); return(pushSettings != null && pushSettings.Enabled); }