Skip to content

Commit 47c55ef

Browse files
🎨 binarywang#3250【开放平台】调整并完善小程序认证相关代码文档
1 parent ddddffc commit 47c55ef

File tree

10 files changed

+148
-14
lines changed

10 files changed

+148
-14
lines changed

weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/WxMaUploadAuthMaterialResult.java

+2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
*
1212
* @author penhuozhu
1313
* @since 2024/01/07
14+
* @deprecated 应使用 WxOpenMaService.getAuthService() 的相关功能来处理小程序认证相关业务
1415
*/
1516
@Data
17+
@Deprecated
1618
public class WxMaUploadAuthMaterialResult implements Serializable {
1719
private static final long serialVersionUID = 1L;
1820

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/message/WxMpXmlMessage.java

+18
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,10 @@ public class WxMpXmlMessage implements Serializable {
570570
///////////////////////////////////////
571571
// 微信认证事件推送
572572
///////////////////////////////////////
573+
// event=wx_verify_pay_succ支付完成
574+
// event=wx_verify_dispatch分配审核提供商
575+
// event=wx_verify_refill拒绝需重新提交
576+
// event=wx_verify_fail拒绝(不可重新提交)
573577
/**
574578
* 资质认证成功/名称认证成功: 有效期 (整形),指的是时间戳,将于该时间戳认证过期.
575579
* 年审通知: 有效期 (整形),指的是时间戳,将于该时间戳认证过期,需尽快年审
@@ -591,6 +595,20 @@ public class WxMpXmlMessage implements Serializable {
591595
@JacksonXmlProperty(localName = "FailReason")
592596
private String failReason;
593597

598+
/**
599+
* 重新填写时间戳(秒数)
600+
*/
601+
@XStreamAlias("RefillTime")
602+
@JacksonXmlProperty(localName = "RefillTime")
603+
private Long refillTime;
604+
605+
/**
606+
* 重新填写原因
607+
*/
608+
@XStreamAlias("RefillReason")
609+
@JacksonXmlProperty(localName = "RefillReason")
610+
private String refillReason;
611+
594612
///////////////////////////////////////
595613
// 微信小店 6.1订单付款通知
596614
///////////////////////////////////////

weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaService.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -783,8 +783,10 @@ WxOpenMaDomainResult modifyDomain(String action, List<String> requestDomains, Li
783783
/**
784784
* 小程序认证上传补充材料
785785
*
786-
* @return
786+
* @return 结果
787+
* @see #getAuthService() 应使用此处方法处理小程序认证相关业务
787788
*/
789+
@Deprecated
788790
WxMaUploadAuthMaterialResult uploadAuthMaterial(File file) throws WxErrorException;
789791

790792
}

weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/auth/MaAuthQueryResult.java

+12
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import lombok.Setter;
66
import me.chanjar.weixin.open.bean.result.WxOpenResult;
77
import org.jetbrains.annotations.NotNull;
8+
import org.jetbrains.annotations.Nullable;
89

910
/**
1011
* 小程序认证 查询操作 响应
@@ -40,25 +41,36 @@ public class MaAuthQueryResult extends WxOpenResult {
4041
/**
4142
* 审核单状态,创建审核单成功后有效 0审核单不存在 1待支付 2审核中 3打回重填 4认证通过 5认证最终失败(不能再修改)
4243
*/
44+
@Nullable
4345
@SerializedName("apply_status")
4446
private Integer applyStatus;
4547

4648
/**
4749
* 小程序后台展示的认证订单号
4850
*/
51+
@Nullable
4952
@SerializedName("orderid")
5053
private String orderId;
5154

5255
/**
5356
* 当审核单被打回重填(apply_status=3)时有效
5457
*/
58+
@Nullable
5559
@SerializedName("refill_reason")
5660
private String refillReason;
5761

5862
/**
5963
* 审核最终失败的原因(apply_status=5)时有效
6064
*/
65+
@Nullable
6166
@SerializedName("fail_reason")
6267
private String failReason;
6368

69+
/**
70+
* 审核提供商分配信息
71+
*/
72+
@Nullable
73+
@SerializedName("dispatch_info")
74+
private MaAuthQueryResultDispatchInfo dispatchInfo;
75+
6476
}

weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/auth/MaAuthQueryResultDispatchInfo.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import org.jetbrains.annotations.NotNull;
77

88
/**
9-
* 小程序认证 查询操作 响应数据
9+
* 小程序认证 查询操作 响应数据 - 审核提供商分配信息
1010
*
1111
* @author <a href="https://www.sacoc.cn">广州跨界</a>
1212
* created on 2024/01/11
@@ -32,5 +32,5 @@ public class MaAuthQueryResultDispatchInfo {
3232
*/
3333
@NotNull
3434
@SerializedName("dispatch_time")
35-
private Integer dispatchTime;
35+
private Long dispatchTime;
3636
}

weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/auth/MaAuthResubmitParam.java

+4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package me.chanjar.weixin.open.bean.auth;
22

33
import com.google.gson.annotations.SerializedName;
4+
import lombok.AllArgsConstructor;
45
import lombok.Data;
6+
import lombok.NoArgsConstructor;
57
import org.jetbrains.annotations.NotNull;
68

79
/**
@@ -11,6 +13,8 @@
1113
* created on 2024/01/11
1214
*/
1315
@Data
16+
@NoArgsConstructor
17+
@AllArgsConstructor
1418
public class MaAuthResubmitParam {
1519

1620
/**

weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/auth/MaAuthSubmitParam.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package me.chanjar.weixin.open.bean.auth;
22

33
import com.google.gson.annotations.SerializedName;
4+
import lombok.AllArgsConstructor;
45
import lombok.Data;
56
import lombok.NoArgsConstructor;
67
import org.jetbrains.annotations.NotNull;
@@ -13,13 +14,11 @@
1314
*/
1415
@Data
1516
@NoArgsConstructor
17+
@AllArgsConstructor
1618
public class MaAuthSubmitParam {
1719

1820
/**
1921
* 认证信息
20-
*
21-
* @author <a href="https://www.sacoc.cn">广州跨界</a>
22-
* created on 2024/01/11
2322
*/
2423
@NotNull
2524
@SerializedName("auth_data")

weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/auth/MaAuthSubmitParamAuthData.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public class MaAuthSubmitParamAuthData {
2323
*/
2424
@NotNull
2525
@SerializedName("customer_type")
26-
private String customerType;
26+
private Integer customerType;
2727

2828
/**
2929
* 联系人信息
@@ -33,7 +33,7 @@ public class MaAuthSubmitParamAuthData {
3333
private MaAuthSubmitParamContactInfo contactInfo;
3434

3535
/**
36-
* 发票信息,如果是服务商代缴模式,不需要改参数
36+
* 发票信息,实测即使是服务商(第三方平台)代缴,也需要提供此参数,否则报错。官方文档为:如果是服务商代缴模式,不需要改参数
3737
*/
3838
@Nullable
3939
@SerializedName("invoice_info")
@@ -78,7 +78,7 @@ public class MaAuthSubmitParamAuthData {
7878
*/
7979
@NotNull
8080
@SerializedName("pay_type")
81-
private String payType;
81+
private Integer payType;
8282

8383
/**
8484
* 认证类型为个人类型时可以选择要认证的身份,从/wxa/sec/authidentitytree 里获取,填叶节点的name
@@ -106,5 +106,5 @@ public class MaAuthSubmitParamAuthData {
106106
*/
107107
@Nullable
108108
@SerializedName("service_appid")
109-
private String serviceAppid;
109+
private String serviceAppId;
110110
}

weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/auth/MaAuthSubmitParamInvoiceInfo.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
public class MaAuthSubmitParamInvoiceInfo {
1818

1919
/**
20-
* 发票类型 1: 不开发票 2: 电子发票 3: 增值税专票
20+
* 发票类型 1不开发票 2电子发票 3增值税专票,服务商代缴时只能为1,即不开发票
2121
*/
2222
@NotNull
2323
@SerializedName("invoice_type")

weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/message/WxOpenXmlMessage.java

+100-3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
public class WxOpenXmlMessage implements Serializable {
2828
private static final long serialVersionUID = -5641769554709507771L;
2929

30+
/**
31+
* 第三方平台的APPID
32+
*/
3033
@XStreamAlias("AppId")
3134
@XStreamConverter(value = XStreamCDataConverter.class)
3235
private String appId;
@@ -57,10 +60,13 @@ public class WxOpenXmlMessage implements Serializable {
5760
@XStreamConverter(value = XStreamCDataConverter.class)
5861
private String preAuthCode;
5962

60-
// 以下为快速创建小程序接口推送的的信息
61-
63+
/**
64+
* 子平台APPID(公众号/小程序的APPID) 快速创建小程序、小程序认证中
65+
*/
6266
@XStreamAlias("appid")
63-
private String registAppId;
67+
private String subAppId;
68+
69+
// 以下为快速创建小程序接口推送的的信息
6470

6571
@XStreamAlias("status")
6672
private int status;
@@ -75,6 +81,70 @@ public class WxOpenXmlMessage implements Serializable {
7581
@XStreamAlias("info")
7682
private Info info = new Info();
7783

84+
// 以下为小程序认证(年审)申请审核流程 推送的消息 infoType=notify_3rd_wxa_auth
85+
/**
86+
* 任务ID
87+
*/
88+
@XStreamAlias("taskid")
89+
@XStreamConverter(value = XStreamCDataConverter.class)
90+
private String taskId;
91+
92+
/**
93+
* 认证任务状态 0初始 1超24小时 2用户拒绝 3用户同意 4发起人脸 5人脸失败 6人脸ok 7人脸认证后手机验证码 8手机验证失败 9手机验证成功 11创建审核单失败 12创建审核单成功 14验证失败 15等待支付
94+
*/
95+
@XStreamAlias("task_status")
96+
private Integer taskStatus;
97+
98+
/**
99+
* 审核单状态,创建审核单成功后有效 0审核单不存在 1待支付 2审核中 3打回重填 4认证通过 5认证最终失败(不能再修改)
100+
*/
101+
@XStreamAlias("apply_status")
102+
private Integer applyStatus;
103+
104+
/**
105+
* 审核消息或失败原因
106+
*/
107+
@XStreamAlias("message")
108+
@XStreamConverter(value = XStreamCDataConverter.class)
109+
private String message;
110+
111+
112+
/**
113+
* 审核提供商分配信息
114+
*/
115+
@XStreamAlias("dispatch_info")
116+
private DispatchInfo dispatchInfo;
117+
118+
119+
// 以下为小程序认证(年审)即将到期通知(过期当天&过期30天&过期60) infoType=notify_3rd_wxa_wxverify,并会附带message
120+
/**
121+
* 过期时间戳(秒数)
122+
*/
123+
@XStreamAlias("expired")
124+
private Long expired;
125+
126+
127+
/**
128+
* 快速创建的小程序appId,已弃用,未来将删除
129+
*
130+
* @see #getSubAppId() 应使用此方法
131+
*/
132+
@Deprecated
133+
public String getRegistAppId() {
134+
return subAppId;
135+
}
136+
137+
/**
138+
* 快速创建的小程序appId,已弃用,未来将删除
139+
*
140+
* @see #setSubAppId(String) 应使用此方法
141+
*/
142+
@Deprecated
143+
public void setRegistAppId(String value) {
144+
subAppId = value;
145+
}
146+
147+
78148
@XStreamAlias("info")
79149
@Data
80150
public static class Info implements Serializable {
@@ -119,6 +189,33 @@ public static class Info implements Serializable {
119189

120190
}
121191

192+
/**
193+
* 审核提供商分配信息
194+
*/
195+
@Data
196+
public static class DispatchInfo {
197+
198+
/**
199+
* 提供商,如:上海倍通企业信用征信有限公司
200+
*/
201+
@XStreamConverter(value = XStreamCDataConverter.class)
202+
@XStreamAlias("provider")
203+
private String provider;
204+
205+
/**
206+
* 联系方式,如:咨询电话:0411-84947888,咨询时间:周一至周五(工作日)8:30-17:30
207+
*/
208+
@XStreamConverter(value = XStreamCDataConverter.class)
209+
@XStreamAlias("contact")
210+
private String contact;
211+
212+
/**
213+
* 派遣时间戳(秒),如:1704952913
214+
*/
215+
@XStreamAlias("dispatch_time")
216+
private Long dispatchTime;
217+
}
218+
122219
public static String wxMpOutXmlMessageToEncryptedXml(WxMpXmlOutMessage message, WxOpenConfigStorage wxOpenConfigStorage) {
123220
String plainXml = message.toXml();
124221
WxOpenCryptUtil pc = new WxOpenCryptUtil(wxOpenConfigStorage);

0 commit comments

Comments
 (0)