public async Task <IActionResult> EmailRequestAsync(EmailRequestCommand cmd) { var swiftCredentials = await _swiftCredentialsService.GetAsync(cmd.RegulationId, cmd.AssetId); var pd = await _personalDataService.GetAsync(cmd.ClientId); var asset = await _assetsService.TryGetAssetAsync(cmd.AssetId); _cqrsEngine.PublishEvent(new SwiftCredentialsRequestedEvent { Email = pd.Email, ClientName = pd.FullName, Amount = cmd.Amount, Year = DateTime.UtcNow.Year.ToString(), AccountName = swiftCredentials.AccountName, AccountNumber = swiftCredentials.AccountNumber, AssetId = swiftCredentials.AssetId, AssetSymbol = asset.Symbol ?? asset.DisplayId, BankAddress = swiftCredentials.BankAddress, Bic = swiftCredentials.BIC, CompanyAddress = swiftCredentials.CompanyAddress, CorrespondentAccount = swiftCredentials.CorrespondentAccount, PurposeOfPayment = await _purposeOfPaymentBuilder.Build( swiftCredentials.PurposeOfPayment, cmd.ClientId, cmd.AssetId), RegulatorId = swiftCredentials.RegulatorId }, SwiftCredentialsBoundedContext.Name); return(Ok()); }
public async Task <IActionResult> GetAsync(string clientId, string regulationId, string assetId) { ISwiftCredentials swiftCredentials = await _swiftCredentialsService.GetAsync(regulationId, assetId); var model = Mapper.Map <SwiftCredentialsModel>(swiftCredentials); model.PurposeOfPayment = await _purposeOfPaymentBuilder.Build( model.PurposeOfPayment, clientId, assetId); return(Ok(model)); }