From 1c88bc9d35b2bd903313a7701424764dbe07d64e Mon Sep 17 00:00:00 2001 From: mc7246 Date: Fri, 2 Aug 2024 17:12:26 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E6=B7=BB=E5=8A=A0=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E6=98=AF=E5=90=A6=E5=B7=B2=E5=AE=8C?= =?UTF-8?q?=E6=88=90=E4=BA=A4=E6=98=93=E7=BB=93=E7=AE=97=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E7=A1=AE=E8=AE=A4=202=E3=80=81=E6=B7=BB=E5=8A=A0=E7=AC=AC?= =?UTF-8?q?=E4=B8=89=E6=96=B9=E5=B0=8F=E7=A8=8B=E5=BA=8F=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E9=A1=B5=E8=AE=BE=E7=BD=AE=E7=BB=93=E6=9E=9C=E5=8F=8A=E5=AE=A1?= =?UTF-8?q?=E6=A0=B8=E7=BB=93=E6=9E=9C=E4=BA=8B=E4=BB=B6=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...equestMessageOrderPathApplyResultNotify.cs | 44 +++++++++++++ ...equestMessageOrderPathAuditResultNotify.cs | 62 +++++++++++++++++++ .../Senparc.Weixin.Open/Enums.cs | 11 +++- .../ThirdPartyMessageHandler.cs | 32 ++++++++++ .../RequestMessageFactory.cs | 6 ++ .../WxaAPIs/SecOrder/SecOrderApi.cs | 44 +++++++++++-- ...nagementConfirmationCompletedJsonResult.cs | 12 ++++ 7 files changed, 206 insertions(+), 5 deletions(-) create mode 100644 src/Senparc.Weixin.Open/Senparc.Weixin.Open/Entities/Request/RequestMessageOrderPathApplyResultNotify.cs create mode 100644 src/Senparc.Weixin.Open/Senparc.Weixin.Open/Entities/Request/RequestMessageOrderPathAuditResultNotify.cs create mode 100644 src/Senparc.Weixin.Open/Senparc.Weixin.Open/WxaAPIs/SecOrder/SecOrderJson/IsTradeManagementConfirmationCompletedJsonResult.cs diff --git a/src/Senparc.Weixin.Open/Senparc.Weixin.Open/Entities/Request/RequestMessageOrderPathApplyResultNotify.cs b/src/Senparc.Weixin.Open/Senparc.Weixin.Open/Entities/Request/RequestMessageOrderPathApplyResultNotify.cs new file mode 100644 index 0000000000..60b0608784 --- /dev/null +++ b/src/Senparc.Weixin.Open/Senparc.Weixin.Open/Entities/Request/RequestMessageOrderPathApplyResultNotify.cs @@ -0,0 +1,44 @@ +/*---------------------------------------------------------------- + Copyright (C) 2024 Senparc + + 文件名:RequestMessage3rdWxaAuth.cs + 文件功能描述:小程序订单页设置申请通知 + + + 创建标识:mc7246 - 20240802 +----------------------------------------------------------------*/ + +using System.Collections.Generic; + +namespace Senparc.Weixin.Open +{ + /// + /// 小程序订单页设置申请通知 + /// + public class RequestMessageOrderPathApplyResultNotify : RequestMessageBase + { + public override RequestInfoType InfoType + { + get { return RequestInfoType.order_path_apply_result_notify; } + } + + /// + /// 送审结果列表 + /// + public RequestMessageOrderPathApplyResultNotify_AppInfo list { get; set; } + } + + public class RequestMessageOrderPathApplyResultNotify_AppInfo + { + /// + /// 申请的appid + /// + public string appid { get; set; } + + /// + /// 送审结果,0 成功, 1 重复提审,-1 系统繁忙,-2 APPID非法 + /// + public int ret_code { get; set; } + + } +} diff --git a/src/Senparc.Weixin.Open/Senparc.Weixin.Open/Entities/Request/RequestMessageOrderPathAuditResultNotify.cs b/src/Senparc.Weixin.Open/Senparc.Weixin.Open/Entities/Request/RequestMessageOrderPathAuditResultNotify.cs new file mode 100644 index 0000000000..abe948917b --- /dev/null +++ b/src/Senparc.Weixin.Open/Senparc.Weixin.Open/Entities/Request/RequestMessageOrderPathAuditResultNotify.cs @@ -0,0 +1,62 @@ +/*---------------------------------------------------------------- + Copyright (C) 2024 Senparc + + 文件名:RequestMessage3rdWxaAuth.cs + 文件功能描述:小程序订单页设置审核结果通知 + + + 创建标识:mc7246 - 20240802 +----------------------------------------------------------------*/ + +using System.Collections.Generic; + +namespace Senparc.Weixin.Open +{ + /// + /// 小程序订单页设置审核结果通知 + /// + public class RequestMessageOrderPathAuditResultNotify : RequestMessageBase + { + public override RequestInfoType InfoType + { + get { return RequestInfoType.order_path_audit_result_notify; } + } + + /// + /// 申请结果列表 + /// + public RequestMessageOrderPathAuditResultNotify_AppInfo list { get; set; } + } + + public class RequestMessageOrderPathAuditResultNotify_AppInfo + { + /// + /// 申请的appid + /// + public string appid { get; set; } + + /// + /// 审核单id + /// + public long audit_id { get; set; } + + /// + /// 结果 4成功 + /// + public int status { get; set; } + + /// + /// 申请时间 + /// + public long apply_time { get; set; } + /// + /// 审核时间 + /// + public long audit_time { get; set; } + + /// + /// 结果说明 + /// + public string reason { get; set; } + } +} diff --git a/src/Senparc.Weixin.Open/Senparc.Weixin.Open/Enums.cs b/src/Senparc.Weixin.Open/Senparc.Weixin.Open/Enums.cs index e7048fc0a8..499ba3f188 100644 --- a/src/Senparc.Weixin.Open/Senparc.Weixin.Open/Enums.cs +++ b/src/Senparc.Weixin.Open/Senparc.Weixin.Open/Enums.cs @@ -137,7 +137,16 @@ public enum RequestInfoType /// /// 小程序认证年审和过期能力限制提醒推送事件 /// - notify_3rd_wxa_wxverify + notify_3rd_wxa_wxverify, + + /// + /// 小程序订单页设置申请通知 + /// + order_path_apply_result_notify, + /// + /// 小程序订单页设置审核结果通知 + /// + order_path_audit_result_notify } diff --git a/src/Senparc.Weixin.Open/Senparc.Weixin.Open/MessageHandlers/ThirdPartyMessageHandler.cs b/src/Senparc.Weixin.Open/Senparc.Weixin.Open/MessageHandlers/ThirdPartyMessageHandler.cs index 9b4e0243b4..2624a7e467 100644 --- a/src/Senparc.Weixin.Open/Senparc.Weixin.Open/MessageHandlers/ThirdPartyMessageHandler.cs +++ b/src/Senparc.Weixin.Open/Senparc.Weixin.Open/MessageHandlers/ThirdPartyMessageHandler.cs @@ -189,6 +189,18 @@ public void Execute() ResponseMessageText = On3rdWxaWxVerifyRequest(requestMessage); } break; + case RequestInfoType.order_path_apply_result_notify: + { + var requestMessage = RequestMessage as RequestMessageOrderPathApplyResultNotify; + ResponseMessageText = OnOrderPathApplyResultNorifyRequest(requestMessage); + } + break; + case RequestInfoType.order_path_audit_result_notify: + { + var requestMessage = RequestMessage as RequestMessageOrderPathAuditResultNotify; + ResponseMessageText = OnOrderPathAuditResultNotifyRequest(requestMessage); + } + break; default: throw new UnknownRequestMsgTypeException("未知的InfoType请求类型", null); } @@ -212,6 +224,26 @@ public virtual void OnExecuted() { } + /// + /// 小程序订单页设置申请结果通知 + /// + /// + /// + public virtual string OnOrderPathApplyResultNorifyRequest(RequestMessageOrderPathApplyResultNotify requestMessage) + { + return "success"; + } + + /// + /// 小程序订单页设置申请审核结果通知 + /// + /// + /// + public virtual string OnOrderPathAuditResultNotifyRequest(RequestMessageOrderPathAuditResultNotify requestMessage) + { + return "success"; + } + public virtual string On3rdWxaWxVerifyRequest(RequestMessage3rdWxaWxVerify requestMessage) { return "success"; diff --git a/src/Senparc.Weixin.Open/Senparc.Weixin.Open/RequestMessageFactory.cs b/src/Senparc.Weixin.Open/Senparc.Weixin.Open/RequestMessageFactory.cs index fb7a17e316..298ea404ad 100644 --- a/src/Senparc.Weixin.Open/Senparc.Weixin.Open/RequestMessageFactory.cs +++ b/src/Senparc.Weixin.Open/Senparc.Weixin.Open/RequestMessageFactory.cs @@ -110,6 +110,12 @@ public static IRequestMessageBase GetRequestEntity(XDocument doc, PostModel post case RequestInfoType.notify_3rd_wxa_wxverify: requestMessage = new RequestMessage3rdWxaWxVerify(); break; + case RequestInfoType.order_path_apply_result_notify: + requestMessage = new RequestMessageOrderPathApplyResultNotify(); + break; + case RequestInfoType.order_path_audit_result_notify: + requestMessage = new RequestMessageOrderPathAuditResultNotify(); + break; default: throw new UnknownRequestMsgTypeException(string.Format("InfoType:{0} 在RequestMessageFactory中没有对应的处理程序!", infoType), new ArgumentOutOfRangeException());//为了能够对类型变动最大程度容错(如微信目前还可以对公众账号suscribe等未知类型,但API没有开放),建议在使用的时候catch这个异常 } diff --git a/src/Senparc.Weixin.Open/Senparc.Weixin.Open/WxaAPIs/SecOrder/SecOrderApi.cs b/src/Senparc.Weixin.Open/Senparc.Weixin.Open/WxaAPIs/SecOrder/SecOrderApi.cs index 34a0118734..0317fba063 100644 --- a/src/Senparc.Weixin.Open/Senparc.Weixin.Open/WxaAPIs/SecOrder/SecOrderApi.cs +++ b/src/Senparc.Weixin.Open/Senparc.Weixin.Open/WxaAPIs/SecOrder/SecOrderApi.cs @@ -172,8 +172,8 @@ public static WxJsonResult SetMsgJumpPath(string accessToken, string path, int t /// 查询小程序是否已开通发货信息管理服务 /// https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/order-shipping/order-shipping.html#%E4%B8%83%E3%80%81%E6%9F%A5%E8%AF%A2%E5%B0%8F%E7%A8%8B%E5%BA%8F%E6%98%AF%E5%90%A6%E5%B7%B2%E5%BC%80%E9%80%9A%E5%8F%91%E8%B4%A7%E4%BF%A1%E6%81%AF%E7%AE%A1%E7%90%86%E6%9C%8D%E5%8A%A1 /// - /// - /// 商户自定义跳转路径。 + /// 接口调用凭证 + /// 待查询小程序的 appid /// /// public static IsTradeManagedJsonResult IsTradeManaged(string accessToken, string appid, int timeOut = Config.TIME_OUT) @@ -185,6 +185,24 @@ public static IsTradeManagedJsonResult IsTradeManaged(string accessToken, string }; return CommonJsonSend.Send(null, url, data, CommonJsonSendType.POST, timeOut); } + + /// + /// 查询小程序是否已完成交易结算管理确认 + /// https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/order-shipping/order-shipping.html#%E5%85%AB%E3%80%81%E6%9F%A5%E8%AF%A2%E5%B0%8F%E7%A8%8B%E5%BA%8F%E6%98%AF%E5%90%A6%E5%B7%B2%E5%AE%8C%E6%88%90%E4%BA%A4%E6%98%93%E7%BB%93%E7%AE%97%E7%AE%A1%E7%90%86%E7%A1%AE%E8%AE%A4 + /// + /// 接口调用凭证 + /// 待查询小程序的 appid + /// + /// + public static IsTradeManagementConfirmationCompletedJsonResult IsTradeManagementConfirmationCompleted(string accessToken, string appid, int timeOut = Config.TIME_OUT) + { + var url = string.Format(Config.ApiMpHost + "/wxa/sec/order/is_trade_management_confirmation_completed?access_token={0}", accessToken.AsUrlData()); + var data = new + { + appid + }; + return CommonJsonSend.Send(null, url, data, CommonJsonSendType.POST, timeOut); + } #endregion #region 异步方法 @@ -312,8 +330,8 @@ public static async Task SetMsgJumpPathAsync(string accessToken, s /// 查询小程序是否已开通发货信息管理服务 /// https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/order-shipping/order-shipping.html#%E4%B8%83%E3%80%81%E6%9F%A5%E8%AF%A2%E5%B0%8F%E7%A8%8B%E5%BA%8F%E6%98%AF%E5%90%A6%E5%B7%B2%E5%BC%80%E9%80%9A%E5%8F%91%E8%B4%A7%E4%BF%A1%E6%81%AF%E7%AE%A1%E7%90%86%E6%9C%8D%E5%8A%A1 /// - /// - /// 商户自定义跳转路径。 + /// 接口调用凭证 + /// 待查询小程序的 appid /// /// public static async Task IsTradeManagedAsync(string accessToken, string appid, int timeOut = Config.TIME_OUT) @@ -325,6 +343,24 @@ public static async Task IsTradeManagedAsync(string ac }; return await CommonJsonSend.SendAsync(null, url, data, CommonJsonSendType.POST, timeOut); } + + /// + /// 查询小程序是否已完成交易结算管理确认 + /// https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/order-shipping/order-shipping.html#%E5%85%AB%E3%80%81%E6%9F%A5%E8%AF%A2%E5%B0%8F%E7%A8%8B%E5%BA%8F%E6%98%AF%E5%90%A6%E5%B7%B2%E5%AE%8C%E6%88%90%E4%BA%A4%E6%98%93%E7%BB%93%E7%AE%97%E7%AE%A1%E7%90%86%E7%A1%AE%E8%AE%A4 + /// + /// 接口调用凭证 + /// 待查询小程序的 appid + /// + /// + public static async Task IsTradeManagementConfirmationCompletedAsync(string accessToken, string appid, int timeOut = Config.TIME_OUT) + { + var url = string.Format(Config.ApiMpHost + "/wxa/sec/order/is_trade_management_confirmation_completed?access_token={0}", accessToken.AsUrlData()); + var data = new + { + appid + }; + return await CommonJsonSend.SendAsync(null, url, data, CommonJsonSendType.POST, timeOut); + } #endregion } } diff --git a/src/Senparc.Weixin.Open/Senparc.Weixin.Open/WxaAPIs/SecOrder/SecOrderJson/IsTradeManagementConfirmationCompletedJsonResult.cs b/src/Senparc.Weixin.Open/Senparc.Weixin.Open/WxaAPIs/SecOrder/SecOrderJson/IsTradeManagementConfirmationCompletedJsonResult.cs new file mode 100644 index 0000000000..89f25d8e51 --- /dev/null +++ b/src/Senparc.Weixin.Open/Senparc.Weixin.Open/WxaAPIs/SecOrder/SecOrderJson/IsTradeManagementConfirmationCompletedJsonResult.cs @@ -0,0 +1,12 @@ +using Senparc.Weixin.Entities; + +namespace Senparc.Weixin.Open.WxaAPIs.SecOrder +{ + /// + /// 查询小程序是否已完成交易结算管理确认 + /// + public class IsTradeManagementConfirmationCompletedJsonResult : WxJsonResult + { + public bool completed { get; set; } + } +}