/// <inheritdoc /> public override async Task <IPaymentVerifyResult> VerifyAsync(InvoiceContext context, CancellationToken cancellationToken = default) { if (context == null) { throw new ArgumentNullException(nameof(context)); } var callbackResult = await IdPayHelper.CreateCallbackResultAsync( context, _httpContextAccessor.HttpContext.Request, _messagesOptions.Value, cancellationToken) .ConfigureAwaitFalse(); if (!callbackResult.IsSucceed) { return(callbackResult.Result); } var account = await GetAccountAsync(context.Payment).ConfigureAwaitFalse(); IdPayHelper.AssignHeaders(_httpClient.DefaultRequestHeaders, account); var data = IdPayHelper.CreateVerifyData(context, callbackResult); var responseMessage = await _httpClient .PostJsonAsync(IdPayHelper.VerifyUrl, data, DefaultSerializerSettings, cancellationToken) .ConfigureAwaitFalse(); return(await IdPayHelper.CreateVerifyResult(responseMessage, _messagesOptions.Value)); }
/// <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(); IdPayHelper.AssignHeaders(_httpClient.DefaultRequestHeaders, account); var data = IdPayHelper.CreateRequestData(invoice); var responseMessage = await _httpClient .PostJsonAsync(IdPayHelper.RequestUrl, data, DefaultSerializerSettings, cancellationToken) .ConfigureAwaitFalse(); return(await IdPayHelper.CreateRequestResult(responseMessage, _httpContextAccessor.HttpContext, account)); }