public async Task <IActionResult> GetPaymentUrl([FromBody] PaymentUrlRequestModel input) { var clientInfoTask = _clientAccountClient.ClientAccountInformation.GetByIdAsync(_requestContext.ClientId); var pdTask = _personalDataService.GetAsync(_requestContext.ClientId); await Task.WhenAll(clientInfoTask, pdTask); var pd = pdTask.Result; var result = await _link4PayServiceClient.GetPaymentUrlAsync(new PaymentUrlRequest { Transaction = new Transaction { TransactionId = Guid.NewGuid().ToString(), Amount = input.Amount, AssetId = input.AssetId, ClientId = _requestContext.ClientId, ExternalClientId = clientInfoTask.Result.ExternalId }, Details = new DetailsInfo { FirstName = pd.FirstName, LastName = pd.LastName, Email = pd.Email, Phone = pd.ContactPhone, CountryIso3 = pd.CountryFromPOA }, Urls = new UrlsInfo { OkUrl = input.OkUrl, CancelUrl = input.CancelUrl, FailUrl = input.FailUrl } }); if (result.Error != null) { if (result.Error.ErrorType == ErrorDetails.Types.ErrorType.CurrencyNotSupported) { throw LykkeApiErrorException.BadRequest(LykkeApiErrorCodes.Service.AssetUnavailable); } if (result.Error.ErrorType == ErrorDetails.Types.ErrorType.CountryNotSupported) { throw LykkeApiErrorException.BadRequest(LykkeApiErrorCodes.Service.CountryUnavailable); } } var resp = new PaymentUrlResponseModel { Url = result.PaymentUrl, CancelUrl = result.CancelUrl, FailUrl = result.FailUrl, OkUrl = result.OkUrl }; return(Ok(resp)); }
public Task <IActionResult> PostFxPaygate([FromBody] PaymentUrlRequestModel input) { return(GetPaymentUrl(input)); }