mirror of
				https://gitee.com/binary/weixin-java-tools.git
				synced 2025-10-31 10:38:42 +08:00 
			
		
		
		
	🎨 #3250【开放平台】调整并完善小程序认证相关代码文档
This commit is contained in:
		| @ -11,8 +11,10 @@ import java.io.Serializable; | ||||
|  * | ||||
|  * @author penhuozhu | ||||
|  * @since 2024/01/07 | ||||
|  * @deprecated  应使用 WxOpenMaService.getAuthService() 的相关功能来处理小程序认证相关业务 | ||||
|  */ | ||||
| @Data | ||||
| @Deprecated | ||||
| public class WxMaUploadAuthMaterialResult implements Serializable { | ||||
|     private static final long serialVersionUID = 1L; | ||||
|  | ||||
|  | ||||
| @ -570,6 +570,10 @@ public class WxMpXmlMessage implements Serializable { | ||||
|   /////////////////////////////////////// | ||||
|   // 微信认证事件推送 | ||||
|   /////////////////////////////////////// | ||||
|   // event=wx_verify_pay_succ支付完成 | ||||
|   // event=wx_verify_dispatch分配审核提供商 | ||||
|   // event=wx_verify_refill拒绝需重新提交 | ||||
|   // event=wx_verify_fail拒绝(不可重新提交) | ||||
|   /** | ||||
|    * 资质认证成功/名称认证成功: 有效期 (整形),指的是时间戳,将于该时间戳认证过期. | ||||
|    * 年审通知: 有效期 (整形),指的是时间戳,将于该时间戳认证过期,需尽快年审 | ||||
| @ -591,6 +595,20 @@ public class WxMpXmlMessage implements Serializable { | ||||
|   @JacksonXmlProperty(localName = "FailReason") | ||||
|   private String failReason; | ||||
|  | ||||
|   /** | ||||
|    * 重新填写时间戳(秒数) | ||||
|    */ | ||||
|   @XStreamAlias("RefillTime") | ||||
|   @JacksonXmlProperty(localName = "RefillTime") | ||||
|   private Long refillTime; | ||||
|  | ||||
|   /** | ||||
|    * 重新填写原因 | ||||
|    */ | ||||
|   @XStreamAlias("RefillReason") | ||||
|   @JacksonXmlProperty(localName = "RefillReason") | ||||
|   private String refillReason; | ||||
|  | ||||
|   /////////////////////////////////////// | ||||
|   // 微信小店 6.1订单付款通知 | ||||
|   /////////////////////////////////////// | ||||
|  | ||||
| @ -783,8 +783,10 @@ public interface WxOpenMaService extends WxMaService { | ||||
|   /** | ||||
|    * 小程序认证上传补充材料 | ||||
|    * | ||||
|    * @return | ||||
|    * @return 结果 | ||||
|    * @see #getAuthService() 应使用此处方法处理小程序认证相关业务 | ||||
|    */ | ||||
|   @Deprecated | ||||
|   WxMaUploadAuthMaterialResult uploadAuthMaterial(File file) throws WxErrorException; | ||||
|  | ||||
| } | ||||
|  | ||||
| @ -5,6 +5,7 @@ import lombok.Getter; | ||||
| import lombok.Setter; | ||||
| import me.chanjar.weixin.open.bean.result.WxOpenResult; | ||||
| import org.jetbrains.annotations.NotNull; | ||||
| import org.jetbrains.annotations.Nullable; | ||||
|  | ||||
| /** | ||||
|  * 小程序认证 查询操作 响应 | ||||
| @ -40,25 +41,36 @@ public class MaAuthQueryResult extends WxOpenResult { | ||||
|   /** | ||||
|    * 审核单状态,创建审核单成功后有效 0审核单不存在 1待支付 2审核中 3打回重填 4认证通过 5认证最终失败(不能再修改) | ||||
|    */ | ||||
|   @Nullable | ||||
|   @SerializedName("apply_status") | ||||
|   private Integer applyStatus; | ||||
|  | ||||
|   /** | ||||
|    * 小程序后台展示的认证订单号 | ||||
|    */ | ||||
|   @Nullable | ||||
|   @SerializedName("orderid") | ||||
|   private String orderId; | ||||
|  | ||||
|   /** | ||||
|    * 当审核单被打回重填(apply_status=3)时有效 | ||||
|    */ | ||||
|   @Nullable | ||||
|   @SerializedName("refill_reason") | ||||
|   private String refillReason; | ||||
|  | ||||
|   /** | ||||
|    * 审核最终失败的原因(apply_status=5)时有效 | ||||
|    */ | ||||
|   @Nullable | ||||
|   @SerializedName("fail_reason") | ||||
|   private String failReason; | ||||
|  | ||||
|   /** | ||||
|    * 审核提供商分配信息 | ||||
|    */ | ||||
|   @Nullable | ||||
|   @SerializedName("dispatch_info") | ||||
|   private MaAuthQueryResultDispatchInfo dispatchInfo; | ||||
|  | ||||
| } | ||||
|  | ||||
| @ -6,7 +6,7 @@ import lombok.NoArgsConstructor; | ||||
| import org.jetbrains.annotations.NotNull; | ||||
|  | ||||
| /** | ||||
|  * 小程序认证 查询操作 响应数据 | ||||
|  * 小程序认证 查询操作 响应数据 - 审核提供商分配信息 | ||||
|  * | ||||
|  * @author <a href="https://www.sacoc.cn">广州跨界</a> | ||||
|  * created on 2024/01/11 | ||||
| @ -32,5 +32,5 @@ public class MaAuthQueryResultDispatchInfo { | ||||
|    */ | ||||
|   @NotNull | ||||
|   @SerializedName("dispatch_time") | ||||
|   private Integer dispatchTime; | ||||
|   private Long dispatchTime; | ||||
| } | ||||
|  | ||||
| @ -1,7 +1,9 @@ | ||||
| package me.chanjar.weixin.open.bean.auth; | ||||
|  | ||||
| import com.google.gson.annotations.SerializedName; | ||||
| import lombok.AllArgsConstructor; | ||||
| import lombok.Data; | ||||
| import lombok.NoArgsConstructor; | ||||
| import org.jetbrains.annotations.NotNull; | ||||
|  | ||||
| /** | ||||
| @ -11,6 +13,8 @@ import org.jetbrains.annotations.NotNull; | ||||
|  * created on 2024/01/11 | ||||
|  */ | ||||
| @Data | ||||
| @NoArgsConstructor | ||||
| @AllArgsConstructor | ||||
| public class MaAuthResubmitParam { | ||||
|  | ||||
|   /** | ||||
|  | ||||
| @ -1,6 +1,7 @@ | ||||
| package me.chanjar.weixin.open.bean.auth; | ||||
|  | ||||
| import com.google.gson.annotations.SerializedName; | ||||
| import lombok.AllArgsConstructor; | ||||
| import lombok.Data; | ||||
| import lombok.NoArgsConstructor; | ||||
| import org.jetbrains.annotations.NotNull; | ||||
| @ -13,13 +14,11 @@ import org.jetbrains.annotations.NotNull; | ||||
|  */ | ||||
| @Data | ||||
| @NoArgsConstructor | ||||
| @AllArgsConstructor | ||||
| public class MaAuthSubmitParam { | ||||
|  | ||||
|   /** | ||||
|    * 认证信息 | ||||
|    * | ||||
|    * @author <a href="https://www.sacoc.cn">广州跨界</a> | ||||
|    * created on 2024/01/11 | ||||
|    */ | ||||
|   @NotNull | ||||
|   @SerializedName("auth_data") | ||||
|  | ||||
| @ -23,7 +23,7 @@ public class MaAuthSubmitParamAuthData { | ||||
|    */ | ||||
|   @NotNull | ||||
|   @SerializedName("customer_type") | ||||
|   private String customerType; | ||||
|   private Integer customerType; | ||||
|  | ||||
|   /** | ||||
|    * 联系人信息 | ||||
| @ -33,7 +33,7 @@ public class MaAuthSubmitParamAuthData { | ||||
|   private MaAuthSubmitParamContactInfo contactInfo; | ||||
|  | ||||
|   /** | ||||
|    * 发票信息,如果是服务商代缴模式,不需要改参数 | ||||
|    * 发票信息,实测即使是服务商(第三方平台)代缴,也需要提供此参数,否则报错。官方文档为:如果是服务商代缴模式,不需要改参数 | ||||
|    */ | ||||
|   @Nullable | ||||
|   @SerializedName("invoice_info") | ||||
| @ -78,7 +78,7 @@ public class MaAuthSubmitParamAuthData { | ||||
|    */ | ||||
|   @NotNull | ||||
|   @SerializedName("pay_type") | ||||
|   private String payType; | ||||
|   private Integer payType; | ||||
|  | ||||
|   /** | ||||
|    * 认证类型为个人类型时可以选择要认证的身份,从/wxa/sec/authidentitytree 里获取,填叶节点的name | ||||
| @ -106,5 +106,5 @@ public class MaAuthSubmitParamAuthData { | ||||
|    */ | ||||
|   @Nullable | ||||
|   @SerializedName("service_appid") | ||||
|   private String serviceAppid; | ||||
|   private String serviceAppId; | ||||
| } | ||||
|  | ||||
| @ -17,7 +17,7 @@ import org.springframework.lang.Nullable; | ||||
| public class MaAuthSubmitParamInvoiceInfo { | ||||
|  | ||||
|   /** | ||||
|    * 发票类型 1: 不开发票 2: 电子发票 3: 增值税专票 | ||||
|    * 发票类型 1不开发票 2电子发票 3增值税专票,服务商代缴时只能为1,即不开发票 | ||||
|    */ | ||||
|   @NotNull | ||||
|   @SerializedName("invoice_type") | ||||
|  | ||||
| @ -27,6 +27,9 @@ import java.nio.charset.StandardCharsets; | ||||
| public class WxOpenXmlMessage implements Serializable { | ||||
|   private static final long serialVersionUID = -5641769554709507771L; | ||||
|  | ||||
|   /** | ||||
|    * 第三方平台的APPID | ||||
|    */ | ||||
|   @XStreamAlias("AppId") | ||||
|   @XStreamConverter(value = XStreamCDataConverter.class) | ||||
|   private String appId; | ||||
| @ -57,10 +60,13 @@ public class WxOpenXmlMessage implements Serializable { | ||||
|   @XStreamConverter(value = XStreamCDataConverter.class) | ||||
|   private String preAuthCode; | ||||
|  | ||||
|   // 以下为快速创建小程序接口推送的的信息 | ||||
|  | ||||
|   /** | ||||
|    * 子平台APPID(公众号/小程序的APPID) 快速创建小程序、小程序认证中 | ||||
|    */ | ||||
|   @XStreamAlias("appid") | ||||
|   private String registAppId; | ||||
|   private String subAppId; | ||||
|  | ||||
|   // 以下为快速创建小程序接口推送的的信息 | ||||
|  | ||||
|   @XStreamAlias("status") | ||||
|   private int status; | ||||
| @ -75,6 +81,70 @@ public class WxOpenXmlMessage implements Serializable { | ||||
|   @XStreamAlias("info") | ||||
|   private Info info = new Info(); | ||||
|  | ||||
|   // 以下为小程序认证(年审)申请审核流程 推送的消息 infoType=notify_3rd_wxa_auth | ||||
|   /** | ||||
|    * 任务ID | ||||
|    */ | ||||
|   @XStreamAlias("taskid") | ||||
|   @XStreamConverter(value = XStreamCDataConverter.class) | ||||
|   private String taskId; | ||||
|  | ||||
|   /** | ||||
|    * 认证任务状态 0初始 1超24小时 2用户拒绝 3用户同意 4发起人脸 5人脸失败 6人脸ok 7人脸认证后手机验证码 8手机验证失败 9手机验证成功 11创建审核单失败 12创建审核单成功 14验证失败 15等待支付 | ||||
|    */ | ||||
|   @XStreamAlias("task_status") | ||||
|   private Integer taskStatus; | ||||
|  | ||||
|   /** | ||||
|    * 审核单状态,创建审核单成功后有效 0审核单不存在 1待支付 2审核中 3打回重填 4认证通过 5认证最终失败(不能再修改) | ||||
|    */ | ||||
|   @XStreamAlias("apply_status") | ||||
|   private Integer applyStatus; | ||||
|  | ||||
|   /** | ||||
|    * 审核消息或失败原因 | ||||
|    */ | ||||
|   @XStreamAlias("message") | ||||
|   @XStreamConverter(value = XStreamCDataConverter.class) | ||||
|   private String message; | ||||
|  | ||||
|  | ||||
|   /** | ||||
|    * 审核提供商分配信息 | ||||
|    */ | ||||
|   @XStreamAlias("dispatch_info") | ||||
|   private DispatchInfo dispatchInfo; | ||||
|  | ||||
|  | ||||
|   // 以下为小程序认证(年审)即将到期通知(过期当天&过期30天&过期60) infoType=notify_3rd_wxa_wxverify,并会附带message | ||||
|   /** | ||||
|    * 过期时间戳(秒数) | ||||
|    */ | ||||
|   @XStreamAlias("expired") | ||||
|   private Long expired; | ||||
|  | ||||
|  | ||||
|   /** | ||||
|    * 快速创建的小程序appId,已弃用,未来将删除 | ||||
|    * | ||||
|    * @see #getSubAppId() 应使用此方法 | ||||
|    */ | ||||
|   @Deprecated | ||||
|   public String getRegistAppId() { | ||||
|     return subAppId; | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|    * 快速创建的小程序appId,已弃用,未来将删除 | ||||
|    * | ||||
|    * @see #setSubAppId(String) 应使用此方法 | ||||
|    */ | ||||
|   @Deprecated | ||||
|   public void setRegistAppId(String value) { | ||||
|     subAppId = value; | ||||
|   } | ||||
|  | ||||
|  | ||||
|   @XStreamAlias("info") | ||||
|   @Data | ||||
|   public static class Info implements Serializable { | ||||
| @ -119,6 +189,33 @@ public class WxOpenXmlMessage implements Serializable { | ||||
|  | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|    * 审核提供商分配信息 | ||||
|    */ | ||||
|   @Data | ||||
|   public static class DispatchInfo { | ||||
|  | ||||
|     /** | ||||
|      * 提供商,如:上海倍通企业信用征信有限公司 | ||||
|      */ | ||||
|     @XStreamConverter(value = XStreamCDataConverter.class) | ||||
|     @XStreamAlias("provider") | ||||
|     private String provider; | ||||
|  | ||||
|     /** | ||||
|      * 联系方式,如:咨询电话:0411-84947888,咨询时间:周一至周五(工作日)8:30-17:30 | ||||
|      */ | ||||
|     @XStreamConverter(value = XStreamCDataConverter.class) | ||||
|     @XStreamAlias("contact") | ||||
|     private String contact; | ||||
|  | ||||
|     /** | ||||
|      * 派遣时间戳(秒),如:1704952913 | ||||
|      */ | ||||
|     @XStreamAlias("dispatch_time") | ||||
|     private Long dispatchTime; | ||||
|   } | ||||
|  | ||||
|   public static String wxMpOutXmlMessageToEncryptedXml(WxMpXmlOutMessage message, WxOpenConfigStorage wxOpenConfigStorage) { | ||||
|     String plainXml = message.toXml(); | ||||
|     WxOpenCryptUtil pc = new WxOpenCryptUtil(wxOpenConfigStorage); | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 天朝红雨
					天朝红雨