public void GenerateFromSwiftDetails(ICashOutRequest request, string initialRequestId, DateTime dateOfTransaction)
        {
            Task.Run(async() => {
                if (request == null || string.IsNullOrWhiteSpace(initialRequestId))
                {
                    return;
                }

                var swiftFields = request.PaymentFields.DeserializeJson <Swift>();
                var pd          = await _personalDataService.GetAsync(request.ClientId);

                var htmlContent = "<!DOCTYPE html><html><head><title>Cash out request</title></head><body><div style=\"font-family: Geneva, Arial, Helvetica, sans-serif; width: 650px; margin:20px auto;\"><div style=\"width:650px;\"><img src=\"https://lkefiles.blob.core.windows.net/images/emails/logo_emails.png\" height=\"40\" alt=\"Lykke logo\" /></div><table style=\"margin:auto;width:650px;border: none;background-color: #fff;\"><tr><td style=\"text-align:center;padding:0 40px 0 40px;\"><img src=\"https://lkefiles.blob.core.windows.net:443/images/emails/withdraw-icon.png\" width=\"200\" alt=\"Letter image\" /></td></tr><tr><td style=\"text-align:center;\"><span style=\"font-size: 1.4em; font-weight: bold;\">Cash Out Request <br/>(@[Amount] @[Asset] for @[UserEmail]) <br/>Processed</span></td></tr><tr><td style=\"padding:20px 40px 60px 40px;\"><table style=\"border-collapse:collapse\"><tr style=\"border-top: 1px solid #8C94A0; border-bottom: 1px solid #8C94A0;\"><td style=\"padding:15px 0 15px 0;\" width=\"260\"><span style=\"font-size: 1.1em;color: #8C94A0;\">SWIFT / ABA Routing</span></td><td style=\"padding:15px 0 15px 0;\" width=\"260\"><span style=\"font-size: 1.1em;color: #3F4D60;\">@[Bic]</span></td></tr><tr style=\"border-top: 1px solid #8C94A0; border-bottom: 1px solid #8C94A0;\"><td style=\"padding:15px 0 15px 0;\" width=\"260\"><span style=\"font-size: 1.1em;color: #8C94A0;\">Name of the bank</span></td><td style=\"padding:15px 0 15px 0;\" width=\"260\"><span style=\"font-size: 1.1em;color: #3F4D60;\">@[BankName]</span></td></tr><tr style=\"border-top: 1px solid #8C94A0; border-bottom: 1px solid #8C94A0;\"><td style=\"padding:15px 0 15px 0;\" width=\"260\"><span style=\"font-size: 1.1em;color: #8C94A0;\">Beneficiary's Account number (IBAN)</span></td><td style=\"padding:15px 0 15px 0;\" width=\"260\"><span style=\"font-size: 1.1em;color: #3F4D60;\">@[AccNumber]</span></td></tr><tr style=\"border-top: 1px solid #8C94A0; border-bottom: 1px solid #8C94A0;\"><td style=\"padding:15px 0 15px 0;\" width=\"260\"><span style=\"font-size: 1.1em;color: #8C94A0;\">Name of the account holder</span></td><td style=\"word-break:break-all; padding:15px 0 15px 0;\" width=\"260\"><span style=\"font-size: 1.1em;color: #3F4D60;\">@[AccName]</span></td></tr><tr style=\"border-top: 1px solid #8C94A0; border-bottom: 1px solid #8C94A0;\"><td style=\"padding:15px 0 15px 0;\" width=\"260\"><span style=\"font-size: 1.1em;color: #8C94A0;\">Country of the account holder</span></td><td style=\"padding:15px 0 15px 0;\" width=\"260\"><span style=\"font-size: 1.1em;color: #3F4D60;\">@[AccHolderCountry]</span></td></tr><tr style=\"border-top: 1px solid #8C94A0; border-bottom: 1px solid #8C94A0;\"><td style=\"padding:15px 0 15px 0;\" width=\"260\"><span style=\"font-size: 1.1em;color: #8C94A0;\">Zip Code of the account holder</span></td><td style=\"padding:15px 0 15px 0;\" width=\"260\"><span style=\"font-size: 1.1em;color: #3F4D60;\">@[AccHolderZipCode]</span></td></tr><tr style=\"border-top: 1px solid #8C94A0; border-bottom: 1px solid #8C94A0;\"><td style=\"padding:15px 0 15px 0;\" width=\"260\"><span style=\"font-size: 1.1em;color: #8C94A0;\">City of the account holder</span></td><td style=\"padding:15px 0 15px 0;\" width=\"260\"><span style=\"font-size: 1.1em;color: #3F4D60;\">@[AccHolderCity]</span></td></tr><tr style=\"border-top: 1px solid #8C94A0; border-bottom: 1px solid #8C94A0;\"><td style=\"padding:15px 0 15px 0;\" width=\"260\"><span style=\"font-size: 1.1em;color: #8C94A0;\">Address of the account holder</span></td><td style=\"padding:15px 0 15px 0;\" width=\"260\"><span style=\"font-size: 1.1em;color: #3F4D60;\">@[AccHolderAddress]</span></td></tr><tr style=\"border-top: 1px solid #8C94A0; border-bottom: 1px solid #8C94A0;\"><td style=\"padding:15px 0 15px 0;\" width=\"260\"><span style=\"font-size: 1.1em;color: #8C94A0;\">Date of the transaction</span><br/><span style=\"font-size: 1.1em;color: #8C94A0;\">(Year/Month/Date)</span></td><td style=\"padding:15px 0 15px 0;\" width=\"260\"><span style=\"font-size: 1.1em;color: #3F4D60;\">@[DateOfTransaction]</span></td></tr></table></td></tr></table></div></body></html>";

                htmlContent = htmlContent.Replace("@[Amount]", request.Amount.ToString());
                htmlContent = htmlContent.Replace("@[Asset]", request.AssetId);
                htmlContent = htmlContent.Replace("@[UserEmail]", pd.Email);

                htmlContent = htmlContent.Replace("@[Bic]", swiftFields.Bic);
                htmlContent = htmlContent.Replace("@[BankName]", swiftFields.BankName);
                htmlContent = htmlContent.Replace("@[AccNumber]", swiftFields.AccNumber);
                htmlContent = htmlContent.Replace("@[AccName]", swiftFields.AccName);
                htmlContent = htmlContent.Replace("@[AccHolderCountry]", swiftFields.AccHolderCountry);
                htmlContent = htmlContent.Replace("@[AccHolderZipCode]", swiftFields.AccHolderZipCode);
                htmlContent = htmlContent.Replace("@[AccHolderCity]", swiftFields.AccHolderCity);
                htmlContent = htmlContent.Replace("@[AccHolderAddress]", swiftFields.AccHolderAddress);
                htmlContent = htmlContent.Replace("@[DateOfTransaction]", dateOfTransaction.ToString("yyyy/MM/dd"));

                await HtmlToPdfAsync(htmlContent, SwiftDetailsBlobName(request.ClientId, initialRequestId), $"{dateOfTransaction:yyyyMMdd}_withdrawal {pd.FullName}.pdf");
                await SaveSwiftPdfReportToGoogleDriveAsync(request.ClientId, initialRequestId, request.AssetId);
            });
        }
        public async Task <string> InsertRequestAsync <T>(ICashOutRequest request, PaymentSystem paymentSystem, T paymentFields, CashOutRequestTradeSystem tradeSystem)
        {
            var entity = CashOutAttemptEntity.PendingRecords.Create(request, paymentSystem, paymentFields, tradeSystem);
            await _tableStorage.InsertAsync(entity);

            return(entity.RowKey);
        }
            public static CashOutAttemptEntity Create <T>(ICashOutRequest request, PaymentSystem paymentSystem,
                                                          T paymentFields, CashOutRequestTradeSystem tradeSystem)
            {
                var entity = CreateEntity(request, paymentSystem, paymentFields, tradeSystem);

                entity.PartitionKey = GeneratePartition();

                return(entity);
            }
            public static CashOutAttemptEntity Create <T>(ICashOutRequest request, PaymentSystem paymentSystem, T paymentFields, CashOutRequestTradeSystem tradeSystem)
            {
                var reqId  = Guid.NewGuid().ToString("N");
                var entity = CreateEntity(request, paymentSystem, paymentFields, tradeSystem);

                entity.PartitionKey = GeneratePartition(request.ClientId);
                entity.RowKey       = GenerateRowKey(reqId);
                entity.Status       = request.Status;

                return(entity);
            }
Ejemplo n.º 5
0
 public static HistoryEntry MapFrom(ICashOutRequest source)
 {
     return(new HistoryEntry
     {
         Id = source.Id,
         ClientId = source.ClientId,
         Currency = source.AssetId,
         OpType = "CashOutAttempt",
         DateTime = source.DateTime,
         Amount = source.Amount,
         CustomData = JsonConvert.SerializeObject(source),
         FeeSize = source.FeeSize,
         FeeType = source.FeeType.ToString()
     });
 }
        public static CashOutAttemptEntity CreateEntity <T>(ICashOutRequest request, PaymentSystem paymentSystem, T paymentFields, CashOutRequestTradeSystem tradeSystem)
        {
            var dt = DateTime.UtcNow;

            return(new CashOutAttemptEntity
            {
                AssetId = request.AssetId,
                Amount = request.Amount,
                ClientId = request.ClientId,
                PaymentSystem = paymentSystem,
                PaymentFields = paymentFields.ToJson(),
                DateTime = dt,
                State = request.State,
                TradeSystem = tradeSystem.ToString(),
                AccountId = request.AccountId,
                VolumeSize = request.VolumeSize
            });
        }
Ejemplo n.º 7
0
 public async Task InsertCancelledRequest(ICashOutRequest request)
 {
     await _cashOutCancelledRepository.InsertRequestAsync(request);
 }
Ejemplo n.º 8
0
 public async Task InsertDoneRequest(ICashOutRequest request)
 {
     await _cashOutDoneRepository.InsertRequestAsync(request);
 }
Ejemplo n.º 9
0
        public async Task InsertAttemptRequest <T>(ICashOutRequest request, PaymentSystem paymentSystem, T paymentFields)
        {
            await _cashOutAttemptRepository.InsertRequestAsync(request, paymentSystem, paymentFields);

            await UpdateBadges();
        }