🆕 #3455 【开放平台】增加小程序认证及备案相关接口

This commit is contained in:
Molzx 2024-12-21 14:02:43 +08:00 committed by Binary Wang
parent 29a76bcfae
commit 5ece315b87
9 changed files with 259 additions and 2 deletions

View File

@ -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;
}

View File

@ -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);
}
}

View File

@ -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 {

View File

@ -26,4 +26,9 @@ public class WxOpenIcpCreateIcpVerifyTaskResult extends WxOpenResult {
@SerializedName("task_id")
private String taskId;
/**
* 人脸核验任务urlalong_with_auth true 时返回
*/
@SerializedName("verify_url")
private String verifyUrl;
}

View File

@ -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;
}

View File

@ -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<WxOpenApplyIcpFilingResult.Hint> hints;
/**
* 驳回原因备案不通过时返回procedure_status 2325
*/
@SerializedName("audit_data")
private List<WxOpenIcpEntranceInfoResult.AuditData> auditData;
/**
* 管局短信核验状态仅当任务流程状态为 24备案管局审核中的时候才有效1等待核验中2核验完成3核验超时
*/
@SerializedName("sms_verify_status")
private Integer smsVerifyStatus;
}
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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已弃用未来将删除
*