/// <inheritdoc /> public override async Task <IPaymentVerifyResult> VerifyAsync(InvoiceContext context, CancellationToken cancellationToken = default) { if (context == null) { throw new ArgumentNullException(nameof(context)); } var account = await GetAccountAsync(context.Payment).ConfigureAwaitFalse(); var callbackResult = await FanAvaHelper.CreateCallbackResult( _httpContextAccessor.HttpContext.Request, _messageOptions, account, cancellationToken) .ConfigureAwaitFalse(); if (!callbackResult.IsSucceed) { return(PaymentVerifyResult.Failed(callbackResult.Message)); } var responseMessage = await _httpClient.PostJsonAsync( _gatewayOptions.ApiCheckPaymentUrl, callbackResult.CallbackCheckData, cancellationToken) .ConfigureAwaitFalse(); var checkResult = await FanAvaHelper.CreateCheckResult( responseMessage, account, callbackResult, _messageOptions); if (!checkResult.IsSucceed) { return(checkResult.VerifyResult); } var data = FanAvaHelper.CreateVerifyRequest(context, callbackResult, checkResult); responseMessage = await _httpClient.PostJsonAsync( _gatewayOptions.ApiVerificationUrl, data, cancellationToken) .ConfigureAwaitFalse(); return(await FanAvaHelper.CreateVerifyResult(responseMessage, callbackResult, _messageOptions)); }
/// <inheritdoc /> public override async Task <IPaymentFetchResult> FetchAsync(InvoiceContext context, CancellationToken cancellationToken = default) { if (context == null) { throw new ArgumentNullException(nameof(context)); } var account = await GetAccountAsync(context.Payment).ConfigureAwaitFalse(); var callbackResult = await FanAvaHelper.CreateCallbackResult( _httpContextAccessor.HttpContext.Request, _messageOptions, account, cancellationToken) .ConfigureAwaitFalse(); if (callbackResult.IsSucceed) { return(PaymentFetchResult.ReadyForVerifying()); } return(PaymentFetchResult.Failed(callbackResult.Message)); }