/// <inheritdoc /> public override async Task <IPaymentRequestResult> RequestAsync(Invoice invoice, CancellationToken cancellationToken = default) { if (invoice == null) { throw new ArgumentNullException(nameof(invoice)); } var account = await GetAccountAsync(invoice).ConfigureAwaitFalse(); var data = FanAvaHelper.CreateRequestModel(invoice, account); var responseMessage = await _httpClient.PostAsJsonAsync(_gatewayOptions.ApiGenerateToken, data, cancellationToken); return(await FanAvaHelper.CreateRequestResult(responseMessage, _httpContextAccessor.HttpContext, account, _gatewayOptions)); }
/// <inheritdoc /> public override async Task <IPaymentRequestResult> RequestAsync(Invoice invoice, CancellationToken cancellationToken = default) { if (invoice == null) { throw new ArgumentNullException(nameof(invoice)); } var account = await GetAccountAsync(invoice).ConfigureAwaitFalse(); var data = FanAvaHelper.CreateRequestModel(invoice, account); var jsonSettings = new JsonSerializerSettings { Converters = { new StringEnumConverter() } }; var responseMessage = await _httpClient.PostJsonAsync(_gatewayOptions.ApiTokenGenerationUrl, data, jsonSettings, cancellationToken); return(await FanAvaHelper.CreateRequestResult(responseMessage, _httpContextAccessor.HttpContext, account, _gatewayOptions)); }