diff --git a/docs/WechatTenpayV3/Basic_ModelDefinition.md b/docs/WechatTenpayV3/Basic_ModelDefinition.md index ca7971aa..8a978229 100644 --- a/docs/WechatTenpayV3/Basic_ModelDefinition.md +++ b/docs/WechatTenpayV3/Basic_ModelDefinition.md @@ -520,6 +520,8 @@ - 查询结算账户:`GetApplyForSubMerchantSettlement` + - 查询结算账户修改申请状态:`GetApplyForSubMerchantSettlementByApplicationNumber` + - 基础支付 - JSAPI 支付 @@ -722,6 +724,8 @@ - 查询结算账户:`GetApplyForSubMerchantSettlement` + - 查询结算账户修改申请状态:`GetApplyForSubMerchantSettlementByApplicationNumber` + - 电商收付通(普通支付) - APP 下单:`CreatePayPartnerTransactionApp` diff --git a/samples/SKIT.FlurlHttpClient.Wechat.TenpayV3.Sample_Net6/Controllers/TenpayNotifyController.cs b/samples/SKIT.FlurlHttpClient.Wechat.TenpayV3.Sample_Net6/Controllers/TenpayNotifyController.cs index 73f2df0a..abba1042 100644 --- a/samples/SKIT.FlurlHttpClient.Wechat.TenpayV3.Sample_Net6/Controllers/TenpayNotifyController.cs +++ b/samples/SKIT.FlurlHttpClient.Wechat.TenpayV3.Sample_Net6/Controllers/TenpayNotifyController.cs @@ -47,7 +47,8 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Sample.Controllers { // NOTICE: // 需提前注入 CertificateManager、并下载平台证书,才可以使用扩展方法执行验签操作。 - // 有关 CertificateManager 的用法请参阅《开发文档 / 基础用法 / 如何验证回调通知事件签名?》。 + // 请参考本示例项目 TenpayCertificateRefreshingBackgroundService 后台任务中的相关实现。 + // 有关 CertificateManager 的完整介绍请参阅《开发文档 / 基础用法 / 如何验证回调通知事件签名?》。 // 后续如何解密并反序列化,请参阅《开发文档 / 基础用法 / 如何解密回调通知事件中的敏感数据?》。 return new JsonResult(new { code = "FAIL", message = "验签失败" }); diff --git a/samples/SKIT.FlurlHttpClient.Wechat.TenpayV3.Sample_NetFramework47/Controllers/TenpayNotifyController.cs b/samples/SKIT.FlurlHttpClient.Wechat.TenpayV3.Sample_NetFramework47/Controllers/TenpayNotifyController.cs index 2e6b2be5..96492dcc 100644 --- a/samples/SKIT.FlurlHttpClient.Wechat.TenpayV3.Sample_NetFramework47/Controllers/TenpayNotifyController.cs +++ b/samples/SKIT.FlurlHttpClient.Wechat.TenpayV3.Sample_NetFramework47/Controllers/TenpayNotifyController.cs @@ -38,7 +38,8 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Sample.Controllers { // NOTICE: // 需提前注入 CertificateManager、并添加平台证书,才可以使用扩展方法执行验签操作。 - // 有关 CertificateManager 的用法请参阅《开发文档 / 基础用法 / 如何验证回调通知事件签名?》。 + // 请参考本示例项目 TenpayCertificateRefreshingBackgroundService 后台任务中的相关实现。 + // 有关 CertificateManager 的完整介绍请参阅《开发文档 / 基础用法 / 如何验证回调通知事件签名?》。 // 后续如何解密并反序列化,请参阅《开发文档 / 基础用法 / 如何解密回调通知事件中的敏感数据?》。 return Json(new { code = "FAIL", message = "验签失败" }); diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/Internal/WechatTenpayClientSignExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/Internal/WechatTenpayClientSignExtensions.cs index 07798909..878969d1 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/Internal/WechatTenpayClientSignExtensions.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/Internal/WechatTenpayClientSignExtensions.cs @@ -2,6 +2,8 @@ using System; namespace SKIT.FlurlHttpClient.Wechat.TenpayV3 { + using SKIT.FlurlHttpClient.Wechat.TenpayV3.Settings; + internal static class WechatTenpayClientSignExtensions { public static bool VerifySignature(this WechatTenpayClient client, string strTimestamp, string strNonce, string strContent, string strSignature, string strSignatureScheme, string strSerialNumber, out Exception? error) @@ -18,14 +20,14 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3 return false; } - var entry = client.PlatformCertificateManager.GetEntry(strSerialNumber); + CertificateEntry? entry = client.PlatformCertificateManager.GetEntry(strSerialNumber); if (!entry.HasValue) { error = new Exception($"There is no platform certificate matched the serial number: \"{strSerialNumber}\". Please make sure you have downloaded platform certificates first."); return false; } - if (!Settings.CertificateEntry.ALGORITHM_TYPE_RSA.Equals(entry.Value.AlgorithmType)) + if (!CertificateEntry.ALGORITHM_TYPE_RSA.Equals(entry.Value.AlgorithmType)) { error = new Exception($"The platform certificate with serial number: \"{strSerialNumber}\" is not for RSA."); return false; @@ -55,14 +57,14 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3 return false; } - var entry = client.PlatformCertificateManager.GetEntry(strSerialNumber); + CertificateEntry? entry = client.PlatformCertificateManager.GetEntry(strSerialNumber); if (!entry.HasValue) { error = new Exception($"There is no platform certificate matched the serial number: \"{strSerialNumber}\". Please make sure you have downloaded platform certificates first."); return false; } - if (!Settings.CertificateEntry.ALGORITHM_TYPE_SM2.Equals(entry.Value.AlgorithmType)) + if (!CertificateEntry.ALGORITHM_TYPE_SM2.Equals(entry.Value.AlgorithmType)) { error = new Exception($"The platform certificate with serial number: \"{strSerialNumber}\" is not for SM2."); return false; diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientExecuteApplyForSubMerchantExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientExecuteApplyForSubMerchantExtensions.cs index 97999cc6..42db3bd6 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientExecuteApplyForSubMerchantExtensions.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientExecuteApplyForSubMerchantExtensions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Net.Http; using System.Threading; using System.Threading.Tasks; @@ -74,9 +74,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3 /// /// 异步调用 [POST] /apply4sub/sub_merchants/{sub_mchid}/modify-settlement 接口。 - /// REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter11_1_3.shtml - /// REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter7_1_4.shtml - /// REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/Offline/apis/chapter4_6_3.shtml + /// REF: https://pay.weixin.qq.com/docs/partner/apis/modify-settlement/sub-merchants/modify-settlement.html /// /// /// @@ -95,9 +93,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3 /// /// 异步调用 [GET] /apply4sub/sub_merchants/{sub_mchid}/settlement 接口。 - /// REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter11_1_4.shtml - /// REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter7_1_5.shtml - /// REF: https://pay.weixin.qq.com/wiki/doc/apiv3_partner/Offline/apis/chapter4_6_5.shtml + /// REF: https://pay.weixin.qq.com/docs/partner/apis/modify-settlement/sub-merchants/get-settlement.html /// /// /// @@ -113,5 +109,24 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3 return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); } + + /// + /// 异步调用 [GET] /apply4sub/sub_merchants/{sub_mchid}/application/{application_no} 接口。 + /// REF: https://pay.weixin.qq.com/docs/partner/apis/modify-settlement/sub-merchants/get-application.html + /// + /// + /// + /// + /// + public static async Task ExecuteGetApplyForSubMerchantSettlementByApplicationNumberAsync(this WechatTenpayClient client, Models.GetApplyForSubMerchantSettlementByApplicationNumberRequest request, CancellationToken cancellationToken = default) + { + if (client is null) throw new ArgumentNullException(nameof(client)); + if (request is null) throw new ArgumentNullException(nameof(request)); + + IFlurlRequest flurlReq = client + .CreateRequest(request, HttpMethod.Get, "apply4sub", "sub_merchants", request.SubMerchantId, "application", request.ApplicationNumber); + + return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); + } } } diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientRequestEncryptionExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientRequestEncryptionExtensions.cs index 76cb97a5..04c48a5b 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientRequestEncryptionExtensions.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientRequestEncryptionExtensions.cs @@ -1,9 +1,12 @@ using System; +using System.Collections.Generic; using System.Linq; using System.Reflection; namespace SKIT.FlurlHttpClient.Wechat.TenpayV3 { + using SKIT.FlurlHttpClient.Wechat.TenpayV3.Settings; + /// /// 为 提供请求模型敏感数据加密的扩展方法。 /// @@ -14,7 +17,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3 { Utilities.ReflectionUtility.ReplacePropertyStringValue(ref request, (target, currentProp, oldValue) => { - var attribute = currentProp + WechatTenpaySensitivePropertyAttribute? attribute = currentProp .GetCustomAttributes() .FirstOrDefault(attr => Constants.SignSchemes.WECHATPAY2_RSA_2048_WITH_SHA256.Equals(attr.Scheme)); if (attribute == null) @@ -27,22 +30,22 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3 if (string.IsNullOrEmpty(request.WechatpayCertificateSerialNumber)) { // 如果未在请求中指定特定的平台证书序列号,从管理器中取过期时间最远的 - var entries = client.PlatformCertificateManager.AllEntries() - .Where(e => Settings.CertificateEntry.ALGORITHM_TYPE_RSA.Equals(e.AlgorithmType)) + IEnumerable entries = client.PlatformCertificateManager.AllEntries() + .Where(e => CertificateEntry.ALGORITHM_TYPE_RSA.Equals(e.AlgorithmType)) .OrderByDescending(e => e.ExpireTime); if (!entries.Any()) { throw new Exceptions.WechatTenpayEventVerificationException("Failed to encrypt request, because there is no platform certificate in the manager. Please make sure you have downloaded platform certificates first."); } - var entry = entries.First(); + CertificateEntry entry = entries.First(); certificate = entry.Certificate; request.WechatpayCertificateSerialNumber = entry.SerialNumber; } else { // 如果已在请求中指定特定的平台证书序列号,直接从管理器中取值 - var entry = client.PlatformCertificateManager.GetEntry(request.WechatpayCertificateSerialNumber!); + CertificateEntry? entry = client.PlatformCertificateManager.GetEntry(request.WechatpayCertificateSerialNumber!); if (!entry.HasValue) { throw new Exceptions.WechatTenpayEventVerificationException($"Failed to encrypt request, because there is no platform certificate matched the serial number: \"{request.WechatpayCertificateSerialNumber}\". Please make sure you have downloaded platform certificates first."); @@ -89,7 +92,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3 { Utilities.ReflectionUtility.ReplacePropertyStringValue(ref request, (target, currentProp, oldValue) => { - var attribute = currentProp + WechatTenpaySensitivePropertyAttribute? attribute = currentProp .GetCustomAttributes() .FirstOrDefault(attr => Constants.SignSchemes.WECHATPAY2_SM2_WITH_SM3.Equals(attr.Scheme)); if (attribute == null) @@ -102,22 +105,22 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3 if (string.IsNullOrEmpty(request.WechatpayCertificateSerialNumber)) { // 如果未在请求中指定特定的平台证书序列号,从管理器中取过期时间最远的 - var entries = client.PlatformCertificateManager.AllEntries() - .Where(e => Settings.CertificateEntry.ALGORITHM_TYPE_SM2.Equals(e.AlgorithmType)) + IEnumerable entries = client.PlatformCertificateManager.AllEntries() + .Where(e => CertificateEntry.ALGORITHM_TYPE_SM2.Equals(e.AlgorithmType)) .OrderByDescending(e => e.ExpireTime); if (!entries.Any()) { throw new Exceptions.WechatTenpayEventVerificationException("Failed to encrypt request, because there is no platform certificate in the manager. Please make sure you have downloaded platform certificates first."); } - var entry = entries.First(); + CertificateEntry entry = entries.First(); certificate = entry.Certificate; request.WechatpayCertificateSerialNumber = entry.SerialNumber; } else { // 如果已在请求中指定特定的平台证书序列号,直接从管理器中取值 - var entry = client.PlatformCertificateManager.GetEntry(request.WechatpayCertificateSerialNumber!); + CertificateEntry? entry = client.PlatformCertificateManager.GetEntry(request.WechatpayCertificateSerialNumber!); if (!entry.HasValue) { throw new Exceptions.WechatTenpayEventVerificationException($"Failed to encrypt request, because there is no platform certificate matched the serial number: \"{request.WechatpayCertificateSerialNumber}\". Please make sure you have downloaded platform certificates first."); diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientResponseDecryptionExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientResponseDecryptionExtensions.cs index b43dede1..80f55a14 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientResponseDecryptionExtensions.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientResponseDecryptionExtensions.cs @@ -73,7 +73,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3 { Utilities.ReflectionUtility.ReplacePropertyStringValue(ref response, (target, currentProp, oldValue) => { - var attribute = currentProp + WechatTenpaySensitivePropertyAttribute? attribute = currentProp .GetCustomAttributes() .FirstOrDefault(attr => Constants.SignSchemes.WECHATPAY2_RSA_2048_WITH_SHA256.Equals(attr.Scheme)); if (attribute == null) @@ -117,7 +117,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3 { Utilities.ReflectionUtility.ReplacePropertyStringValue(ref response, (target, currentProp, oldValue) => { - var attribute = currentProp + WechatTenpaySensitivePropertyAttribute? attribute = currentProp .GetCustomAttributes() .FirstOrDefault(attr => Constants.SignSchemes.WECHATPAY2_SM2_WITH_SM3.Equals(attr.Scheme)); if (attribute == null) diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Apply4SubMerchant/Settlement/GetApplyForSubMerchantSettlementByApplicationNumberRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Apply4SubMerchant/Settlement/GetApplyForSubMerchantSettlementByApplicationNumberRequest.cs new file mode 100644 index 00000000..639de0cc --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Apply4SubMerchant/Settlement/GetApplyForSubMerchantSettlementByApplicationNumberRequest.cs @@ -0,0 +1,22 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models +{ + /// + /// 表示 [GET] /apply4sub/sub_merchants/{sub_mchid}/application/{application_no} 接口的请求。 + /// + public class GetApplyForSubMerchantSettlementByApplicationNumberRequest : WechatTenpayRequest + { + /// + /// 获取或设置特约商户号。 + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public string SubMerchantId { get; set; } = string.Empty; + + /// + /// 获取或设置申请单号。 + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public string ApplicationNumber { get; set; } = string.Empty; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Apply4SubMerchant/Settlement/GetApplyForSubMerchantSettlementByApplicationNumberResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Apply4SubMerchant/Settlement/GetApplyForSubMerchantSettlementByApplicationNumberResponse.cs new file mode 100644 index 00000000..bea21b89 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Apply4SubMerchant/Settlement/GetApplyForSubMerchantSettlementByApplicationNumberResponse.cs @@ -0,0 +1,82 @@ +using System; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models +{ + /// + /// 表示 [GET] /apply4sub/sub_merchants/{sub_mchid}/application/{application_no} 接口的响应。 + /// + public class GetApplyForSubMerchantSettlementByApplicationNumberResponse : WechatTenpayResponse + { + /// + /// 获取或设置账户类型。 + /// + [Newtonsoft.Json.JsonProperty("account_type")] + [System.Text.Json.Serialization.JsonPropertyName("account_type")] + public string AccountType { get; set; } = default!; + + /// + /// 获取或设置开户名称(掩码显示)。 + /// + [Newtonsoft.Json.JsonProperty("account_name")] + [System.Text.Json.Serialization.JsonPropertyName("account_name")] + public string AccountName { get; set; } = default!; + + /// + /// 获取或设置银行账号(掩码显示)。 + /// + [Newtonsoft.Json.JsonProperty("account_number")] + [System.Text.Json.Serialization.JsonPropertyName("account_number")] + public string AccountNumber { get; set; } = default!; + + /// + /// 获取或设置开户银行。 + /// + [Newtonsoft.Json.JsonProperty("account_bank")] + [System.Text.Json.Serialization.JsonPropertyName("account_bank")] + public string AccountBank { get; set; } = default!; + + /// + /// 获取或设置开户银行省市编码。 + /// + [Newtonsoft.Json.JsonProperty("bank_address_code")] + [System.Text.Json.Serialization.JsonPropertyName("bank_address_code")] + public string? BankAddressCode { get; set; } + + /// + /// 获取或设置开户银行联行号。 + /// + [Newtonsoft.Json.JsonProperty("bank_branch_id")] + [System.Text.Json.Serialization.JsonPropertyName("bank_branch_id")] + public string? BankBranchId { get; set; } + + /// + /// 获取或设置开户银行全称(含支行)。 + /// + [Newtonsoft.Json.JsonProperty("bank_name")] + [System.Text.Json.Serialization.JsonPropertyName("bank_name")] + public string? BankBranchName { get; set; } + + /// + /// 获取或设置汇款验证结果。 + /// + [Newtonsoft.Json.JsonProperty("verify_result")] + [System.Text.Json.Serialization.JsonPropertyName("verify_result")] + public string VerifyResult { get; set; } = default!; + + /// + /// 获取或设置汇款验证失败原因。 + /// + [Newtonsoft.Json.JsonProperty("verify_fail_reason")] + [System.Text.Json.Serialization.JsonPropertyName("verify_fail_reason")] + public string? VerifyFailReason { get; set; } + + /// + /// 获取或设置汇款验证失败原因。 + /// + [Newtonsoft.Json.JsonProperty("verify_finish_time")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.RFC3339NullableDateTimeOffsetConverter))] + [System.Text.Json.Serialization.JsonPropertyName("verify_finish_time")] + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.RFC3339NullableDateTimeOffsetConverter))] + public DateTimeOffset? VerifyFinishTime { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Apply4SubMerchant/Settlement/GetApplyForSubMerchantSettlementResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Apply4SubMerchant/Settlement/GetApplyForSubMerchantSettlementResponse.cs index baae7e45..ac8e315e 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Apply4SubMerchant/Settlement/GetApplyForSubMerchantSettlementResponse.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Apply4SubMerchant/Settlement/GetApplyForSubMerchantSettlementResponse.cs @@ -1,4 +1,4 @@ -namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models +namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models { /// /// 表示 [GET] /apply4sub/sub_merchants/{sub_mchid}/settlement 接口的响应。 @@ -31,7 +31,7 @@ /// [Newtonsoft.Json.JsonProperty("bank_address_code")] [System.Text.Json.Serialization.JsonPropertyName("bank_address_code")] - public string BankAddressCode { get; set; } = default!; + public string? BankAddressCode { get; set; } /// /// 获取或设置开户银行联行号。 diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Apply4SubMerchant/Settlement/ModifyApplyForSubMerchantSettlementRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Apply4SubMerchant/Settlement/ModifyApplyForSubMerchantSettlementRequest.cs index f40db045..14ff536f 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Apply4SubMerchant/Settlement/ModifyApplyForSubMerchantSettlementRequest.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Apply4SubMerchant/Settlement/ModifyApplyForSubMerchantSettlementRequest.cs @@ -13,6 +13,13 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models [System.Text.Json.Serialization.JsonIgnore] public string SubMerchantId { get; set; } = string.Empty; + /// + /// 获取或设置修改模式。 + /// + [Newtonsoft.Json.JsonProperty("modify_mode")] + [System.Text.Json.Serialization.JsonPropertyName("modify_mode")] + public string? ModifyMode { get; set; } + /// /// 获取或设置账户类型。 /// @@ -20,6 +27,15 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models [System.Text.Json.Serialization.JsonPropertyName("account_type")] public string AccountType { get; set; } = string.Empty; + /// + /// 获取或设置开户名称(需使用平台公钥/证书加密)。 + /// + [Newtonsoft.Json.JsonProperty("account_name")] + [System.Text.Json.Serialization.JsonPropertyName("account_name")] + [WechatTenpaySensitiveProperty(scheme: Constants.SignSchemes.WECHATPAY2_RSA_2048_WITH_SHA256, algorithm: Constants.EncryptionAlgorithms.RSA_2048_ECB_PKCS8_OAEP_WITH_SHA1_AND_MGF1)] + [WechatTenpaySensitiveProperty(scheme: Constants.SignSchemes.WECHATPAY2_SM2_WITH_SM3, algorithm: Constants.EncryptionAlgorithms.SM2_C1C3C2_ASN1)] + public string? AccountName { get; set; } + /// /// 获取或设置银行账号(需使用平台公钥/证书加密)。 /// diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Apply4SubMerchant/Settlement/ModifyApplyForSubMerchantSettlementResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Apply4SubMerchant/Settlement/ModifyApplyForSubMerchantSettlementResponse.cs index 65c83e48..65c966b1 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Apply4SubMerchant/Settlement/ModifyApplyForSubMerchantSettlementResponse.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/Apply4SubMerchant/Settlement/ModifyApplyForSubMerchantSettlementResponse.cs @@ -1,9 +1,15 @@ -namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models +namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models { /// /// 表示 [POST] /apply4sub/sub_merchants/{sub_mchid}/modify-settlement 接口的响应。 /// public class ModifyApplyForSubMerchantSettlementResponse : WechatTenpayResponse { + /// + /// 获取或设置申请单号。 + /// + [Newtonsoft.Json.JsonProperty("application_no")] + [System.Text.Json.Serialization.JsonPropertyName("application_no")] + public string ApplicationNumber { get; set; } = default!; } } diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/WechatTenpayClient.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/WechatTenpayClient.cs index 5655e756..83911304 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/WechatTenpayClient.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/WechatTenpayClient.cs @@ -1,5 +1,4 @@ using System; -using System.Linq; using System.Net.Http; using System.Net.Http.Headers; using System.Threading; diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/Apply4SubMerchant/Settlement/GetApplyForSubMerchantSettlementByApplicationNumberResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/Apply4SubMerchant/Settlement/GetApplyForSubMerchantSettlementByApplicationNumberResponse.json new file mode 100644 index 00000000..7c8447d1 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/Apply4SubMerchant/Settlement/GetApplyForSubMerchantSettlementByApplicationNumberResponse.json @@ -0,0 +1,11 @@ +{ + "account_name": "张*", + "account_type": "ACCOUNT_TYPE_BUSINESS", + "account_bank": "工商银行", + "bank_name": "施秉县农村信用合作联社城关信用社", + "bank_branch_id": "402713354941", + "account_number": "62*************78", + "verify_result": "AUDIT_SUCCESS", + "verify_fail_reason": "银行卡户名或卡号有误", + "verify_finish_time": "2015-05-20T13:29:35+08:00" +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/Apply4SubMerchant/Settlement/GetApplyForSubMerchantSettlementResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/Apply4SubMerchant/Settlement/GetApplyForSubMerchantSettlementResponse.json index c4b33846..186e0f53 100644 --- a/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/Apply4SubMerchant/Settlement/GetApplyForSubMerchantSettlementResponse.json +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/Apply4SubMerchant/Settlement/GetApplyForSubMerchantSettlementResponse.json @@ -1,8 +1,9 @@ -{ +{ "account_type": "ACCOUNT_TYPE_BUSINESS", "account_bank": "工商银行", "bank_name": "施秉县农村信用合作联社城关信用社", "bank_branch_id": "402713354941", - "account_number": "***************8678", - "verify_result": "VERIFY_SUCCESS" + "account_number": "62*************78", + "verify_result": "VERIFY_SUCCESS", + "verify_fail_reason": "用户姓名/证件/手机不匹配,请核对后重试" } diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/Apply4SubMerchant/Settlement/ModifyApplyForSubMerchantSettlementRequest.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/Apply4SubMerchant/Settlement/ModifyApplyForSubMerchantSettlementRequest.json index 8015b720..ac0bfabb 100644 --- a/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/Apply4SubMerchant/Settlement/ModifyApplyForSubMerchantSettlementRequest.json +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/Apply4SubMerchant/Settlement/ModifyApplyForSubMerchantSettlementRequest.json @@ -1,8 +1,10 @@ -{ +{ + "modify_mode": "MODIFY_MODE_ASYNC", "account_type": "ACCOUNT_TYPE_BUSINESS", "account_bank": "工商银行", "bank_address_code": "110000", - "bank_name": "施秉县农村信用合作联社城关信用社", + "bank_name": "中国工商银行股份有限公司北京市分行营业部", "bank_branch_id": "402713354941", - "account_number": "d+xT+MQCvrLHUVDWv/8MR/dB7TkXM2YYZlokmXzFsWs35NXUot7C0NcxIrUF5FnxqCJHkNgKtxa6RxEYyba1+VBRLnqKG2fSy/Y5qDN08Ej9zHCwJjq52Wg1VG8MRugli9YMI1fI83KGBxhuXyemgS/hqFKsfYGiOkJqjTUpgY5VqjtL2N4l4z11T0ECB/aSyVXUysOFGLVfSrUxMPZy6jWWYGvT1+4P633f+R+ki1gT4WF/2KxZOYmli385ZgVhcR30mr4/G3HBcxi13zp7FnEeOsLlvBmI1PHN4C7Rsu3WL8sPndjXTd75kPkyjqnoMRrEEaYQE8ZRGYoeorwC+w==" + "account_number": "d+xT+MQCvrLHUVDWv/8MR/dB7TkXM2YYZlokmXzFsWs35NXUot7C0NcxIrUF5FnxqCJHkNgKtxa6RxEYyba1+VBRLnqKG2fSy/Y5qDN08Ej9zHCwJjq52Wg1VG8MRugli9YMI1fI83KGBxhuXyemgS/hqFKsfYGiOkJqjTUpgY5VqjtL2N4l4z11T0ECB/aSyVXUysOFGLVfSrUxMPZy6jWWYGvT1+4P633f+R+ki1gT4WF/2KxZOYmli385ZgVhcR30mr4/G3HBcxi13zp7FnEeOsLlvBmI1PHN4C7Rsu3WL8sPndjXTd75kPkyjqnoMRrEEaYQE8ZRGYoeorwC+w==", + "account_name": "VyOMa+SncfM4lLha65dsxZ/xYW1zqBVVp6/W5mNkolESJU9fqgMt0lxjtuiWdhR+qUjnC2dTfuJuCOZs/Qi6kmicogGFjDC9ZxzFpdjR7AidWDuCIId5WRnRN8lGUcVyxctZZ4WcxxL2ADq57h7dZoFxNgyRYR4Y6q37LpYDccmYO5SiCkUP3rMX1CrTwKJysVhHij62HiU/P/yScImgdKrc+/MBWb1O6TT2RgwU3U6IwSZRWx4QH4EmYBLAQTdcEyUz2wuDmPA4nMSeXJVyzKl/WB+QYBh4Yj+BLT0HkA2IbTRyGX1U2wvv3N/w59Xq0pWYSXMHlmxhle2Cqj/7Cw==" } diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/Apply4SubMerchant/Settlement/ModifyApplyForSubMerchantSettlementResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/Apply4SubMerchant/Settlement/ModifyApplyForSubMerchantSettlementResponse.json new file mode 100644 index 00000000..e303cb87 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/Apply4SubMerchant/Settlement/ModifyApplyForSubMerchantSettlementResponse.json @@ -0,0 +1,3 @@ +{ + "application_no": "102329389XXXX" +}