From f0ab585147265704fd950c9eb9667aaf4cdd807e Mon Sep 17 00:00:00 2001 From: Fu Diwei Date: Sun, 30 Jun 2024 14:56:28 +0800 Subject: [PATCH] =?UTF-8?q?feat(tenpayv3):=20=E6=96=B0=E5=A2=9E=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E5=AD=90=E5=95=86=E6=88=B7=E7=AE=A1=E6=8E=A7=E6=83=85?= =?UTF-8?q?=E5=86=B5=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...xecuteMerchantOperationManageExtensions.cs | 33 ++++++++ ...rchantLimitationsBySubMerchantIdRequest.cs | 15 ++++ ...chantLimitationsBySubMerchantIdResponse.cs | 84 +++++++++++++++++++ ...antLimitationsBySubMerchantIdResponse.json | 19 +++++ 4 files changed, 151 insertions(+) create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientExecuteMerchantOperationManageExtensions.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/_Partner/MerchantOperationManage/GetMerchantOperationManageMerchantLimitationsBySubMerchantIdRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/_Partner/MerchantOperationManage/GetMerchantOperationManageMerchantLimitationsBySubMerchantIdResponse.cs create mode 100644 test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/_/_Partner/MerchantOperationManage/GetMerchantOperationManageMerchantLimitationsBySubMerchantIdResponse.json diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientExecuteMerchantOperationManageExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientExecuteMerchantOperationManageExtensions.cs new file mode 100644 index 00000000..8b3db778 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Extensions/WechatTenpayClientExecuteMerchantOperationManageExtensions.cs @@ -0,0 +1,33 @@ +using System; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Flurl.Http; + +namespace SKIT.FlurlHttpClient.Wechat.TenpayV3 +{ + public static class WechatTenpayClientExecuteMerchantOperationManageExtensions + { + /// + /// 异步调用 [GET] /mch-operation-manage/merchant-limitations/sub-mchid/{sub_mchid} 接口。 + /// + /// REF:
+ /// + ///
+ ///
+ /// + /// + /// + /// + public static async Task ExecuteGetMerchantOperationManageMerchantLimitationsBySubMerchantIdAsync(this WechatTenpayClient client, Models.GetMerchantOperationManageMerchantLimitationsBySubMerchantIdRequest 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 + .CreateFlurlRequest(request, HttpMethod.Get, "mch-operation-manage", "merchant-limitations", "sub-mchid", request.SubMerchantId); + + return await client.SendFlurlRequestAsJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false); + } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/_Partner/MerchantOperationManage/GetMerchantOperationManageMerchantLimitationsBySubMerchantIdRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/_Partner/MerchantOperationManage/GetMerchantOperationManageMerchantLimitationsBySubMerchantIdRequest.cs new file mode 100644 index 00000000..f9ab91c9 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/_Partner/MerchantOperationManage/GetMerchantOperationManageMerchantLimitationsBySubMerchantIdRequest.cs @@ -0,0 +1,15 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models +{ + /// + /// 表示 [GET] /mch-operation-manage/merchant-limitations/sub-mchid/{sub_mchid} 接口的请求。 + /// + public class GetMerchantOperationManageMerchantLimitationsBySubMerchantIdRequest : WechatTenpayRequest + { + /// + /// 获取或设置子商户号。 + /// + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public string SubMerchantId { get; set; } = string.Empty; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/_Partner/MerchantOperationManage/GetMerchantOperationManageMerchantLimitationsBySubMerchantIdResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/_Partner/MerchantOperationManage/GetMerchantOperationManageMerchantLimitationsBySubMerchantIdResponse.cs new file mode 100644 index 00000000..ab9ca1e7 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.TenpayV3/Models/_Partner/MerchantOperationManage/GetMerchantOperationManageMerchantLimitationsBySubMerchantIdResponse.cs @@ -0,0 +1,84 @@ +namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Models +{ + /// + /// 表示 [GET] /mch-operation-manage/merchant-limitations/sub-mchid/{sub_mchid} 接口的响应。 + /// + public class GetMerchantOperationManageMerchantLimitationsBySubMerchantIdResponse : WechatTenpayResponse + { + public static class Types + { + public class RecoverySpecification + { + /// + /// 获取或设置商户被管控原因类型。 + /// + [Newtonsoft.Json.JsonProperty("limitation_reason_type")] + [System.Text.Json.Serialization.JsonPropertyName("limitation_reason_type")] + public string? LimitationReasonType { get; set; } + + /// + /// 获取或设置商户被管控原因描述。 + /// + [Newtonsoft.Json.JsonProperty("limitation_reason")] + [System.Text.Json.Serialization.JsonPropertyName("limitation_reason")] + public string? LimitationReason { get; set; } + + /// + /// 获取或设置商户被该原因管控的解脱路径。 + /// + [Newtonsoft.Json.JsonProperty("recover_way")] + [System.Text.Json.Serialization.JsonPropertyName("recover_way")] + public string? RecoverWay { get; set; } + + /// + /// 获取或设置商户被该原因管控的解脱帮助链接。 + /// + [Newtonsoft.Json.JsonProperty("recover_help_url")] + [System.Text.Json.Serialization.JsonPropertyName("recover_help_url")] + public string? RecoverHelpUrl { get; set; } + + /// + /// 获取或设置商户被该原因管控的能力列表。 + /// + [Newtonsoft.Json.JsonProperty("relate_limitations")] + [System.Text.Json.Serialization.JsonPropertyName("relate_limitations")] + public string[]? RelateLimitationList { get; set; } + + /// + /// 获取或设置商户被该原因管控的其他能力描述。 + /// + [Newtonsoft.Json.JsonProperty("other_relate_limitations")] + [System.Text.Json.Serialization.JsonPropertyName("other_relate_limitations")] + public string? OtherRelateLimitation { get; set; } + } + } + + /// + /// 获取或设置微信商户号。 + /// + [Newtonsoft.Json.JsonProperty("mchid")] + [System.Text.Json.Serialization.JsonPropertyName("mchid")] + public string MerchantId { get; set; } = default!; + + /// + /// 获取或设置商户被管控能力列表。 + /// + [Newtonsoft.Json.JsonProperty("limited_functions")] + [System.Text.Json.Serialization.JsonPropertyName("limited_functions")] + public string[]? LimitedFunctionList { get; set; } + + /// + /// 获取或设置被管控原因及解脱路径列表列表。 + /// + [Newtonsoft.Json.JsonProperty("recovery_specifications")] + [System.Text.Json.Serialization.JsonPropertyName("recovery_specifications")] + public Types.RecoverySpecification[]? RecoverySpecificationList { get; set; } + + /// + /// 获取或设置商户其他被管控能力描述。 + /// + [Newtonsoft.Json.JsonProperty("other_limited_functions")] + [System.Text.Json.Serialization.JsonPropertyName("other_limited_functions")] + public string? OtherLimitedFunction { get; set; } + } +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/_/_Partner/MerchantOperationManage/GetMerchantOperationManageMerchantLimitationsBySubMerchantIdResponse.json b/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/_/_Partner/MerchantOperationManage/GetMerchantOperationManageMerchantLimitationsBySubMerchantIdResponse.json new file mode 100644 index 00000000..f53c1b73 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests/ModelSamples/_/_Partner/MerchantOperationManage/GetMerchantOperationManageMerchantLimitationsBySubMerchantIdResponse.json @@ -0,0 +1,19 @@ +{ + "mchid": "123000110", + "limited_functions": [ + "NO_TRANSACTION_AND_RECHARGE" + ], + "recovery_specifications": [ + { + "limitation_reason": "经营证照异常", + "recover_way": "修改主体资料", + "recover_help_url": "https://kf.qq.com", + "limitation_reason_type": "LICENSE_ABNORMAL", + "relate_limitations": [ + "NO_TRANSACTION_AND_RECHARGE" + ], + "other_relate_limitations": "关闭相册扫码支付,关闭长按识别支付" + } + ], + "other_limited_functions": "关闭相册扫码支付,关闭长按识别支付" +}