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");
            }
        }
Ejemplo n.º 2
0
        public async Task <CommandHandlingResult> Handle(SendNoRefundDepositDoneMailCommand command)
        {
            ChaosKitty.Meow();

            var content = new NoRefundDepositDoneData
            {
                Amount     = command.Amount,
                AssetBcnId = command.AssetId
            };
            await _emailSender.SendEmailAsync(command.Email, content);

            return(CommandHandlingResult.Ok());
        }