diff --git a/docs/WeChatPay.md b/docs/WeChatPay.md index 77808c9..f8dbea0 100644 --- a/docs/WeChatPay.md +++ b/docs/WeChatPay.md @@ -31,12 +31,12 @@ public override void ConfigureServices (ServiceConfigurationContext context) { // 默认商户 Id op.MchId = "000000000000000"; - // 微信支付的 API 密钥信息,会在后续进行签名时被使用。 - op.ApiKey = "****************************"; + // 微信支付的 API V3 密钥信息,会在后续进行 签名/加密/解密 时被使用。 + op.ApiV3Key = "****************************"; // 支付结果回调地址,用于接收支付结果通知。 // 如果安装了本模块提供的 HttpApi 模块,则默认是 域名 + /wechat-pay/notify 路由。 op.NotifyUrl = "https://xxx.xxxx.com/wechat-pay/notify"; - + // 如果需要支持退款操作,则以下配置必须 // 退款结果回调地址,用于接收退款结果通知。 @@ -54,7 +54,7 @@ public override void ConfigureServices (ServiceConfigurationContext context) 完整的 Setting 项清单:https://github.com/EasyAbp/Abp.WeChat/blob/master/src/Pay/EasyAbp.Abp.WeChat.Pay/Settings/AbpWeChatPaySettingDefinitionProvider.cs -> 注意,如您在 appsettings.json 中通过 Setting 设置 `ApiKey` 或 `CertificateSecret`,须自行加密后填入,参考:https://docs.abp.io/en/abp/latest/String-Encryption +> 注意,如您在 appsettings.json 中通过 Setting 设置 `ApiV3Key` 或 `CertificateSecret`,须自行加密后填入,参考:https://docs.abp.io/en/abp/latest/String-Encryption ## 二、提供的回调接口 @@ -65,17 +65,16 @@ public override void ConfigureServices (ServiceConfigurationContext context) 用户如果需要对支付结果进行处理,只需要实现一个或多个 `IWeChatPayEventHandler` 处理器即可。当框架接受到微信通知时,会触发开发人员编写的处理器,并将微信结果传递给这些处理器。 ```csharp -public class WeChatPaymentHandler : IWeChatPayEventHandler -{ - // 定义当前的处理的事件类型为:支付成功事件 - public WeChatHandlerType Type => WeChatHandlerType.Paid; - - public async Task HandleAsync(WeChatPayEventModel model) - { - Console.WriteLine("我知道支付成功了"); - return new WeChatRequestHandlingResult(true); - } -} + public class PaidWeChatPayEventHandler : IWeChatPayEventHandler + { + public WeChatHandlerType Type => WeChatHandlerType.Paid; + + public Task HandleAsync(WeChatPayEventModel model) + { + Console.WriteLine("支付成功。"); + return Task.FromResult(new WeChatRequestHandlingResult(true)); + } + } ``` 编写完成之后,则需要开发人员手动注入这些处理器。 @@ -92,8 +91,6 @@ public class XXXDomainModule : AbpModule 如果在处理过程当中出现了异常,那么你可以在返回 `WeChatRequestHandlingResult` 对象时,设置 `success` 参数为 `false`,并且可以填写对应的失败原因。 -其中 `XmlDocument` 对象内部的参数含义,可以参考微信支付 **[开发文档](https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_7&index=8)**。 - WeChatPay 模块默认提供了参数校验处理器,各个处理器的调用顺序是按照 **注入顺序** 来的,目前暂时不支持处理器自定义排序。 ### 2.2 退款回调接口 @@ -103,17 +100,16 @@ WeChatPay 模块默认提供了参数校验处理器,各个处理器的调用 用户如果需要对退款通知进行处理,只需要实现一个或多个 `IWeChatPayEventHandler` 处理器即可。当框架接受到微信通知时,会触发开发人员编写的处理器,并将微信结果传递给这些处理器。 ```csharp -public class XXXAAAHandler : IWeChatPayEventHandler -{ - // 定义当前处理器的类型为退款。 - public WeChatHandlerType Type => WeChatHandlerType.Refund; - - public Task HandleAsync(XmlDocument xmlDocument) - { - Console.WriteLine("接受到了数据"); - return Task.CompletedTask; - } -} + public class RefundWeChatPayEventHandler : IWeChatPayEventHandler + { + public WeChatHandlerType Type => WeChatHandlerType.Refund; + + public Task HandleAsync(WeChatPayEventModel model) + { + Console.WriteLine("退款成功。"); + return Task.FromResult(new WeChatRequestHandlingResult(true)); + } + } ``` 编写完成之后,则需要开发人员手动注册这些处理器。 @@ -128,8 +124,6 @@ public class XXXDomainModule : AbpModule } ``` -其中 `XmlDocument` 对象内部的参数含义,可以参考微信支付 **[开发文档](https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_16&index=10)**。 - ## 三、服务的使用 ### 3.1 发起支付请求 diff --git a/src/Pay/EasyAbp.Abp.WeChat.Pay/RequestHandling/IWeChatPayEventHandler.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/RequestHandling/IWeChatPayEventHandler.cs index 5e85db8..71b1e2e 100644 --- a/src/Pay/EasyAbp.Abp.WeChat.Pay/RequestHandling/IWeChatPayEventHandler.cs +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/RequestHandling/IWeChatPayEventHandler.cs @@ -6,10 +6,10 @@ namespace EasyAbp.Abp.WeChat.Pay.RequestHandling /// /// 定义了微信支付回调处理器。 /// - public interface IWeChatPayEventHandler + public interface IWeChatPayEventHandler { WeChatHandlerType Type { get; } - Task HandleAsync(WeChatPayEventModel model); + Task HandleAsync(WeChatPayEventModel model); } } \ No newline at end of file diff --git a/src/Pay/EasyAbp.Abp.WeChat.Pay/RequestHandling/WeChatPayEventRequestHandlingService.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/RequestHandling/WeChatPayEventRequestHandlingService.cs index 944c6e9..5bb7387 100644 --- a/src/Pay/EasyAbp.Abp.WeChat.Pay/RequestHandling/WeChatPayEventRequestHandlingService.cs +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/RequestHandling/WeChatPayEventRequestHandlingService.cs @@ -37,7 +37,7 @@ public virtual async Task PaidNotifyAsync(NotifyInp return new WeChatRequestHandlingResult(false, "签名验证不通过"); } - var handlers = LazyServiceProvider.LazyGetService>() + var handlers = LazyServiceProvider.LazyGetService>>() .Where(h => h.Type == WeChatHandlerType.Paid); var decryptingResult = DecryptResource(input, options); @@ -70,7 +70,7 @@ public virtual async Task RefundNotifyAsync(NotifyI return new WeChatRequestHandlingResult(false, "签名验证不通过"); } - var handlers = LazyServiceProvider.LazyGetService>() + var handlers = LazyServiceProvider.LazyGetService>>() .Where(x => x.Type == WeChatHandlerType.Refund); var decryptingResult = DecryptResource(input, options); diff --git a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/AppPayment/AppPaymentService.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/AppPayment/AppPaymentService.cs index 97ec068..4a0ea95 100644 --- a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/AppPayment/AppPaymentService.cs +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/AppPayment/AppPaymentService.cs @@ -1,6 +1,23 @@ -namespace EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.AppPayment; +using System.Net.Http; +using System.Threading.Tasks; +using EasyAbp.Abp.WeChat.Pay.Options; +using EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.Models; +using Volo.Abp.DependencyInjection; -public class AppPaymentService +namespace EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.AppPayment; + +public class AppPaymentService : BasicPaymentService { - + public const string CreateOrderUrl = "https://api.mch.weixin.qq.com/v3/pay/transactions/app"; + + public AppPaymentService(AbpWeChatPayOptions options, + IAbpLazyServiceProvider lazyServiceProvider) : base(options, + lazyServiceProvider) + { + } + + public Task CreateOrderAsync(CreateOrderRequest request) + { + return ApiRequester.RequestAsync(HttpMethod.Post, CreateOrderUrl, request); + } } \ No newline at end of file diff --git a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/BasicPaymentService.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/BasicPaymentService.cs new file mode 100644 index 0000000..29a252d --- /dev/null +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/BasicPaymentService.cs @@ -0,0 +1,71 @@ +using System.IO; +using System.Net.Http; +using System.Threading.Tasks; +using EasyAbp.Abp.WeChat.Pay.Options; +using EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.JSPayment.Models; +using EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.Models; +using EasyAbp.Abp.WeChat.Pay.Services.ParametersModel; +using Volo.Abp.DependencyInjection; + +namespace EasyAbp.Abp.WeChat.Pay.Services.BasicPayment; + +public class BasicPaymentService : WeChatPayServiceBase +{ + public const string QueryOrderByWechatNumberUrl = "https://api.mch.weixin.qq.com/v3/pay/transactions/id/{transaction_id}"; + public const string QueryOrderByOutTradeNumberUrl = "https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/{out_trade_no}"; + public const string CloseOrderUrl = "https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/{out_trade_no}/close"; + public const string RefundUrl = "https://api.mch.weixin.qq.com/v3/refund/domestic/refunds"; + public const string QueryRefundOrderUrl = "https://api.mch.weixin.qq.com/v3/refund/domestic/refunds/{out_refund_no}"; + public const string GetTransactionBillUrl = "https://api.mch.weixin.qq.com/v3/bill/tradebill"; + public const string GetFundFlowBillUrl = "https://api.mch.weixin.qq.com/v3/bill/fundflowbill"; + + public BasicPaymentService(AbpWeChatPayOptions options, + IAbpLazyServiceProvider lazyServiceProvider) : base(options, + lazyServiceProvider) + { + } + + public Task QueryOrderByWechatNumberAsync(QueryOrderByWechatNumberRequest request) + { + var requestUrl = QueryOrderByWechatNumberUrl.Replace("{transaction_id}", request.TransactionId); + return ApiRequester.RequestAsync(HttpMethod.Get, requestUrl, request); + } + + public Task QueryOrderByOutTradeNumberAsync(QueryOrderByOutTradeNumberRequest request) + { + var requestUrl = QueryOrderByOutTradeNumberUrl.Replace("{out_trade_no}", request.OutTradeNo); + return ApiRequester.RequestAsync(HttpMethod.Get, requestUrl, request); + } + + public Task CloseOrderAsync(CloseOrderRequest request) + { + var requestUrl = CloseOrderUrl.Replace("{out_trade_no}", request.OutTradeNo); + return ApiRequester.RequestAsync(HttpMethod.Post, requestUrl, request); + } + + public Task RefundAsync(RefundOrderRequest orderRequest) + { + return ApiRequester.RequestAsync(HttpMethod.Post, RefundUrl, orderRequest); + } + + public Task QueryRefundOrderAsync(QueryRefundOrderRequest request) + { + var requestUrl = QueryRefundOrderUrl.Replace("{out_refund_no}", request.OutRefundNo); + return ApiRequester.RequestAsync(HttpMethod.Get, requestUrl); + } + + public Task GetTransactionBillAsync(GetTransactionBillRequest request) + { + return ApiRequester.RequestAsync(HttpMethod.Get, GetTransactionBillUrl, request); + } + + public Task GetFundFlowBillAsync(GetFundFlowBillRequest request) + { + return ApiRequester.RequestAsync(HttpMethod.Get, GetFundFlowBillUrl, request); + } + + public async Task DownloadBillFileAsync(string billDownloadUrl) + { + return await (await ApiRequester.RequestRawAsync(HttpMethod.Get, billDownloadUrl)).Content.ReadAsStreamAsync(); + } +} \ No newline at end of file diff --git a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/H5Payment/H5PaymentService.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/H5Payment/H5PaymentService.cs index 1b26c55..95c79ee 100644 --- a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/H5Payment/H5PaymentService.cs +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/H5Payment/H5PaymentService.cs @@ -1,6 +1,23 @@ -namespace EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.H5Payment; +using System.Net.Http; +using System.Threading.Tasks; +using EasyAbp.Abp.WeChat.Pay.Options; +using EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.Models; +using Volo.Abp.DependencyInjection; -public class H5PaymentService +namespace EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.H5Payment; + +public class H5PaymentService : BasicPaymentService { - + public const string CreateOrderUrl = "https://api.mch.weixin.qq.com/v3/pay/transactions/h5"; + + public H5PaymentService(AbpWeChatPayOptions options, + IAbpLazyServiceProvider lazyServiceProvider) : base(options, + lazyServiceProvider) + { + } + + public Task CreateOrderAsync(CreateOrderRequest request) + { + return ApiRequester.RequestAsync(HttpMethod.Post, CreateOrderUrl, request); + } } \ No newline at end of file diff --git a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/JSPayment/JsPaymentService.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/JSPayment/JsPaymentService.cs index 556e2d7..ca23b40 100644 --- a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/JSPayment/JsPaymentService.cs +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/JSPayment/JsPaymentService.cs @@ -1,25 +1,15 @@ -using System.IO; -using System.Net.Http; +using System.Net.Http; using System.Threading.Tasks; using EasyAbp.Abp.WeChat.Pay.Options; -using EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.JSPayment.Models; using EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.Models; -using EasyAbp.Abp.WeChat.Pay.Services.ParametersModel; using Volo.Abp.DependencyInjection; using CreateOrderRequest = EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.JSPayment.Models.CreateOrderRequest; namespace EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.JSPayment; -public class JsPaymentService : WeChatPayServiceBase +public class JsPaymentService : BasicPaymentService { public const string CreateOrderUrl = "https://api.mch.weixin.qq.com/v3/pay/transactions/jsapi"; - public const string QueryOrderByWechatNumberUrl = "https://api.mch.weixin.qq.com/v3/pay/transactions/id/{transaction_id}"; - public const string QueryOrderByOutTradeNumberUrl = "https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/{out_trade_no}"; - public const string CloseOrderUrl = "https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/{out_trade_no}/close"; - public const string RefundUrl = "https://api.mch.weixin.qq.com/v3/refund/domestic/refunds"; - public const string QueryRefundOrderUrl = "https://api.mch.weixin.qq.com/v3/refund/domestic/refunds/{out_refund_no}"; - public const string GetTransactionBillUrl = "https://api.mch.weixin.qq.com/v3/bill/tradebill"; - public const string GetFundFlowBillUrl = "https://api.mch.weixin.qq.com/v3/bill/fundflowbill"; public JsPaymentService(AbpWeChatPayOptions options, IAbpLazyServiceProvider lazyServiceProvider) : base(options, @@ -31,48 +21,4 @@ public Task CreateOrderAsync(CreateOrderRequest request) { return ApiRequester.RequestAsync(HttpMethod.Post, CreateOrderUrl, request); } - - public Task QueryOrderByWechatNumberAsync(QueryOrderByWechatNumberRequest request) - { - var requestUrl = QueryOrderByWechatNumberUrl.Replace("{transaction_id}", request.TransactionId); - return ApiRequester.RequestAsync(HttpMethod.Get, requestUrl, request); - } - - public Task QueryOrderByOutTradeNumberAsync(QueryOrderByOutTradeNumberRequest request) - { - var requestUrl = QueryOrderByOutTradeNumberUrl.Replace("{out_trade_no}", request.OutTradeNo); - return ApiRequester.RequestAsync(HttpMethod.Get, requestUrl, request); - } - - public Task CloseOrderAsync(CloseOrderRequest request) - { - var requestUrl = CloseOrderUrl.Replace("{out_trade_no}", request.OutTradeNo); - return ApiRequester.RequestAsync(HttpMethod.Post, requestUrl, request); - } - - public Task RefundAsync(RefundOrderRequest orderRequest) - { - return ApiRequester.RequestAsync(HttpMethod.Post, RefundUrl, orderRequest); - } - - public Task QueryRefundOrderAsync(QueryRefundOrderRequest request) - { - var requestUrl = QueryRefundOrderUrl.Replace("{out_refund_no}", request.OutRefundNo); - return ApiRequester.RequestAsync(HttpMethod.Get, requestUrl); - } - - public Task GetTransactionBillAsync(GetTransactionBillRequest request) - { - return ApiRequester.RequestAsync(HttpMethod.Get, GetTransactionBillUrl, request); - } - - public Task GetFundFlowBillAsync(GetFundFlowBillRequest request) - { - return ApiRequester.RequestAsync(HttpMethod.Get, GetFundFlowBillUrl, request); - } - - public async Task DownloadBillFileAsync(string billDownloadUrl) - { - return await (await ApiRequester.RequestRawAsync(HttpMethod.Get, billDownloadUrl)).Content.ReadAsStreamAsync(); - } } \ No newline at end of file diff --git a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/JSPayment/Models/CreateOrderPayerModel.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/JSPayment/Models/CreateOrderPayerModel.cs deleted file mode 100644 index 9ecccea..0000000 --- a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/JSPayment/Models/CreateOrderPayerModel.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using Newtonsoft.Json; - -namespace EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.JSPayment.Models; - -public class CreateOrderPayerModel -{ - /// - /// 用户标识。 - /// - /// - /// 用户在直连商户 AppId 下的唯一标识。
- /// 下单前需获取到用户的 OpenId。 - ///
- /// - /// 示例值: oUpF8uMuAJO_M2pxb1Q9zNjWeS6o。 - /// - [Required] - [StringLength(128, MinimumLength = 1)] - [JsonProperty("openid")] - public string OpenId { get; set; } -} \ No newline at end of file diff --git a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/JSPayment/Models/CreateOrderRequest.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/JSPayment/Models/CreateOrderRequest.cs index 52b2c5e..cc4004b 100644 --- a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/JSPayment/Models/CreateOrderRequest.cs +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/JSPayment/Models/CreateOrderRequest.cs @@ -13,4 +13,22 @@ public class CreateOrderRequest : BasicPayment.Models.CreateOrderRequest [NotNull] [JsonProperty("payer")] public CreateOrderPayerModel Payer { get; set; } + + public class CreateOrderPayerModel + { + /// + /// 用户标识。 + /// + /// + /// 用户在直连商户 AppId 下的唯一标识。
+ /// 下单前需获取到用户的 OpenId。 + ///
+ /// + /// 示例值: oUpF8uMuAJO_M2pxb1Q9zNjWeS6o。 + /// + [Required] + [StringLength(128, MinimumLength = 1)] + [JsonProperty("openid")] + public string OpenId { get; set; } + } } \ No newline at end of file diff --git a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/NativePayment/NativePaymentService.cs b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/NativePayment/NativePaymentService.cs index ae94f52..c7f9c31 100644 --- a/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/NativePayment/NativePaymentService.cs +++ b/src/Pay/EasyAbp.Abp.WeChat.Pay/Services/BasicPayment/NativePayment/NativePaymentService.cs @@ -1,6 +1,23 @@ -namespace EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.NativePayment; +using System.Net.Http; +using System.Threading.Tasks; +using EasyAbp.Abp.WeChat.Pay.Options; +using EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.Models; +using Volo.Abp.DependencyInjection; -public class NativePaymentService +namespace EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.NativePayment; + +public class NativePaymentService : BasicPaymentService { - + public const string CreateOrderUrl = "https://api.mch.weixin.qq.com/v3/pay/transactions/native"; + + public NativePaymentService(AbpWeChatPayOptions options, + IAbpLazyServiceProvider lazyServiceProvider) : base(options, + lazyServiceProvider) + { + } + + public Task CreateOrderAsync(CreateOrderRequest request) + { + return ApiRequester.RequestAsync(HttpMethod.Post, CreateOrderUrl, request); + } } \ No newline at end of file diff --git a/tests/EasyAbp.Abp.WeChat.Pay.Tests/RequestHanding/WeChatPayClientRequestHandlingServiceTests.cs b/tests/EasyAbp.Abp.WeChat.Pay.Tests/RequestHanding/WeChatPayClientRequestHandlingServiceTests.cs index 460d7e3..ca57c60 100644 --- a/tests/EasyAbp.Abp.WeChat.Pay.Tests/RequestHanding/WeChatPayClientRequestHandlingServiceTests.cs +++ b/tests/EasyAbp.Abp.WeChat.Pay.Tests/RequestHanding/WeChatPayClientRequestHandlingServiceTests.cs @@ -4,7 +4,6 @@ using EasyAbp.Abp.WeChat.Pay.RequestHandling.Dtos; using EasyAbp.Abp.WeChat.Pay.Services; using EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.JSPayment; -using EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.JSPayment.Models; using EasyAbp.Abp.WeChat.Pay.Services.BasicPayment.Models; using Shouldly; using Xunit; @@ -40,7 +39,7 @@ public async Task GetJsSdkWeChatPayParametersAsync_Test() Total = 1, Currency = "CNY" }, - Payer = new CreateOrderPayerModel + Payer = new CreateOrderRequest.CreateOrderPayerModel { OpenId = AbpWeChatPayTestConsts.OpenId // 请替换为测试用户的 OpenId,具体 Id 可以在微信公众号平台-用户管理进行查看。 } diff --git a/tests/EasyAbp.Abp.WeChat.Pay.Tests/Services/BasicPaymentServiceTests.cs b/tests/EasyAbp.Abp.WeChat.Pay.Tests/Services/BasicPaymentServiceTests.cs index 9d8a2c5..f6b048c 100644 --- a/tests/EasyAbp.Abp.WeChat.Pay.Tests/Services/BasicPaymentServiceTests.cs +++ b/tests/EasyAbp.Abp.WeChat.Pay.Tests/Services/BasicPaymentServiceTests.cs @@ -36,7 +36,7 @@ public async Task CreateOrderAsync_Test() Total = 1, Currency = "CNY" }, - Payer = new CreateOrderPayerModel + Payer = new CreateOrderRequest.CreateOrderPayerModel { OpenId = AbpWeChatPayTestConsts.OpenId // 请替换为测试用户的 OpenId,具体 Id 可以在微信公众号平台-用户管理进行查看。 }