diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/request/WxH5EntrustRequest.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/request/WxH5EntrustRequest.java new file mode 100644 index 0000000000..57f34eb136 --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/request/WxH5EntrustRequest.java @@ -0,0 +1,193 @@ +package com.github.binarywang.wxpay.bean.request; + +import com.github.binarywang.wxpay.exception.WxPayException; +import com.thoughtworks.xstream.annotations.XStreamAlias; +import lombok.*; +import me.chanjar.weixin.common.annotation.Required; + +import java.util.Map; + +/** + * @author chenliang + * @date 2021-08-02 5:12 下午 + * + *
+ * 微信h5纯签约入参 + *+ */ +@Data +@EqualsAndHashCode(callSuper = true) +@Builder(builderMethodName = "newBuilder") +@NoArgsConstructor +@AllArgsConstructor +@XStreamAlias("xml") +public class WxH5EntrustRequest extends BaseWxPayRequest { + + /** + *
+ * 协议模板ID + * plan_id + * 是 + * String(28) + * 12535 + * 协议模板ID,分为首次签约,支付中签约,重新签约 + *+ */ + @Required + @XStreamAlias("plan_id") + private String planId; + + /** + *
+ * 签约协议号 + * contract_code + * 是 + * String(32) + * 100000 + * 商户侧签约协议号,由商户生成,只能是数字,大小写字母组成 + *+ */ + @Required + @XStreamAlias("contract_code") + private String contractCode; + + /** + *
+ * 请求序列号 + * request_serial + * 是 + * int(64) + * 1000 + * 商户请求签约时的序列号,要求唯一性,禁止使用0开头的,用户排序,纯数字 + *+ */ + @Required + @XStreamAlias("request_serial") + private Long requestSerial; + + /** + *
+ * 用户账户展示名称 + * contract_display_account + * 是 + * string(32) + * 微信代扣 + * 签约用户的名称,用户页面展示,不支持符号表情 + *+ */ + @Required + @XStreamAlias("contract_display_account") + private String contractDisplayAccount; + + /** + *
+ * 回调通知URL + * notify_url + * 是 + * string(256) + * https://weixin.qq.com + * 用于接收签约成功消息的回调通知地址 + *+ */ + @Required + @XStreamAlias("notify_url") + private String notifyUrl; + + /** + *
+ * 版本号 + * sign + * 是 + * string(8) + * 1.0 + * 固定值1.0 + *+ */ + @Required + @XStreamAlias("version") + private String version; + + /** + *
+ * 时间戳 + * timestamp + * 是 + * string(10) + * 1414488825 + * 系统当前时间,10位 + *+ */ + @Required + @XStreamAlias("timestamp") + private String timestamp; + + /** + *
+ * 客户端IP + * clientip + * 是 + * string(32) + * 127.0.0.1 + * 用户客户端的IP地址 + *+ */ + @Required + @XStreamAlias("clientip") + private String clientIp; + + /** + *
+ * 回调应用appid + * return_appid + * 否 + * string(32) + * wxcbda96de0b16 + * 用来控制签约页面结束后的返回路径, + * 当指定该字段是,签约成功将返回return_appid指定的APP应用,如果不填且签约发起的浏览器ua可被微信识别, + * 则挑战到浏览器,否则留在微信 + *+ */ + @XStreamAlias("return_appid") + private String returnAppid; + + /** + *
+ * 商户测用户标识 + * outerid + * 否 + * string(32) + * 陈*(10000001) + * 用于多账号签约,值与contract_display_account一样就行 + *+ */ + @XStreamAlias("outerid") + private String outerId; + + + /** + * 是否需要nonce_str + */ + @Override + protected boolean needNonceStr() { + return false; + } + + @Override + protected void checkConstraints() throws WxPayException { + + } + + @Override + protected void storeMap(Map
+ * 小程序纯签约入参 + *+ */ +@Data +@EqualsAndHashCode(callSuper = true) +@Builder(builderMethodName = "newBuilder") +@NoArgsConstructor +@AllArgsConstructor +@XStreamAlias("xml") +public class WxMaEntrustRequest extends BaseWxPayRequest { + /** + *
+ * 协议模板ID + * plan_id + * 是 + * String(28) + * 12535 + * 协议模板ID,分为首次签约,支付中签约,重新签约 + *+ */ + @Required + @SerializedName(value = "plan_id") + @XStreamAlias("plan_id") + private String planId; + + /** + *
+ * 签约协议号 + * contract_code + * 是 + * String(32) + * 100000 + * 商户侧签约协议号,由商户生成,只能是数字,大小写字母组成 + *+ */ + @Required + @SerializedName(value = "contract_code") + @XStreamAlias("contract_code") + private String contractCode; + + /** + *
+ * 请求序列号 + * request_serial + * 是 + * int(64) + * 1000 + * 商户请求签约时的序列号,要求唯一性,禁止使用0开头的,用户排序,纯数字 + *+ */ + @Required + @SerializedName(value = "request_serial") + @XStreamAlias("request_serial") + private Long requestSerial; + + /** + *
+ * 用户账户展示名称 + * contract_display_account + * 是 + * string(32) + * 微信代扣 + * 签约用户的名称,用户页面展示,不支持符号表情 + *+ */ + @Required + @SerializedName(value = "contract_display_account") + @XStreamAlias("contract_display_account") + private String contractDisplayAccount; + + /** + *
+ * 回调通知URL + * notify_url + * 是 + * string(256) + * https://weixin.qq.com + * 用于接收签约成功消息的回调通知地址 + *+ */ + @Required + @SerializedName(value = "notify_url") + @XStreamAlias("notify_url") + private String notifyUrl; + + /** + *
+ * 版本号 + * sign + * 是 + * string(8) + * 1.0 + * 固定值1.0 + *+ */ + @Required + @XStreamAlias("version") + private String version; + + + /** + *
+ * 时间戳 + * timestamp + * 是 + * string(10) + * 1414488825 + * 系统当前时间,10位 + *+ */ + @Required + @XStreamAlias("timestamp") + private String timestamp; + + /** + *
+ * 商户侧用户标识 + * outerId + * 否 + * String + * 陈*(141448825) + * 用户在商户侧的标识 + *+ */ + @XStreamAlias("outerid") + private String outerId; + + @Override + protected void checkConstraints() throws WxPayException { + + } + + /** + * 是否需要nonce_str + */ + @Override + protected boolean needNonceStr() { + return false; + } + + @Override + protected void storeMap(Map
+ * 公众号纯签约入参 + *+ */ +@Data +@EqualsAndHashCode(callSuper = true) +@Builder(builderMethodName = "newBuilder") +@NoArgsConstructor +@AllArgsConstructor +@XStreamAlias("xml") +public class WxMpEntrustRequest extends BaseWxPayRequest { + + /** + *
+ * 协议模板ID + * plan_id + * 是 + * String(28) + * 12535 + * 协议模板ID,分为首次签约,支付中签约,重新签约 + *+ */ + @Required + @XStreamAlias("plan_id") + private String planId; + + /** + *
+ * 签约协议号 + * contract_code + * 是 + * String(32) + * 100000 + * 商户侧签约协议号,由商户生成,只能是数字,大小写字母组成 + *+ */ + @Required + @XStreamAlias("contract_code") + private String contractCode; + + /** + *
+ * 请求序列号 + * request_serial + * 是 + * int(64) + * 1000 + * 商户请求签约时的序列号,要求唯一性,禁止使用0开头的,用户排序,纯数字 + *+ */ + @Required + @XStreamAlias("request_serial") + private Long requestSerial; + + /** + *
+ * 用户账户展示名称 + * contract_display_account + * 是 + * string(32) + * 微信代扣 + * 签约用户的名称,用户页面展示,不支持符号表情 + *+ */ + @Required + @XStreamAlias("contract_display_account") + private String contractDisplayAccount; + + /** + *
+ * 回调通知URL + * notify_url + * 是 + * string(256) + * https://weixin.qq.com + * 用于接收签约成功消息的回调通知地址 + *+ */ + @Required + @XStreamAlias("notify_url") + private String notifyUrl; + + /** + *
+ * 版本号 + * sign + * 是 + * string(8) + * 1.0 + * 固定值1.0 + *+ */ + @Required + @XStreamAlias("version") + private String version; + + /** + *
+ * 时间戳 + * timestamp + * 是 + * string(10) + * 1414488825 + * 系统当前时间,10位 + *+ */ + @Required + @XStreamAlias("timestamp") + private String timestamp; + + /** + *
+ * 返回web + * return_web + * 否 + * int + * 1 + * 用来控制签约页面结束后的返回路径(不传签约后留在微信内),1 表示返回签约页面的referrer url, + * 不填或获取不到referrer则不返回,跳转referrer url 时会自动带上from_wxpay=1 + *+ */ + @XStreamAlias("return_web") + private Integer returnWeb; + + /** + *
+ * 商户测的用户标识 + * outerid + * 否 + * String() + * 陈*(101000203) + * 用于多账户签约,同一个模板下要保持一致,取值和contractDisplayAccount取一样就行 + *+ */ + @XStreamAlias("outerid") + private String outerId; + + @Override + protected void checkConstraints() throws WxPayException { + + } + + /** + * 是否需要nonce_str + */ + @Override + protected boolean needNonceStr() { + return false; + } + + @Override + protected void storeMap(Map
+ * 支付中签约入参 + *+ */ +@Data +@EqualsAndHashCode(callSuper = true) +@Builder(builderMethodName = "newBuilder") +@NoArgsConstructor +@AllArgsConstructor +@XStreamAlias("xml") +public class WxPayEntrustRequest extends BaseWxPayRequest { + + /** + *
+ * 签约商户号 + * contract_mchid + * 是 + * String(32) + * 1200009811 + * 签约商户号,必须与mch_id一致 + *+ */ + @Required + @XStreamAlias("contract_mchid") + private String contractMchId; + + /** + *
+ * 签约APPID + * contract_appid + * 是 + * String(32) + * wxcbda96de0b165486 + * 签约公众号,必须与APPID一致 + *+ */ + @Required + @XStreamAlias("contract_appid") + private String contractAppId; + + /** + *
+ * 商户订单号 + * out_trade_no + * 是 + * String(32) + * 123456 + * 商户系统内部的订单号,32字符内,可包含字母 + *+ */ + @Required + @XStreamAlias("out_trade_no") + private String outTradeNo; + + /** + *
+ * 设备号 + * device_info + * 否 + * String(32) + * 013467007045764 + * 终端设备号,若为PC网页或公众号内则传WEB + *+ */ + @XStreamAlias("device_info") + private String deviceInfo; + + /** + *
+ * 商品描述 + * body + * 是 + * String(128) + * ipad mini 16G 白色 + * 商品支付单简要描述 + *+ */ + @Required + @XStreamAlias("body") + private String body; + + /** + *
+ * 商品详情 + * detail + * 否 + * String(8192) + * ipad mini 16G 白色 + * 商品名称明细列表 + *+ */ + @XStreamAlias("detail") + private String detail; + + /** + *
+ * 附加数据 + * attach + * 否 + * String(127) + * online/dev/dev1 + * 商家数据包 + *+ */ + @XStreamAlias("attach") + private String attach; + + /** + *
+ * 回调通知url + * notify_url + * 是 + * String(256) + * https://weixin.qq.com + * 回调通知地址 + *+ */ + @Required + @XStreamAlias("notify_url") + private String notifyUrl; + + /** + *
+ * 总金额 + * total_fee + * 是 + * int + * 888 + * 订单总金额,单位分 + *+ */ + @Required + @XStreamAlias("total_fee") + private Integer totalFee; + + /** + *
+ * 终端ip + * spbill_create_ip + * 是 + * String(16) + * 127.0.0.1 + * 用户的客户端IP + *+ */ + @Required + @XStreamAlias("spbill_create_ip") + private String spbillCreateIp; + + /** + *
+ * 交易起始时间 + * time_start + * 否 + * String(14) + * 20201025171529 + * 订单生成时间,格式yyyyMMddHHmmss + *+ */ + @XStreamAlias("time_start") + private String timeStart; + + /** + *
+ * 交易结束时间 + * time_expire + * 否 + * String(14) + * 20201025171529 + * 订单失效时间,格式yyyyMMddHHmmss + *+ */ + @XStreamAlias("time_expire") + private String timeExpire; + + /** + *
+ * 商品标记 + * goods_tag + * 否 + * String(32) + * wxg + * 商品标记,代金券或立减优惠功能参数 + *+ */ + @XStreamAlias("goods_tag") + private String goodsTag; + + /** + *
+ * 交易类型 + * trade_type + * 是 + * String(16) + * JSAPI + * JSAPI,MWEB + *+ */ + @Required + @XStreamAlias("trade_type") + private String tradeType; + + /** + *
+ * 商品ID + * product_id + * 否 + * String(32) + * 12234355463434643 + * 二维码支付必传,二维码中包含商品ID + *+ */ + @XStreamAlias("product_id") + private String productId; + + /** + *
+ * 指定支付方式 + * limit_pay + * 否 + * String(32) + * no_credit + * no_credit--指定不能使用信用卡支付 + *+ */ + @XStreamAlias("limit_pay") + private String limitPay; + + /** + *
+ * 用户表示 + * openid + * 否 + * String(128) + * oUpF4sdsidj3Jds89 + * tradetype=JSAPI 则必传 + *+ */ + @XStreamAlias("openid") + private String openId; + + /** + *
+ * 协议模板ID + * plan_id + * 是 + * String(28) + * 12535 + * 协议模板ID,分为首次签约,支付中签约,重新签约 + *+ */ + @Required + @XStreamAlias("plan_id") + private String planId; + + /** + *
+ * 签约协议号 + * contract_code + * 是 + * String(32) + * 100000 + * 商户侧签约协议号,由商户生成,只能是数字,大小写字母组成 + *+ */ + @Required + @XStreamAlias("contract_code") + private String contractCode; + + /** + *
+ * 请求序列号 + * request_serial + * 是 + * int(64) + * 1000 + * 商户请求签约时的序列号,要求唯一性,禁止使用0开头的,用户排序,纯数字 + *+ */ + @Required + @XStreamAlias("request_serial") + private Long requestSerial; + + /** + *
+ * 用户账户展示名称 + * contract_display_account + * 是 + * string(32) + * 微信代扣 + * 签约用户的名称,用户页面展示,不支持符号表情 + *+ */ + @Required + @XStreamAlias("contract_display_account") + private String contractDisplayAccount; + + /** + *
+ * 签约信息通知URL + * contract_notify_url + * 是 + * string(32) + * https://yoursite.com + * 签约信息回调通知URL + *+ */ + @Required + @XStreamAlias("contract_notify_url") + private String contractNotifyUrl; + + /** + *
+ * 商户测的用户标识 + * contract_outerid + * 否 + * string(32) + * 陈*(12000002) + * 用于多账户签约,值与contract_display_account相同即可,同一模板下唯一 + *+ */ + @XStreamAlias("contract_outerid") + private String contractOuterId; + + @Override + protected void checkConstraints() throws WxPayException { + + } + + @Override + protected void storeMap(Map
+ * 微信预扣款请求参数 + *+ */ +@Data +@Builder(builderMethodName = "newBuilder") +@NoArgsConstructor +@AllArgsConstructor +public class WxPreWithholdRequest implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 委托代扣协议ID + */ + @SerializedName(value = "contract_id") + private String contractId; + + /** + * 直连商户号 + */ + @SerializedName(value = "mchid") + private String mchId; + + /** + * 公众号ID + */ + @SerializedName(value = "appid") + private String appId; + + /** + * 预计扣款的金额信息 + */ + @SerializedName(value = "estimated_amount") + private EstimateAmount estimateAmount; + + + @Data + public static class EstimateAmount implements Serializable { + /** + * 预计扣费金额 + */ + private Integer amount; + + /** + * 人民币:CNY + * 非必填 + */ + private String currency; + } +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/request/WxSignQueryRequest.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/request/WxSignQueryRequest.java new file mode 100644 index 0000000000..3ecee3fe81 --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/request/WxSignQueryRequest.java @@ -0,0 +1,105 @@ +package com.github.binarywang.wxpay.bean.request; + +import com.github.binarywang.wxpay.exception.WxPayException; +import com.thoughtworks.xstream.annotations.XStreamAlias; +import lombok.*; +import me.chanjar.weixin.common.annotation.Required; +import org.apache.commons.lang3.StringUtils; + +import java.util.Map; +import java.util.Objects; + +/** + * @author chenliang + * @date 2021-08-02 5:23 下午 + *
+ * 微信签约状态查询入参 + *+ */ +@Data +@EqualsAndHashCode(callSuper = true) +@Builder(builderMethodName = "newBuilder") +@NoArgsConstructor +@AllArgsConstructor +@XStreamAlias("xml") +public class WxSignQueryRequest extends BaseWxPayRequest { + + //方式1. 使用contract_id查 + /** + *
+ * 字段名:委托代扣协议ID. + * 变量名:contract_id + * 是否必填:二选一 + * 类型:String(32) + * 示例值:1000005698 + * 签约成功后由微信返回 + *+ */ + @XStreamAlias("contract_id") + private String contractId; + + /** + *
+ * 字段名:接口版本号. + * 变量名:version + * 是否必填:是 + * 类型:String(8) + * 示例值:1.0 + * 固定填写1.0, + *+ */ + @Required + @XStreamAlias("version") + private String version; + + //方式2. 使用plan_id和contract_code查 + /** + *
+ * 字段名:模板ID. + * 变量名:plan_id + * 是否必填:二选一 + * 类型:int + * 示例值:123 + * 代扣模板ID + *+ */ + @XStreamAlias("plan_id") + private Integer planId; + + /** + *
+ * 字段名:签约协议号. + * 变量名:contract_code + * 是否必填:二选一 + * 类型:String(32) + * 示例值:12332343 + * 商户侧唯一 + *+ */ + @XStreamAlias("contract_code") + private String contractCode; + + + @Override + protected boolean needNonceStr() { + return false; + } + + @Override + protected void checkConstraints() throws WxPayException { + if (StringUtils.isNotBlank(contractId) && + (Objects.nonNull(planId) || StringUtils.isNotBlank(contractCode))) { + throw new WxPayException("contractId 和 planId&contractCode 不能同时存在或同时为空,必须二选一"); + } + } + + @Override + protected void storeMap(Map
+ * 微信api申请解约 + *+ */ +@Data +@EqualsAndHashCode(callSuper = true) +@Builder(builderMethodName = "newBuilder") +@NoArgsConstructor +@AllArgsConstructor +@XStreamAlias("xml") +public class WxTerminatedContractRequest extends BaseWxPayRequest { + //方式1. 使用contract_id查 + /** + *
+ * 字段名:委托代扣协议ID. + * 变量名:contract_id + * 是否必填:二选一 + * 类型:String(32) + * 示例值:1000005698 + * 签约成功后由微信返回 + *+ */ + @XStreamAlias("contract_id") + private String contractId; + + /** + *
+ * 字段名:解约备注. + * 变量名:contract_termination_remark + * 是否必填:是 + * 类型:String(256) + * 示例值:解约原因 + * 例如:签约信息有误,须重新签约 + *+ */ + @Required + @XStreamAlias("contract_termination_remark") + private String contractTerminationRemark; + + /** + *
+ * 字段名:接口版本号. + * 变量名:version + * 是否必填:是 + * 类型:String(8) + * 示例值:1.0 + * 固定填写1.0, + *+ */ + @Required + @XStreamAlias("version") + private String version; + + //方式2. 使用plan_id和contract_code查 + + /** + *
+ * 字段名:模板ID. + * 变量名:plan_id + * 是否必填:二选一 + * 类型:int + * 示例值:123 + * 代扣模板ID + *+ */ + @XStreamAlias("plan_id") + private Integer planId; + + /** + *
+ * 字段名:签约协议号. + * 变量名:contract_code + * 是否必填:二选一 + * 类型:String(32) + * 示例值:12332343 + * 商户侧唯一 + *+ */ + @XStreamAlias("contract_code") + private String contractCode; + + + @Override + protected void checkConstraints() throws WxPayException { + if (StringUtils.isNotBlank(contractId) && + (Objects.nonNull(planId) || StringUtils.isNotBlank(contractCode))) { + throw new WxPayException("contractId 和 planId&contractCode 不能同时存在或同时为空,必须二选一"); + } + } + + @Override + protected boolean needNonceStr() { + return false; + } + + + @Override + protected void storeMap(Map
代扣订单查询参数+ */ +@Data +@EqualsAndHashCode(callSuper = true) +@Builder(builderMethodName = "newBuilder") +@NoArgsConstructor +@AllArgsConstructor +@XStreamAlias("xml") +public class WxWithholdOrderQueryRequest extends BaseWxPayRequest { + /** + *
+ * 字段名:微信订单号. + * 变量名:transaction_id + * 是否必填:二选一 + * 类型:String(32) + * 示例值:1000005698 + * 微信生成的单号,支付通知中返回 + *+ */ + @XStreamAlias("transaction_id") + private String transactionId; + + /** + *
+ * 字段名:商户订单号. + * 变量名:out_trade_no + * 是否必填:二选一 + * 类型:String(32) + * 示例值:1000005698 + * 商户系统内部订单号 + *+ */ + @XStreamAlias("out_trade_no") + private String outTradeNo; + + + @Override + protected void checkConstraints() throws WxPayException { + if (StringUtils.isNotBlank(transactionId) && StringUtils.isNotBlank(outTradeNo)) { + throw new WxPayException("transactionId 和 outTradeNo 不能同时存在或同时为空,必须二选一"); + } + } + + @Override + protected void storeMap(Map
+ * 发起微信委托代扣参数 + *+ */ +@Data +@EqualsAndHashCode(callSuper = true) +@Builder(builderMethodName = "newBuilder") +@NoArgsConstructor +@AllArgsConstructor +@XStreamAlias("xml") +public class WxWithholdRequest extends BaseWxPayRequest { + + /** + *
+ * 商品描述 + * body + * 是 + * String(128) + * ipad mini 16G 白色 + * 商品支付单简要描述 + *+ */ + @Required + @XStreamAlias("body") + private String body; + + /** + *
+ * 商品详情 + * detail + * 否 + * String(8192) + * ipad mini 16G 白色 + * 商品名称明细列表 + *+ */ + @XStreamAlias("detail") + private String detail; + + /** + *
+ * 附加数据 + * attach + * 否 + * String(127) + * online/dev/dev1 + * 商家数据包 + *+ */ + @XStreamAlias("attach") + private String attach; + + /** + *
+ * 商户订单号 + * out_trade_no + * 是 + * String(32) + * 123456 + * 商户系统内部的订单号,32字符内,可包含字母 + *+ */ + @Required + @XStreamAlias("out_trade_no") + private String outTradeNo; + + /** + *
+ * 总金额 + * total_fee + * 是 + * int + * 888 + * 订单总金额,单位分 + *+ */ + @Required + @XStreamAlias("total_fee") + private Integer totalFee; + + /** + *
+ * 货币类型 + * fee_type + * 否 + * String(16) + * CNY + * 默认人民币:CNY + *+ */ + @XStreamAlias("fee_type") + private String feeType; + + /** + *
+ * 终端ip + * spbill_create_ip + * 否 + * String(16) + * 127.0.0.1 + * 用户的客户端IP + *+ */ + @XStreamAlias("spbill_create_ip") + private String spbillCreateIp; + + /** + *
+ * 商品标记 + * goods_tag + * 否 + * String(32) + * wxg + * 商品标记,代金券或立减优惠功能参数 + *+ */ + @XStreamAlias("goods_tag") + private String goodsTag; + + /** + *
+ * 回调通知url + * notify_url + * 是 + * String(256) + * https://weixin.qq.com + * 回调通知地址 + *+ */ + @Required + @XStreamAlias("notify_url") + private String notifyUrl; + + /** + *
+ * 交易类型 + * trade_type + * 是 + * String(16) + * JSAPI + * JSAPI,MWEB + *+ */ + @Required + @XStreamAlias("trade_type") + private String tradeType; + + /** + *
+ * 委托代扣协议ID + * contract_id + * 是 + * String(32) + * Wx234324808503234483920 + * 签约成功后微信返回的委托代扣协议ID + *+ */ + @Required + @XStreamAlias("contract_id") + private String contractId; + + @Override + protected void checkConstraints() throws WxPayException { + + } + + @Override + protected void storeMap(Map
+ * h5纯签约后结果 + *+ */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class WxH5EntrustResult extends BaseWxPayResult implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 业务结果描述 + */ + @XStreamAlias("result_msg") + private String resultMsg; + + /** + * 跳转url + */ + @XStreamAlias("redirect_url") + private String redirectUrl; + + @Override + protected void loadXml(Document d) { + resultMsg = readXmlString(d, "result_msg"); + redirectUrl = readXmlString(d, "redirect_url"); + } +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/result/WxPayEntrustResult.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/result/WxPayEntrustResult.java new file mode 100644 index 0000000000..4dc6f19ae4 --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/result/WxPayEntrustResult.java @@ -0,0 +1,190 @@ +package com.github.binarywang.wxpay.bean.result; + +import com.github.binarywang.wxpay.constant.WxPayConstants; +import com.github.binarywang.wxpay.exception.WxPayException; +import com.github.binarywang.wxpay.service.WxPayService; +import com.github.binarywang.wxpay.util.SignUtils; +import com.google.common.collect.Lists; +import com.thoughtworks.xstream.annotations.XStreamAlias; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import me.chanjar.weixin.common.util.json.WxGsonBuilder; +import org.apache.commons.lang3.StringUtils; +import org.w3c.dom.Document; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +/** + * @author chenliang + * @date 2021-08-02 5:38 下午 + * + *
+ * 支付中签约返回结果 + *+ */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class WxPayEntrustResult extends BaseWxPayResult implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 预签约结果 + */ + @XStreamAlias("contract_result_code") + private String contractResultCode; + + /** + * 预约签约错误码 + */ + @XStreamAlias("contract_err_code") + private String contractErrCode; + + /** + * 预签约错误描述 + */ + @XStreamAlias("contract_err_code_des") + private String contractErrCodeDes; + + /** + * 预支付ID + */ + @XStreamAlias("prepay_id") + private String prepayId; + + /** + * 交易类型 + */ + @XStreamAlias("trade_type") + private String tradeType; + + /** + * 二维码链接 + * 非必传 + */ + @XStreamAlias("code_url") + private String codeUrl; + + /** + * 模板ID + * 非必传 + */ + @XStreamAlias("plan_id") + private Integer planId; + + /** + * 请求序列号 + * 非必传 + */ + @XStreamAlias("request_serial") + private Integer requestSerial; + + /** + * 签约协议号 + * 非必传 + */ + @XStreamAlias("contract_code") + private String contractCode; + + /** + * 用户账户展示名称 + * 非必传 + */ + @XStreamAlias("contract_display_account") + private String contractDisplayAccount; + + /** + * 支付跳转链接 + * 非必传 + */ + @XStreamAlias("mweb_url") + private String mwebUrl; + + /** + * 商户订单号 + */ + @XStreamAlias("out_trade_no") + private String outTradeNo; + + + @Override + protected void loadXml(Document d) { + contractResultCode = readXmlString(d, "contract_result_code"); + contractErrCode = readXmlString(d, "contract_err_code"); + contractErrCodeDes = readXmlString(d, "contract_err_code_des"); + prepayId = readXmlString(d, "prepay_id"); + tradeType = readXmlString(d, "trade_type"); + codeUrl = readXmlString(d, "code_url"); + planId = readXmlInteger(d, "plan_id"); + requestSerial = readXmlInteger(d, "request_serial"); + contractCode = readXmlString(d, "contract_code"); + contractDisplayAccount = readXmlString(d, "contract_display_account"); + mwebUrl = readXmlString(d, "mweb_url"); + outTradeNo = readXmlString(d, "out_trade_no"); + } + + /** + * 校验返回结果签名. + * + * @param wxPayService the wx pay service + * @param signType 签名类型 + * @param checkSuccess 是否同时检查结果是否成功 + * @throws WxPayException the wx pay exception + */ + + @Override + public void checkResult(WxPayService wxPayService, String signType, boolean checkSuccess) throws WxPayException { + //校验返回结果签名 + Map
+ * 微信签约查询返回结果 + *+ */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class WxSignQueryResult extends BaseWxPayResult implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 委托代扣协议ID + */ + @XStreamAlias("contractId") + private String contractId; + + /** + * 模板ID + */ + @XStreamAlias("plan_id") + private String planId; + + /** + * 请求序列号 + */ + @XStreamAlias("request_serial") + private Integer requestSerial; + + /** + * 签约协议号 + */ + @XStreamAlias("contract_code") + private String contractCode; + + /** + * 用户账户展示名称 + */ + @XStreamAlias("contract_display_account") + private String contractDisplayAccount; + + /** + * 协议状态 + */ + @XStreamAlias("contract_state") + private Integer contractState; + + /** + * 协议签署时间 + */ + @XStreamAlias("contract_signed_time") + private String contractSignedTime; + + /** + * 协议到期时间 + */ + @XStreamAlias("contract_expired_time") + private String contractExpiredTime; + + /** + * 协议解约时间 + * 非必传 + */ + @XStreamAlias("contract_terminated_time") + private String contractTerminatedTime; + + /** + * 协议解约方式 + * 非必传 + */ + @XStreamAlias("contract_terminated_mode") + private Integer contractTerminatedMode; + + /** + * 解约备注 + * 非必传 + */ + @XStreamAlias("contract_termination_remark") + private String contractTerminationRemark; + + /** + * 用户表示 + */ + @XStreamAlias("openid") + private String openId; + + + @Override + protected void loadXml(Document d) { + contractId = readXmlString(d, "contract_id"); + planId = readXmlString(d, "plan_id"); + requestSerial = readXmlInteger(d, "request_serial"); + contractCode = readXmlString(d, "contract_code"); + contractDisplayAccount = readXmlString(d, "contract_display_account"); + contractState = readXmlInteger(d, "contract_state"); + contractSignedTime = readXmlString(d, "contract_signed_time"); + contractExpiredTime = readXmlString(d, "contrace_Expired_time"); + contractTerminatedTime = readXmlString(d, "contract_terminated_time"); + contractTerminatedMode = readXmlInteger(d, "contract_terminate_mode"); + contractTerminationRemark = readXmlString(d, "contract_termination_remark"); + openId = readXmlString(d, "openid"); + } + + @Override + public String toString() { + return WxGsonBuilder.create().toJson(this); + } +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/result/WxSignStatusNotifyResult.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/result/WxSignStatusNotifyResult.java new file mode 100644 index 0000000000..f55b576e36 --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/result/WxSignStatusNotifyResult.java @@ -0,0 +1,127 @@ +package com.github.binarywang.wxpay.bean.result; + +import com.github.binarywang.wxpay.constant.WxPayConstants; +import com.github.binarywang.wxpay.exception.WxPayException; +import com.github.binarywang.wxpay.service.WxPayService; +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.annotations.XStreamAlias; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import me.chanjar.weixin.common.util.json.WxGsonBuilder; +import me.chanjar.weixin.common.util.xml.XStreamInitializer; +import org.w3c.dom.Document; + +/** + * @author chenliang + * @date 2021-08-02 4:59 下午 + *
+ * 微信签约/解约 回调结果 + *+ */ +@Data +@EqualsAndHashCode(callSuper = true) +@NoArgsConstructor +@XStreamAlias("xml") +public class WxSignStatusNotifyResult extends BaseWxPayResult { + + private static final long serialVersionUID = 1L; + + /** + * 签约协议号 + */ + @XStreamAlias("contract_code") + private String contractCode; + + /** + * 模板ID + */ + @XStreamAlias("plan_id") + private String planId; + + /** + * 用户表示 + */ + @XStreamAlias("openid") + private String openId; + + /** + * 变更类型, ADD:签约,DELETE:解约 + */ + @XStreamAlias("change_type") + private String changeType; + + /** + * 操作时间 + */ + @XStreamAlias("operate_time") + private String operateTime; + + /** + * 委托代扣协议ID + */ + @XStreamAlias("contract_id") + private String contractId; + + /** + * 协议到期时间,ADD会有,长期有效,忽略 + * 非必传 + */ + @XStreamAlias("contract_expired_time") + private String contractExpiredTime; + + /** + * DELETE时返回,0: 未解约,1:有效期过期自动解约,2:用户主动解约,3:商户api解约,4:商户平台解约,5:用户账号注销 + * 非必传 + */ + @XStreamAlias("contract_termination_mode") + private Integer contractTerminationMode; + + /** + * 请求序列号 + */ + @XStreamAlias("request_serial") + private Integer requestSerial; + + @Override + public void checkResult(WxPayService wxPayService, String signType, boolean checkSuccess) throws WxPayException { + //防止伪造成功通知 + if (WxPayConstants.ResultCode.SUCCESS.equals(getReturnCode()) && getSign() == null) { + throw new WxPayException("伪造的通知!"); + } + + super.checkResult(wxPayService, signType, checkSuccess); + } + + /** + * From xml wx sign notify result. + * + * @param xmlString the xml string + * @return the wx sign result + */ + public static WxSignStatusNotifyResult fromXML(String xmlString) { + XStream xstream = XStreamInitializer.getInstance(); + xstream.processAnnotations(WxSignStatusNotifyResult.class); + WxSignStatusNotifyResult result = (WxSignStatusNotifyResult) xstream.fromXML(xmlString); + result.setXmlString(xmlString); + return result; + } + + @Override + protected void loadXml(Document d) { + contractCode = readXmlString(d, "contract_code"); + planId = readXmlString(d, "plan_id"); + openId = readXmlString(d, "openid"); + changeType = readXmlString(d, "change_type"); + operateTime = readXmlString(d, "operate_time"); + contractId = readXmlString(d, "contract_id"); + contractExpiredTime = readXmlString(d, "contract_expired_time"); + contractTerminationMode = readXmlInteger(d, "contract_termination_mode"); + requestSerial = readXmlInteger(d, "request_serial"); + } + + @Override + public String toString() { + return WxGsonBuilder.create().toJson(this); + } +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/result/WxTerminationContractResult.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/result/WxTerminationContractResult.java new file mode 100644 index 0000000000..77067d0213 --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/result/WxTerminationContractResult.java @@ -0,0 +1,57 @@ +package com.github.binarywang.wxpay.bean.result; + +import com.thoughtworks.xstream.annotations.XStreamAlias; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import me.chanjar.weixin.common.util.json.WxGsonBuilder; +import org.w3c.dom.Document; + +import java.io.Serializable; + +/** + * @author chenliang + * @date 2021-08-02 5:41 下午 + * + *
+ * 主动解约返回值 + *+ */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class WxTerminationContractResult extends BaseWxPayResult implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 委托代扣协议ID + */ + @XStreamAlias("contractId") + private String contractId; + + /** + * 模板ID + */ + @XStreamAlias("plan_id") + private String planId; + + /** + * 签约协议号 + */ + @XStreamAlias("contract_code") + private String contractCode; + + + @Override + protected void loadXml(Document d) { + contractId = readXmlString(d, "contract_id"); + planId = readXmlString(d, "plan_id"); + contractCode = readXmlString(d, "contract_code"); + } + + @Override + public String toString() { + return WxGsonBuilder.create().toJson(this); + } +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/result/WxWithholdNotifyResult.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/result/WxWithholdNotifyResult.java new file mode 100644 index 0000000000..87cbfd1b71 --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/result/WxWithholdNotifyResult.java @@ -0,0 +1,234 @@ +package com.github.binarywang.wxpay.bean.result; + +import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyCoupon; +import com.github.binarywang.wxpay.constant.WxPayConstants; +import com.github.binarywang.wxpay.converter.WxPayOrderNotifyResultConverter; +import com.github.binarywang.wxpay.exception.WxPayException; +import com.github.binarywang.wxpay.service.WxPayService; +import com.github.binarywang.wxpay.util.SignUtils; +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.annotations.XStreamAlias; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import me.chanjar.weixin.common.util.json.WxGsonBuilder; +import me.chanjar.weixin.common.util.xml.XStreamInitializer; +import org.w3c.dom.Document; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * @author chenliang + * @date 2021-08-02 5:09 下午 + * + *
+ * 微信代扣扣款回调结果 + *+ */ +@Data +@EqualsAndHashCode(callSuper = true) +@NoArgsConstructor +@XStreamAlias("xml") +public class WxWithholdNotifyResult extends BaseWxPayResult { + + private static final long serialVersionUID = 1L; + + /** + * 设备号 + * 非必传 + */ + @XStreamAlias("device_info") + private String deviceInfo; + + /** + * 用户标识 + */ + @XStreamAlias("openid") + private String openId; + + /** + * 用户子标识 + * 非必传 + */ + @XStreamAlias("sub_openid") + private String subOpenId; + + /** + * 是否关注公众号 + * 非必传 + */ + @XStreamAlias("is_subscribe") + private String isSubscribe; + + /** + * 付款银行 + */ + @XStreamAlias("bank_type") + private String bankType; + + /** + * 总金额 + */ + @XStreamAlias("total_fee") + private Integer totalFee; + + /** + * 货币类型 + * 非必传 + */ + @XStreamAlias("fee_type") + private String feeType; + + /** + * 现金支付金额 + */ + @XStreamAlias("cash_fee") + private Integer cashFee; + + /** + * 现金支付货币类型 + * 非必传 + */ + @XStreamAlias("cash_fee_type") + private String cashFeeType; + + /** + * 交易状态 + * SUCCESS : 支付成功,REFUND:转入退款,NOTPAY:未支付,CLOSED:已关闭,ACCEPT:已接收,PAY_FAIL:支付失败 + */ + @XStreamAlias("trade_state") + private String tradeState; + + /** + * 代金券或立减优惠金额 + * 非必传 + */ + @XStreamAlias("coupon_fee") + private Integer couponFee; + + /** + * 代金券或立减优惠使用数量 + */ + @XStreamAlias("coupon_count") + private Integer couponCount; + + private List
+ * 代扣订单查询结果 + *+ */ +@Data +@EqualsAndHashCode(callSuper = true) +@NoArgsConstructor +@XStreamAlias("xml") +public class WxWithholdOrderQueryResult extends BaseWxPayResult implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 设备号 + * 非必传 + */ + @XStreamAlias("device_info") + private String deviceInfo; + + /** + * 用户标识 + */ + @XStreamAlias("openid") + private String openId; + + /** + * 是否关注公众号 + * 非必传 + */ + @XStreamAlias("is_subscribe") + private String isSubscribe; + + /** + * 交易类型 + */ + @XStreamAlias("trade_type") + private String tradeType; + + /** + * 交易状态 + * SUCCESS : 支付成功,REFUND:转入退款,NOTPAY:未支付,CLOSED:已关闭,ACCEPT:已接收,PAY_FAIL:支付失败 + */ + @XStreamAlias("trade_state") + private String tradeState; + + /** + * 付款银行 + */ + @XStreamAlias("bank_type") + private String bankType; + + /** + * 总金额 + */ + @XStreamAlias("total_fee") + private Integer totalFee; + + /** + * 货币类型 + * 非必传 + */ + @XStreamAlias("fee_type") + private String feeType; + + /** + * 现金支付金额 + */ + @XStreamAlias("cash_fee") + private Integer cashFee; + + /** + * 现金支付货币类型 + * 非必传 + */ + @XStreamAlias("cash_fee_type") + private String cashFeeType; + + /** + * 代金券或立减优惠金额 + * 非必传 + */ + @XStreamAlias("coupon_fee") + private Integer couponFee; + + /** + * 代金券或立减优惠使用数量 + */ + @XStreamAlias("coupon_count") + private Integer couponCount; + + private List
+ * 委托扣款返回值 + *+ */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class WxWithholdResult extends BaseWxPayResult implements Serializable { + + private static final long serialVersionUID = 1L; + + + /** + * 临时字段 + */ + @XStreamAlias("temp") + private String temp; + + + @Override + protected void loadXml(Document d) { + temp = readXmlString(d, "temp"); + } + + @Override + public String toString() { + return WxGsonBuilder.create().toJson(this); + } +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/WxEntrustPapService.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/WxEntrustPapService.java new file mode 100644 index 0000000000..be76b34c47 --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/WxEntrustPapService.java @@ -0,0 +1,157 @@ +package com.github.binarywang.wxpay.service; + +import com.github.binarywang.wxpay.bean.request.*; +import com.github.binarywang.wxpay.bean.result.*; +import com.github.binarywang.wxpay.exception.WxPayException; + +/** + *
+ * 微信签约代扣相关接口. + * https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/papay/chapter2_8.shtml + *+ * + * @author chenliang + * @date 2021-08-02 4:50 下午 + */ +public interface WxEntrustPapService { + + /** + * + *
+ * 获取公众号纯签约链接, + * 详见:https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/papay/chapter3_1.shtml + * 该接口返回一个签约链接,该链接只能在微信内打开 + *+ * + * @param wxMpEntrustRequest + * @return + * @throws WxPayException + */ + String mpSign(WxMpEntrustRequest wxMpEntrustRequest) throws WxPayException; + + /** + * + *
+ * 获取小程序纯签约参数json + * 详见:https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/papay/chapter3_3.shtml + * 返回一个json 前端用来拉起一个新的签约小程序进行签约 + *+ * + * + * @param wxMaEntrustRequest + * @return + * @throws WxPayException + */ + String maSign(WxMaEntrustRequest wxMaEntrustRequest) throws WxPayException; + + /** + * + *
+ * 获取h5纯签约支付跳转链接 + * 详见:https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/papay/chapter3_4.shtml + * 返回一个签约链接 在浏览器请求链接拉起微信 + *+ * + * @param wxH5EntrustRequest + * @return + * @throws WxPayException + */ + WxH5EntrustResult h5Sign(WxH5EntrustRequest wxH5EntrustRequest) throws WxPayException; + + /** + * + *
+ * 支付中签约 + * 详见:https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/papay/chapter3_5.shtml + * 请求微信 若微信内请求 需要构造json返回, + * 若h5请求 直接使用mweb_url 链接即可拉起微信 + *+ * + * @param wxPayEntrustRequest + * @return + * @throws WxPayException + */ + WxPayEntrustResult paySign(WxPayEntrustRequest wxPayEntrustRequest) throws WxPayException; + + /** + * 申请扣款 + *
+ * 申请扣款 + * 详见:https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/papay/chapter3_8.shtml + * 请求微信发起委托扣款,扣款额度和次数由使用的签约模板限制, + * 该扣款接口是立即扣款 无延时 扣款前无消息通知。 + * + * • 特殊情况:周期扣费为通知后24小时扣费方式情况下,如果用户为首次签约(包含解约后重新签约), + * 从用户签约成功时间开始算,商户在12小时内发起的扣款,会被立即执行,无延迟。商户超过12小时以后发起的扣款,都按24小时扣费规则执行 + *+ * + * @param wxWithholdRequest + * @return + * @throws WxPayException + */ + WxWithholdResult withhold(WxWithholdRequest wxWithholdRequest) throws WxPayException; + + /** + * 预扣费通知 + *
+ * 预扣费接口 + * 详见:https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/papay/chapter3_10.shtml + * 商户进行委托代扣扣费前需要在可通知时间段内调用「预扣费通知」的接口为用户发送扣费提醒, + * 并设定扣费持续天数和预计扣费金额,经过扣费等待期后,在可扣费期内可发起扣费,扣款金额不能高于预计扣费金额, + * 扣费失败可主动发起重试扣费(重试次数由其他规则限制),直到扣费成功,或者可扣费期结束。 + * 商户只能在北京时间每天 6:00~22:00调用「预扣费通知」 + *+ * + * @param wxPreWithholdRequest + * @return + * @throws WxPayException + */ + String preWithhold(WxPreWithholdRequest wxPreWithholdRequest) throws WxPayException; + + /** + * 签约状态查询 + *
+ * 签约状态查询 + * 详见:https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/papay/chapter3_7.shtml + * 查询签约关系接口提供单笔签约关系查询。 + *+ * + * @param wxSignQueryRequest + * @return + * @throws WxPayException + */ + WxSignQueryResult querySign(WxSignQueryRequest wxSignQueryRequest) throws WxPayException; + + + /** + * 申请解约 + *
+ * 申请解约 + * 详见:https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/papay/chapter3_9.shtml + * 商户与用户的签约关系有误或者商户主动要求与用户解除之前的签约协议时可调用此接口完成解约。 + * 商户可以在商户后台(pay.weixin.qq.com)设置解约回调地址,当发生解约关系的时候,微信服务器会向此地址通知解约信息,内容与签约返回一致 + *+ * + * @param wxTerminatedContractRequest + * @return + * @throws WxPayException + */ + WxTerminationContractResult terminationContract(WxTerminatedContractRequest wxTerminatedContractRequest) throws WxPayException; + + /** + * + *
+ * 查询代扣订单 + * 详见:https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/papay/chapter4_5.shtml + * 该接口仅提供微信扣款服务申请扣款接口创建的订单进行查询,商户可以通过该接口主动查询微信代扣订单状态,完成下一步的业务逻辑。 + * ACCEPT等待扣款:为24小时延时扣费场景下独有的,当没有达到24小时前一直是这种状态; + * NOTPAY未支付:系统已经启动扣款流程,这个状态只是瞬间状态,很快会进入终态(SUCCESS、PAY_FAIL) + * + *+ * + * @param wxWithholdOrderQueryRequest + * @return + * @throws WxPayException + */ + WxWithholdOrderQueryResult papOrderQuery(WxWithholdOrderQueryRequest wxWithholdOrderQueryRequest) throws WxPayException; +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/WxPayService.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/WxPayService.java index e11f65c139..9b42bd75be 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/WxPayService.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/WxPayService.java @@ -173,6 +173,12 @@ public interface WxPayService { */ InputStream downloadV3(String url) throws WxPayException; + /** + * 获取微信签约代扣服务类 + * @return entrust service + */ + WxEntrustPapService getWxEntrustPapService(); + /** * 获取企业付款服务类. * diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImpl.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImpl.java index 95919ed254..a80a7f4527 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImpl.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImpl.java @@ -74,6 +74,8 @@ public abstract class BaseWxPayServiceImpl implements WxPayService { private final MarketingMediaService marketingMediaService = new MarketingMediaServiceImpl(this); private final MarketingFavorService marketingFavorService = new MarketingFavorServiceImpl(this); private final MarketingBusiFavorService marketingBusiFavorService = new MarketingBusiFavorServiceImpl(this); + private final WxEntrustPapService wxEntrustPapService = new WxEntrustPapServiceImpl(this); + protected Map