public async Task SendSwiftEmail(string email, string clientId, double balanceChange, string assetId)
        {
            var msgData = new BankCashInData
            {
                ClientId = clientId,
                Amount   = balanceChange,
                AssetId  = assetId
            };

            await _emailSender.SendEmailAsync(email, msgData);
        }
Ejemplo n.º 2
0
        public async Task <EmailMessage> GenerateBankCashInMsg(BankCashInData messageData)
        {
            var personalData = await _personalDataRepository.GetAsync(messageData.ClientId);

            var asset = await _assetsService.TryGetAssetAsync(messageData.AssetId);

            var swiftCredentials = await _swiftCredentialsService.GetCredentialsAsync(asset.Id, personalData);

            var templateVm = new BankCashInTemplate
            {
                AssetId          = messageData.AssetId,
                AssetSymbol      = asset.Symbol,
                ClientName       = personalData.FullName,
                Amount           = messageData.Amount,
                Year             = DateTime.UtcNow.Year.ToString(),
                AccountName      = swiftCredentials.AccountName,
                AccountNumber    = swiftCredentials.AccountNumber,
                Bic              = swiftCredentials.BIC,
                PurposeOfPayment = swiftCredentials.PurposeOfPayment,
                BankAddress      = swiftCredentials.BankAddress,
                CompanyAddress   = swiftCredentials.CompanyAddress
            };

            var msg = new EmailMessage
            {
                Body    = await _templateGenerator.GenerateAsync("BankCashInTemplate", templateVm),
                Subject = EmailResources.BankCashIn_Subject,
                IsHtml  = true
            };

            //var stream = new MemoryStream();
            //await _srvPdfGenerator.PrintInvoice(stream, messageData.ClientId, messageData.Amount, messageData.AssetId);

            //msg.Attachments = new[]
            //{
            //    new EmailAttachment {ContentType = MediaTypeNames.Application.Pdf,
            //        FileName = "invoice.pdf", Stream = stream}
            //};

            return(msg);
        }