Sfoglia il codice sorgente

重命名 IWeChatPayNotifyClient 方法名

Roc 5 anni fa
parent
commit
fec12d97d8

+ 2 - 2
samples/WebApplicationSample/Controllers/WeChatPayNotifyController.cs

@@ -29,7 +29,7 @@ namespace WebApplicationSample.Controllers
         {
             try
             {
-                var notify = await _client.ExecuteV2Async<WeChatPayUnifiedOrderNotify>(Request, _optionsAccessor.Value);
+                var notify = await _client.ExecuteAsync<WeChatPayUnifiedOrderNotify>(Request, _optionsAccessor.Value);
                 if (notify.ReturnCode == WeChatPayCode.Success)
                 {
                     if (notify.ResultCode == WeChatPayCode.Success)
@@ -57,7 +57,7 @@ namespace WebApplicationSample.Controllers
         {
             try
             {
-                var notify = await _client.ExecuteV2Async<WeChatPayRefundNotify>(Request, _optionsAccessor.Value);
+                var notify = await _client.ExecuteAsync<WeChatPayRefundNotify>(Request, _optionsAccessor.Value);
                 if (notify.ReturnCode == WeChatPayCode.Success)
                 {
                     if (notify.RefundStatus == WeChatPayCode.Success)

+ 1 - 1
samples/WebApplicationSample/Controllers/WeChatPayV3NotifyController.cs

@@ -29,7 +29,7 @@ namespace WebApplicationSample.Controllers
         {
             try
             {
-                var notify = await _client.ExecuteV3Async<WeChatPayTransactionsNotify>(Request, _optionsAccessor.Value);
+                var notify = await _client.ExecuteAsync<WeChatPayTransactionsNotify>(Request, _optionsAccessor.Value);
                 if (notify.TradeState == WeChatPayTradeState.Success)
                 {
                     Console.WriteLine("OutTradeNo: " + notify.OutTradeNo);

+ 2 - 2
src/Essensoft.AspNetCore.Payment.WeChatPay/V2/IWeChatPayNotifyClient.cs

@@ -15,7 +15,7 @@ namespace Essensoft.AspNetCore.Payment.WeChatPay.V2
         /// <param name="request">控制器的请求</param>
         /// <param name="options">配置选项</param>
         /// <returns>领域对象</returns>
-        Task<T> ExecuteV2Async<T>(Microsoft.AspNetCore.Http.HttpRequest request, WeChatPayOptions options) where T : V2.WeChatPayNotify;
+        Task<T> ExecuteAsync<T>(Microsoft.AspNetCore.Http.HttpRequest request, WeChatPayOptions options) where T : WeChatPayNotify;
 #endif
         /// <summary>
         /// 执行 WeChatPay V2 通知请求解析
@@ -24,6 +24,6 @@ namespace Essensoft.AspNetCore.Payment.WeChatPay.V2
         /// <param name="body">通知内容</param>
         /// <param name="options">配置选项</param>
         /// <returns>领域对象</returns>
-        Task<T> ExecuteV2Async<T>(string body, WeChatPayOptions options) where T : V2.WeChatPayNotify;
+        Task<T> ExecuteAsync<T>(string body, WeChatPayOptions options) where T : WeChatPayNotify;
     }
 }

+ 6 - 6
src/Essensoft.AspNetCore.Payment.WeChatPay/V2/WeChatPayNotifyClient.cs

@@ -22,7 +22,7 @@ namespace Essensoft.AspNetCore.Payment.WeChatPay.V2
         #region IWeChatPayNotifyClient Members
 
 #if NETCOREAPP3_1
-        public async Task<T> ExecuteV2Async<T>(Microsoft.AspNetCore.Http.HttpRequest request, WeChatPayOptions options) where T : V2.WeChatPayNotify
+        public async Task<T> ExecuteAsync<T>(Microsoft.AspNetCore.Http.HttpRequest request, WeChatPayOptions options) where T : WeChatPayNotify
         {
             if (request == null)
             {
@@ -30,7 +30,7 @@ namespace Essensoft.AspNetCore.Payment.WeChatPay.V2
             }
 
             var body = await new StreamReader(request.Body, Encoding.UTF8).ReadToEndAsync();
-            return await ExecuteV2Async<T>(body, options);
+            return await ExecuteAsync<T>(body, options);
         }
 #endif
 
@@ -38,7 +38,7 @@ namespace Essensoft.AspNetCore.Payment.WeChatPay.V2
 
         #region IWeChatPayNotifyClient Members
 
-        public Task<T> ExecuteV2Async<T>(string body, WeChatPayOptions options) where T : V2.WeChatPayNotify
+        public Task<T> ExecuteAsync<T>(string body, WeChatPayOptions options) where T : WeChatPayNotify
         {
             if (string.IsNullOrEmpty(body))
             {
@@ -57,10 +57,10 @@ namespace Essensoft.AspNetCore.Payment.WeChatPay.V2
 
             var parser = new WeChatPayNotifyXmlParser<T>();
             var notify = parser.Parse(body);
-            if (notify is V2.Notify.WeChatPayRefundNotify)
+            if (notify is Notify.WeChatPayRefundNotify)
             {
                 var key = MD5.Compute(options.Key).ToLowerInvariant();
-                var data = AES.Decrypt((notify as V2.Notify.WeChatPayRefundNotify).ReqInfo, key, CipherMode.ECB, PaddingMode.PKCS7);
+                var data = AES.Decrypt((notify as Notify.WeChatPayRefundNotify).ReqInfo, key, CipherMode.ECB, PaddingMode.PKCS7);
                 notify = parser.Parse(body, data);
             }
             else
@@ -75,7 +75,7 @@ namespace Essensoft.AspNetCore.Payment.WeChatPay.V2
 
         #region Common Method
 
-        private void CheckNotifySign(V2.WeChatPayNotify notify, WeChatPayOptions options)
+        private void CheckNotifySign(WeChatPayNotify notify, WeChatPayOptions options)
         {
             if (string.IsNullOrEmpty(notify.Body))
             {

+ 2 - 2
src/Essensoft.AspNetCore.Payment.WeChatPay/V3/IWeChatPayNotifyClient.cs

@@ -15,7 +15,7 @@ namespace Essensoft.AspNetCore.Payment.WeChatPay.V3
         /// <param name="request">控制器的请求</param>
         /// <param name="options">配置选项</param>
         /// <returns>领域对象</returns>
-        Task<T> ExecuteV3Async<T>(Microsoft.AspNetCore.Http.HttpRequest request, WeChatPayOptions options) where T : WeChatPayNotify;
+        Task<T> ExecuteAsync<T>(Microsoft.AspNetCore.Http.HttpRequest request, WeChatPayOptions options) where T : WeChatPayNotify;
 #endif
         /// <summary>
         /// 执行 WeChatPay V3 通知请求解析
@@ -28,6 +28,6 @@ namespace Essensoft.AspNetCore.Payment.WeChatPay.V3
         /// <param name="signature">Wechatpay_Signature</param>
         /// <param name="options">配置选项</param>
         /// <returns>领域对象</returns>
-        Task<T> ExecuteV3Async<T>(string body, string serial, string timestamp, string nonce, string signature, WeChatPayOptions options) where T : WeChatPayNotify;
+        Task<T> ExecuteAsync<T>(string body, string serial, string timestamp, string nonce, string signature, WeChatPayOptions options) where T : WeChatPayNotify;
     }
 }

+ 3 - 3
src/Essensoft.AspNetCore.Payment.WeChatPay/V3/WeChatPayNotifyClient.cs

@@ -27,7 +27,7 @@ namespace Essensoft.AspNetCore.Payment.WeChatPay.V3
         #region IWeChatPayNotifyClient Members
 
 #if NETCOREAPP3_1
-        public async Task<T> ExecuteV3Async<T>(Microsoft.AspNetCore.Http.HttpRequest request, WeChatPayOptions options) where T : WeChatPayNotify
+        public async Task<T> ExecuteAsync<T>(Microsoft.AspNetCore.Http.HttpRequest request, WeChatPayOptions options) where T : WeChatPayNotify
         {
             if (options == null)
             {
@@ -61,7 +61,7 @@ namespace Essensoft.AspNetCore.Payment.WeChatPay.V3
                 signature = signatureValues.ElementAt(0);
             }
 
-            return await ExecuteV3Async<T>(body, serial, timestamp, nonce, signature, options);
+            return await ExecuteAsync<T>(body, serial, timestamp, nonce, signature, options);
         }
 #endif
 
@@ -69,7 +69,7 @@ namespace Essensoft.AspNetCore.Payment.WeChatPay.V3
 
         #region IWeChatPayNotifyClient Members
 
-        public async Task<T> ExecuteV3Async<T>(string body, string serial, string timestamp, string nonce, string signature, WeChatPayOptions options) where T : WeChatPayNotify
+        public async Task<T> ExecuteAsync<T>(string body, string serial, string timestamp, string nonce, string signature, WeChatPayOptions options) where T : WeChatPayNotify
         {
             if (options == null)
             {