Skip to content

Commit

Permalink
🎨 binarywang#3250【开放平台】调整并完善小程序认证相关代码文档
Browse files Browse the repository at this point in the history
  • Loading branch information
tianchaohongyu authored Mar 29, 2024
1 parent ddddffc commit 47c55ef
Show file tree
Hide file tree
Showing 10 changed files with 148 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
*
* @author penhuozhu
* @since 2024/01/07
* @deprecated 应使用 WxOpenMaService.getAuthService() 的相关功能来处理小程序认证相关业务
*/
@Data
@Deprecated
public class WxMaUploadAuthMaterialResult implements Serializable {
private static final long serialVersionUID = 1L;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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拒绝(不可重新提交)
/**
* 资质认证成功/名称认证成功: 有效期 (整形),指的是时间戳,将于该时间戳认证过期.
* 年审通知: 有效期 (整形),指的是时间戳,将于该时间戳认证过期,需尽快年审
Expand All @@ -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订单付款通知
///////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -783,8 +783,10 @@ WxOpenMaDomainResult modifyDomain(String action, List<String> requestDomains, Li
/**
* 小程序认证上传补充材料
*
* @return
* @return 结果
* @see #getAuthService() 应使用此处方法处理小程序认证相关业务
*/
@Deprecated
WxMaUploadAuthMaterialResult uploadAuthMaterial(File file) throws WxErrorException;

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import lombok.Setter;
import me.chanjar.weixin.open.bean.result.WxOpenResult;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
* 小程序认证 查询操作 响应
Expand Down Expand Up @@ -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;

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import org.jetbrains.annotations.NotNull;

/**
* 小程序认证 查询操作 响应数据
* 小程序认证 查询操作 响应数据 - 审核提供商分配信息
*
* @author <a href="https://www.sacoc.cn">广州跨界</a>
* created on 2024/01/11
Expand All @@ -32,5 +32,5 @@ public class MaAuthQueryResultDispatchInfo {
*/
@NotNull
@SerializedName("dispatch_time")
private Integer dispatchTime;
private Long dispatchTime;
}
Original file line number Diff line number Diff line change
@@ -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;

/**
Expand All @@ -11,6 +13,8 @@
* created on 2024/01/11
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class MaAuthResubmitParam {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -13,13 +14,11 @@
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class MaAuthSubmitParam {

/**
* 认证信息
*
* @author <a href="https://www.sacoc.cn">广州跨界</a>
* created on 2024/01/11
*/
@NotNull
@SerializedName("auth_data")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class MaAuthSubmitParamAuthData {
*/
@NotNull
@SerializedName("customer_type")
private String customerType;
private Integer customerType;

/**
* 联系人信息
Expand All @@ -33,7 +33,7 @@ public class MaAuthSubmitParamAuthData {
private MaAuthSubmitParamContactInfo contactInfo;

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

/**
* 认证类型为个人类型时可以选择要认证的身份,从/wxa/sec/authidentitytree 里获取,填叶节点的name
Expand Down Expand Up @@ -106,5 +106,5 @@ public class MaAuthSubmitParamAuthData {
*/
@Nullable
@SerializedName("service_appid")
private String serviceAppid;
private String serviceAppId;
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
public class MaAuthSubmitParamInvoiceInfo {

/**
* 发票类型 1: 不开发票 2: 电子发票 3: 增值税专票
* 发票类型 1不开发票 2电子发票 3增值税专票,服务商代缴时只能为1,即不开发票
*/
@NotNull
@SerializedName("invoice_type")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
public class WxOpenXmlMessage implements Serializable {
private static final long serialVersionUID = -5641769554709507771L;

/**
* 第三方平台的APPID
*/
@XStreamAlias("AppId")
@XStreamConverter(value = XStreamCDataConverter.class)
private String appId;
Expand Down Expand Up @@ -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;
Expand All @@ -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 {
Expand Down Expand Up @@ -119,6 +189,33 @@ public static class Info 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);
Expand Down

0 comments on commit 47c55ef

Please sign in to comment.