From 5ece315b87619aa58762560868a16121737bd387 Mon Sep 17 00:00:00 2001 From: Molzx <31435895+Molzx@users.noreply.github.com> Date: Sat, 21 Dec 2024 14:02:43 +0800 Subject: [PATCH] =?UTF-8?q?:new:=20#3455=20=E3=80=90=E5=BC=80=E6=94=BE?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E3=80=91=E5=A2=9E=E5=8A=A0=E5=B0=8F=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=E8=AE=A4=E8=AF=81=E5=8F=8A=E5=A4=87=E6=A1=88=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../weixin/open/api/WxOpenMaIcpService.java | 40 +++++++++ .../open/api/impl/WxOpenMaIcpServiceImpl.java | 44 +++++++++- .../bean/icp/WxOpenApplyIcpFilingParam.java | 3 +- .../WxOpenIcpCreateIcpVerifyTaskResult.java | 5 ++ .../bean/icp/WxOpenIcpVerifyTaskResult.java | 6 ++ .../bean/icp/WxOpenQueryAuthAndIcpResult.java | 85 +++++++++++++++++++ .../bean/icp/WxOpenSubmitAuthAndIcpParam.java | 29 +++++++ .../icp/WxOpenSubmitAuthAndIcpResult.java | 30 +++++++ .../open/bean/message/WxOpenXmlMessage.java | 19 +++++ 9 files changed, 259 insertions(+), 2 deletions(-) create mode 100644 weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenQueryAuthAndIcpResult.java create mode 100644 weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenSubmitAuthAndIcpParam.java create mode 100644 weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenSubmitAuthAndIcpResult.java diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaIcpService.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaIcpService.java index ad59b246c..9b936b157 100644 --- a/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaIcpService.java +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaIcpService.java @@ -97,6 +97,19 @@ public interface WxOpenMaIcpService { */ String GET_ICP_MEDIA = "https://api.weixin.qq.com/wxa/icp/get_icp_media"; + /** + * 申请小程序认证及备案 + * https://developers.weixin.qq.com/doc/oplatform/openApi/OpenApiDoc/miniprogram-management/wxverifyicp/submitAuthAndIcp.html + */ + String SUBMIT_AUTH_AND_ICP = "https://api.weixin.qq.com/wxa/sec/submit_auth_and_icp"; + + /** + * 查询小程序认证及备案进度 + * https://developers.weixin.qq.com/doc/oplatform/openApi/OpenApiDoc/miniprogram-management/wxverifyicp/queryAuthAndIcp.html + */ + String QUERY_AUTH_AND_ICP = "https://api.weixin.qq.com/wxa/sec/query_auth_and_icp"; + + /** * 查询人脸核身任务状态 * @@ -114,6 +127,15 @@ public interface WxOpenMaIcpService { */ WxOpenIcpCreateIcpVerifyTaskResult createIcpVerifyTask() throws WxErrorException; + /** + * 发起小程序管理员人脸核身 + * + * @param alongWithAuth 小程序认证及备案二合一场景,填 true,否则为小程序备案场景。默认值为 false。 + * @return 人脸核验任务结果 + * @throws WxErrorException e + */ + WxOpenIcpCreateIcpVerifyTaskResult createIcpVerifyTask(boolean alongWithAuth) throws WxErrorException; + /** * 上传小程序备案媒体材料 * @@ -204,4 +226,22 @@ public interface WxOpenMaIcpService { * @throws WxErrorException e */ File getIcpMedia(String mediaId) throws WxErrorException; + + /** + * 申请小程序认证及备案 + * + * @param param 参数 + * @return r + * @throws WxErrorException e + */ + WxOpenSubmitAuthAndIcpResult submitAuthAndIcp(WxOpenSubmitAuthAndIcpParam param) throws WxErrorException; + + /** + * 查询小程序认证及备案进度 + * @param procedureId 小程序认证及备案任务流程id + * @return r + * @throws WxErrorException e + */ + WxOpenQueryAuthAndIcpResult queryAuthAndIcp(String procedureId) throws WxErrorException; + } diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenMaIcpServiceImpl.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenMaIcpServiceImpl.java index dc78f22fe..db9654f28 100644 --- a/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenMaIcpServiceImpl.java +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenMaIcpServiceImpl.java @@ -54,7 +54,21 @@ public class WxOpenMaIcpServiceImpl implements WxOpenMaIcpService { */ @Override public WxOpenIcpCreateIcpVerifyTaskResult createIcpVerifyTask() throws WxErrorException { - String response = wxMaService.post(CREATE_ICP_VERIFY_TASK, ""); + return createIcpVerifyTask(false); + } + + /** + * 发起小程序管理员人脸核身 + * + * @param alongWithAuth 小程序认证及备案二合一场景,填 true,否则为小程序备案场景。默认值为 false。 + * @return 人脸核验任务结果 + * @throws WxErrorException e + */ + @Override + public WxOpenIcpCreateIcpVerifyTaskResult createIcpVerifyTask(boolean alongWithAuth) throws WxErrorException { + JsonObject params = new JsonObject(); + params.addProperty("along_with_auth", alongWithAuth); + String response = wxMaService.post(CREATE_ICP_VERIFY_TASK, params); return WxMaGsonBuilder.create().fromJson(response, WxOpenIcpCreateIcpVerifyTaskResult.class); } @@ -212,4 +226,32 @@ public class WxOpenMaIcpServiceImpl implements WxOpenMaIcpService { throw new WxErrorException(WxError.builder().errorMsg(e.getMessage()).build(), e); } } + + /** + * 申请小程序认证及备案 + * + * @param param 参数 + * @return r + * @throws WxErrorException e + */ + @Override + public WxOpenSubmitAuthAndIcpResult submitAuthAndIcp(WxOpenSubmitAuthAndIcpParam param) throws WxErrorException { + String response = wxMaService.post(SUBMIT_AUTH_AND_ICP, param); + return WxMaGsonBuilder.create().fromJson(response, WxOpenSubmitAuthAndIcpResult.class); + } + + /** + * 查询小程序认证及备案进度 + * + * @param procedureId 小程序认证及备案任务流程id + * @return r + * @throws WxErrorException e + */ + @Override + public WxOpenQueryAuthAndIcpResult queryAuthAndIcp(String procedureId) throws WxErrorException { + JsonObject params = new JsonObject(); + params.addProperty("procedure_id", procedureId); + String response = wxMaService.post(QUERY_AUTH_AND_ICP, params); + return WxOpenGsonBuilder.create().fromJson(response, WxOpenQueryAuthAndIcpResult.class); + } } diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenApplyIcpFilingParam.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenApplyIcpFilingParam.java index 37f84cf3d..ef24a5360 100644 --- a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenApplyIcpFilingParam.java +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenApplyIcpFilingParam.java @@ -2,6 +2,7 @@ package me.chanjar.weixin.open.bean.icp; import com.google.gson.annotations.SerializedName; import lombok.*; +import lombok.experimental.SuperBuilder; import java.io.Serializable; import java.util.List; @@ -12,7 +13,7 @@ import java.util.List; * @createTime 2024/08/14 15:09 */ @Data -@Builder +@SuperBuilder @NoArgsConstructor @AllArgsConstructor public class WxOpenApplyIcpFilingParam implements Serializable { diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenIcpCreateIcpVerifyTaskResult.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenIcpCreateIcpVerifyTaskResult.java index 8deb40133..967e81fa9 100644 --- a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenIcpCreateIcpVerifyTaskResult.java +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenIcpCreateIcpVerifyTaskResult.java @@ -26,4 +26,9 @@ public class WxOpenIcpCreateIcpVerifyTaskResult extends WxOpenResult { @SerializedName("task_id") private String taskId; + /** + * 人脸核验任务url,along_with_auth 填 true 时返回。 + */ + @SerializedName("verify_url") + private String verifyUrl; } diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenIcpVerifyTaskResult.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenIcpVerifyTaskResult.java index cb59fac1c..5290748b2 100644 --- a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenIcpVerifyTaskResult.java +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenIcpVerifyTaskResult.java @@ -30,4 +30,10 @@ public class WxOpenIcpVerifyTaskResult extends WxOpenResult { */ @SerializedName("face_status") private Integer faceStatus; + + /** + * 发起时 along_with_auth 填 true 时有效:9. 认证短信核验通过。 + */ + @SerializedName("along_with_auth_result") + private Integer alongWithAuthResult; } diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenQueryAuthAndIcpResult.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenQueryAuthAndIcpResult.java new file mode 100644 index 000000000..42a996d9b --- /dev/null +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenQueryAuthAndIcpResult.java @@ -0,0 +1,85 @@ +package me.chanjar.weixin.open.bean.icp; + +import com.google.gson.annotations.SerializedName; +import lombok.*; +import me.chanjar.weixin.open.bean.result.WxOpenResult; + +import java.util.List; + +/** + * @author xzh + * @Description + * @createTime 2024/12/19 16:56 + */ +@Getter +@Setter +@NoArgsConstructor +public class WxOpenQueryAuthAndIcpResult extends WxOpenResult { + private static final long serialVersionUID = 1626895037788760364L; + + + /** + * 当前任务流程状态,见下方任务流程状态枚举 + * 值 含义 + * 15 等待支付认证审核费用 + * 16 认证审核费用支付成功 + * 17 认证审核中 + * 18 认证审核驳回 + * 19 认证审核通过 + * 20 认证审核最终失败(不能再修改) + * 21 创建备案审核单失败 + * 22 备案平台审核中 + * 23 备案平台审核驳回 + * 24 备案管局审核中 + * 25 管局审核驳回 + * 26 认证及备案完成 + */ + @SerializedName("procedure_status") + private Integer procedureStatus; + + /** + * 小程序后台展示的认证订单号 + */ + @SerializedName("orderid") + private Long orderId; + + /** + * 小程序认证审核单被驳回(procedure_status 为 18)时有效 + */ + @SerializedName("refill_reason") + private String refillReason; + /** + * 小程序认证审核最终失败的原因(procedure_status 为 20)时有效 + */ + @SerializedName("fail_reason") + private String failReason; + + /** + * 小程序备案相关信息 + */ + @SerializedName("icp_audit") + private IcpAudit icpAudit; + + @Data + public static class IcpAudit { + + /** + * 错误提示,创建备案审核单失败时返回(procedure_status 为 21) + */ + @SerializedName("hints") + private List hints; + + /** + * 驳回原因,备案不通过时返回(procedure_status 为 23、25) + */ + @SerializedName("audit_data") + private List auditData; + + /** + * 管局短信核验状态,仅当任务流程状态为 24(备案管局审核中)的时候才有效。1:等待核验中,2:核验完成,3:核验超时。 + */ + @SerializedName("sms_verify_status") + private Integer smsVerifyStatus; + } + +} diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenSubmitAuthAndIcpParam.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenSubmitAuthAndIcpParam.java new file mode 100644 index 000000000..31d4f158f --- /dev/null +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenSubmitAuthAndIcpParam.java @@ -0,0 +1,29 @@ +package me.chanjar.weixin.open.bean.icp; + +import com.google.gson.annotations.SerializedName; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; +import me.chanjar.weixin.open.bean.auth.MaAuthSubmitParamAuthData; +import org.jetbrains.annotations.NotNull; + +/** + * @author xzh + * @Description + * @createTime 2024/12/19 16:42 + */ +@Data +@SuperBuilder +@NoArgsConstructor +@AllArgsConstructor +public class WxOpenSubmitAuthAndIcpParam extends WxOpenApplyIcpFilingParam { + private static final long serialVersionUID = -1302523168779484802L; + + /** + * 认证信息 + */ + @NotNull + @SerializedName("auth_data") + private MaAuthSubmitParamAuthData authData; +} diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenSubmitAuthAndIcpResult.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenSubmitAuthAndIcpResult.java new file mode 100644 index 000000000..53f04412f --- /dev/null +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/icp/WxOpenSubmitAuthAndIcpResult.java @@ -0,0 +1,30 @@ +package me.chanjar.weixin.open.bean.icp; + +import com.google.gson.annotations.SerializedName; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +/** + * @author xzh + * @Description + * @createTime 2024/12/19 16:47 + */ +@Getter +@Setter +@NoArgsConstructor +public class WxOpenSubmitAuthAndIcpResult extends WxOpenApplyIcpFilingResult { + private static final long serialVersionUID = 2338143380820535842L; + + /** + * 小程序认证及备案任务流程 id + */ + @SerializedName("procedure_id") + private String procedureId; + + /** + * 小程序认证认证审核费用付费链接,当 pay_type 为 2 时返回 + */ + @SerializedName("pay_url") + private String payUrl; +} diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/message/WxOpenXmlMessage.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/message/WxOpenXmlMessage.java index dc6839c1a..df782e6a0 100644 --- a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/message/WxOpenXmlMessage.java +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/message/WxOpenXmlMessage.java @@ -140,6 +140,11 @@ public class WxOpenXmlMessage implements Serializable { */ @XStreamAlias("result") private Integer result; + /** + * 发起时 along_with_auth 填 true 时有效:9. 认证短信核验通过。 + */ + @XStreamAlias("along_with_auth_result") + private Integer alongWithAuthResult; //endregion //region 当备案审核被驳回或通过时会推送该事件 推送的消息 infoType=notify_apply_icpfiling_result @@ -155,6 +160,20 @@ public class WxOpenXmlMessage implements Serializable { private Integer beianStatus; //endregion + //region 认证及备案流程的主要节点均有事件推送到第三方平台的授权事件接收接口,包括支付完成、派单给审核机构、审核打回、审核通过、审核失败等。消息类型,固定为 notify_3rd_wxa_auth_and_icp + + /** + * 小程序认证及备案任务流程 id + */ + @XStreamAlias("procedure_id") + private String procedureId; + /** + * 当前任务流程状态,见“小程序认证及备案进度查询” API 文档中的任务流程状态枚举 + */ + @XStreamAlias("procedure_status") + private Integer procedureStatus; + //endregion + /** * 快速创建的小程序appId,已弃用,未来将删除 *