Преглед на файлове

IWeChatPayV3PostRequest BizModel 更名为 BodyModel

Roc преди 5 години
родител
ревизия
8da8a97e30

+ 4 - 4
samples/WebApplicationSample/Controllers/WeChatPayV3Controller.cs

@@ -73,7 +73,7 @@ namespace WebApplicationSample.Controllers
             };
             };
 
 
             var request = new WeChatPayTransactionsAppRequest();
             var request = new WeChatPayTransactionsAppRequest();
-            request.SetBizModel(model);
+            request.SetBodyModel(model);
 
 
             var response = await _client.ExecuteAsync(request, _optionsAccessor.Value);
             var response = await _client.ExecuteAsync(request, _optionsAccessor.Value);
 
 
@@ -125,7 +125,7 @@ namespace WebApplicationSample.Controllers
             };
             };
 
 
             var request = new WeChatPayTransactionsJsApiRequest();
             var request = new WeChatPayTransactionsJsApiRequest();
-            request.SetBizModel(model);
+            request.SetBodyModel(model);
 
 
             var response = await _client.ExecuteAsync(request, _optionsAccessor.Value);
             var response = await _client.ExecuteAsync(request, _optionsAccessor.Value);
 
 
@@ -176,7 +176,7 @@ namespace WebApplicationSample.Controllers
             };
             };
 
 
             var request = new WeChatPayTransactionsNativeRequest();
             var request = new WeChatPayTransactionsNativeRequest();
-            request.SetBizModel(model);
+            request.SetBodyModel(model);
 
 
             var response = await _client.ExecuteAsync(request, _optionsAccessor.Value);
             var response = await _client.ExecuteAsync(request, _optionsAccessor.Value);
 
 
@@ -214,7 +214,7 @@ namespace WebApplicationSample.Controllers
             };
             };
 
 
             var request = new WeChatPayTransactionsH5Request();
             var request = new WeChatPayTransactionsH5Request();
-            request.SetBizModel(model);
+            request.SetBodyModel(model);
 
 
             var response = await _client.ExecuteAsync(request, _optionsAccessor.Value);
             var response = await _client.ExecuteAsync(request, _optionsAccessor.Value);
 
 

+ 5 - 5
src/Essensoft.AspNetCore.Payment.WeChatPay/IWeChatPayV3PostRequest.cs

@@ -8,14 +8,14 @@
         string GetRequestUrl();
         string GetRequestUrl();
 
 
         /// <summary>
         /// <summary>
-        /// 获取BizModel
+        /// 获取BodyModel
         /// </summary>
         /// </summary>
-        WeChatPayObject GetBizModel();
+        WeChatPayObject GetBodyModel();
 
 
         /// <summary>
         /// <summary>
-        /// 设置BizModel
+        /// 设置BodyModel
         /// </summary>
         /// </summary>
-        /// <param name="bizModel"></param>
-        void SetBizModel(WeChatPayObject bizModel);
+        /// <param name="bodyModel"></param>
+        void SetBodyModel(WeChatPayObject bodyModel);
     }
     }
 }
 }

+ 5 - 5
src/Essensoft.AspNetCore.Payment.WeChatPay/Request/WeChatPayTransactionsAppRequest.cs

@@ -9,21 +9,21 @@ namespace Essensoft.AspNetCore.Payment.WeChatPay.Request
     /// </summary>
     /// </summary>
     public class WeChatPayTransactionsAppRequest : IWeChatPayV3PostRequest<WeChatPayTransactionsAppResponse>
     public class WeChatPayTransactionsAppRequest : IWeChatPayV3PostRequest<WeChatPayTransactionsAppResponse>
     {
     {
-        private WeChatPayObject bizModel;
+        private WeChatPayObject bodyModel;
 
 
         public string GetRequestUrl()
         public string GetRequestUrl()
         {
         {
             return "https://api.mch.weixin.qq.com/v3/pay/transactions/app";
             return "https://api.mch.weixin.qq.com/v3/pay/transactions/app";
         }
         }
 
 
-        public WeChatPayObject GetBizModel()
+        public WeChatPayObject GetBodyModel()
         {
         {
-            return bizModel;
+            return bodyModel;
         }
         }
 
 
-        public void SetBizModel(WeChatPayObject bizModel)
+        public void SetBodyModel(WeChatPayObject bodyModel)
         {
         {
-            this.bizModel = bizModel;
+            this.bodyModel = bodyModel;
         }
         }
     }
     }
 }
 }

+ 5 - 5
src/Essensoft.AspNetCore.Payment.WeChatPay/Request/WeChatPayTransactionsH5Request.cs

@@ -9,21 +9,21 @@ namespace Essensoft.AspNetCore.Payment.WeChatPay.Request
     /// </summary>
     /// </summary>
     public class WeChatPayTransactionsH5Request : IWeChatPayV3PostRequest<WeChatPayTransactionsH5Response>
     public class WeChatPayTransactionsH5Request : IWeChatPayV3PostRequest<WeChatPayTransactionsH5Response>
     {
     {
-        private WeChatPayObject bizModel;
+        private WeChatPayObject bodyModel;
 
 
         public string GetRequestUrl()
         public string GetRequestUrl()
         {
         {
             return "https://api.mch.weixin.qq.com/v3/pay/transactions/h5";
             return "https://api.mch.weixin.qq.com/v3/pay/transactions/h5";
         }
         }
 
 
-        public WeChatPayObject GetBizModel()
+        public WeChatPayObject GetBodyModel()
         {
         {
-            return bizModel;
+            return bodyModel;
         }
         }
 
 
-        public void SetBizModel(WeChatPayObject bizModel)
+        public void SetBodyModel(WeChatPayObject bodyModel)
         {
         {
-            this.bizModel = bizModel;
+            this.bodyModel = bodyModel;
         }
         }
     }
     }
 }
 }

+ 5 - 5
src/Essensoft.AspNetCore.Payment.WeChatPay/Request/WeChatPayTransactionsJsApiRequest.cs

@@ -9,21 +9,21 @@ namespace Essensoft.AspNetCore.Payment.WeChatPay.Request
     /// </summary>
     /// </summary>
     public class WeChatPayTransactionsJsApiRequest : IWeChatPayV3PostRequest<WeChatPayTransactionsJsApiResponse>
     public class WeChatPayTransactionsJsApiRequest : IWeChatPayV3PostRequest<WeChatPayTransactionsJsApiResponse>
     {
     {
-        private WeChatPayObject bizModel;
+        private WeChatPayObject bodyModel;
 
 
         public string GetRequestUrl()
         public string GetRequestUrl()
         {
         {
             return "https://api.mch.weixin.qq.com/v3/pay/transactions/jsapi";
             return "https://api.mch.weixin.qq.com/v3/pay/transactions/jsapi";
         }
         }
 
 
-        public WeChatPayObject GetBizModel()
+        public WeChatPayObject GetBodyModel()
         {
         {
-            return bizModel;
+            return bodyModel;
         }
         }
 
 
-        public void SetBizModel(WeChatPayObject bizModel)
+        public void SetBodyModel(WeChatPayObject bodyModel)
         {
         {
-            this.bizModel = bizModel;
+            this.bodyModel = bodyModel;
         }
         }
     }
     }
 }
 }

+ 5 - 5
src/Essensoft.AspNetCore.Payment.WeChatPay/Request/WeChatPayTransactionsNativeRequest.cs

@@ -9,21 +9,21 @@ namespace Essensoft.AspNetCore.Payment.WeChatPay.Request
     /// </summary>
     /// </summary>
     public class WeChatPayTransactionsNativeRequest : IWeChatPayV3PostRequest<WeChatPayTransactionsNativeResponse>
     public class WeChatPayTransactionsNativeRequest : IWeChatPayV3PostRequest<WeChatPayTransactionsNativeResponse>
     {
     {
-        private WeChatPayObject bizModel;
+        private WeChatPayObject bodyModel;
 
 
         public string GetRequestUrl()
         public string GetRequestUrl()
         {
         {
             return "https://api.mch.weixin.qq.com/v3/pay/transactions/native";
             return "https://api.mch.weixin.qq.com/v3/pay/transactions/native";
         }
         }
 
 
-        public WeChatPayObject GetBizModel()
+        public WeChatPayObject GetBodyModel()
         {
         {
-            return bizModel;
+            return bodyModel;
         }
         }
 
 
-        public void SetBizModel(WeChatPayObject bizModel)
+        public void SetBodyModel(WeChatPayObject bodyModel)
         {
         {
-            this.bizModel = bizModel;
+            this.bodyModel = bodyModel;
         }
         }
     }
     }
 }
 }

+ 6 - 6
src/Essensoft.AspNetCore.Payment.WeChatPay/Utility/HttpClientExtensions.cs

@@ -66,7 +66,7 @@ namespace Essensoft.AspNetCore.Payment.WeChatPay.Utility
         public static async Task<(string serial, string timestamp, string nonce, string signature, string body, int statusCode)> PostAsync<T>(this HttpClient client, IWeChatPayV3PostRequest<T> request, WeChatPayOptions options) where T : WeChatPayV3Response
         public static async Task<(string serial, string timestamp, string nonce, string signature, string body, int statusCode)> PostAsync<T>(this HttpClient client, IWeChatPayV3PostRequest<T> request, WeChatPayOptions options) where T : WeChatPayV3Response
         {
         {
             var url = request.GetRequestUrl();
             var url = request.GetRequestUrl();
-            var content = SerializeBizModel(request);
+            var content = SerializeBodyModel(request);
             var token = BuildToken(url, "POST", content, options);
             var token = BuildToken(url, "POST", content, options);
             client.DefaultRequestHeaders.Add(WeChatPayConsts.Wechatpay_Serial, options.CertificateSerialNo);
             client.DefaultRequestHeaders.Add(WeChatPayConsts.Wechatpay_Serial, options.CertificateSerialNo);
             client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("WECHATPAY2-SHA256-RSA2048", token);
             client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("WECHATPAY2-SHA256-RSA2048", token);
@@ -88,15 +88,15 @@ namespace Essensoft.AspNetCore.Payment.WeChatPay.Utility
             }
             }
         }
         }
 
 
-        private static string SerializeBizModel<T>(IWeChatPayV3PostRequest<T> request) where T : WeChatPayV3Response
+        private static string SerializeBodyModel<T>(IWeChatPayV3PostRequest<T> request) where T : WeChatPayV3Response
         {
         {
-            var bizModel = request.GetBizModel();
-            if (bizModel != null)
+            var bodyModel = request.GetBodyModel();
+            if (bodyModel != null)
             {
             {
-                return JsonSerializer.Serialize(bizModel, bizModel.GetType(), jsonSerializerOptions);
+                return JsonSerializer.Serialize(bodyModel, bodyModel.GetType(), jsonSerializerOptions);
             }
             }
 
 
-            throw new WeChatPayException("BizModel is null!");
+            throw new WeChatPayException("BodyModel is null!");
         }
         }
 
 
         private static string BuildToken(string url, string method, string body, WeChatPayOptions options)
         private static string BuildToken(string url, string method, string body, WeChatPayOptions options)