/// <inheritdoc /> public override async Task <IPaymentVerifyResult> VerifyAsync(InvoiceContext context, CancellationToken cancellationToken = default) { if (context == null) { throw new ArgumentNullException(nameof(context)); } var callbackResult = await GetCallbackResult(context, cancellationToken); if (!callbackResult.IsSucceed) { return(PaymentVerifyResult.Failed(callbackResult.Message)); } var account = await GetAccountAsync(context.Payment).ConfigureAwaitFalse(); var data = SamanHelper.CreateVerifyData(callbackResult, account); var responseMessage = await _httpClient .PostXmlAsync(SamanHelper.GetVerificationUrl(context, _gatewayOptions), data, cancellationToken) .ConfigureAwaitFalse(); var response = await responseMessage.Content.ReadAsStringAsync().ConfigureAwaitFalse(); return(SamanHelper.CreateVerifyResult(response, context, callbackResult, _messageOptions)); }
/// <inheritdoc /> public override async Task <IPaymentRefundResult> RefundAsync(InvoiceContext context, Money amount, CancellationToken cancellationToken = default) { if (context == null) { throw new ArgumentNullException(nameof(context)); } var account = await GetAccountAsync(context.Payment).ConfigureAwaitFalse(); var data = SamanHelper.CreateRefundData(context, amount, account); var responseMessage = await _httpClient .PostXmlAsync(SamanHelper.GetVerificationUrl(context, _gatewayOptions), data, cancellationToken) .ConfigureAwaitFalse(); var response = await responseMessage.Content.ReadAsStringAsync().ConfigureAwaitFalse(); return(SamanHelper.CreateRefundResult(response, _messageOptions)); }