@@ -1,4 +1,5 @@
using System;
+using System.IO;
using System.Threading.Tasks;
using Essensoft.AspNetCore.Payment.WeChatPay;
using Essensoft.AspNetCore.Payment.WeChatPay.V2;
@@ -32,6 +33,7 @@ namespace WebApplicationSample.Controllers
{
Request.EnableBuffering();
+ Request.Body.Seek(0, SeekOrigin.Begin);
var notify = await _client.ExecuteAsync<WeChatPayUnifiedOrderNotify>(Request, _optionsAccessor.Value);
if (notify.ReturnCode == WeChatPayCode.Success)
using Essensoft.AspNetCore.Payment.WeChatPay.V3;
var notify = await _client.ExecuteAsync<WeChatPayTransactionsNotify>(Request, _optionsAccessor.Value);
if (notify.TradeState == WeChatPayTradeState.Success)
@@ -29,7 +29,6 @@ namespace Essensoft.AspNetCore.Payment.WeChatPay.V2
throw new ArgumentNullException(nameof(request));
}
- request.Body.Seek(0, SeekOrigin.Begin);
using (var reader = new StreamReader(request.Body, Encoding.UTF8, true, 1024, true))
var body = await reader.ReadToEndAsync();
@@ -35,7 +35,6 @@ namespace Essensoft.AspNetCore.Payment.WeChatPay.V3
throw new ArgumentNullException(nameof(options));
var headers = GetWeChatPayHeadersFromRequest(request);