Skip to content

Commit 37a2a2b

Browse files
committed
feat:解析合作伙伴订阅通知
1 parent 4034834 commit 37a2a2b

3 files changed

Lines changed: 81 additions & 0 deletions

File tree

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
package com.github.binarywang.wxpay.bean.notify;
2+
3+
import com.google.gson.annotations.SerializedName;
4+
import lombok.Data;
5+
import lombok.NoArgsConstructor;
6+
7+
import java.io.Serializable;
8+
9+
/**
10+
* 合作伙伴订阅通知 <a href="https://pay.weixin.qq.com/doc/v3/partner/4016022264">产品介绍</a>
11+
* <p>
12+
* 该类是订阅通知的通用结构,每个字段代表的含义和订阅类型有关。请依据文档自行判断使用。
13+
* </p>
14+
*
15+
* @author zhangyl
16+
*/
17+
@Data
18+
@NoArgsConstructor
19+
public class PartnerSubscribeNotifyResult implements Serializable,
20+
WxPayBaseNotifyV3Result<PartnerSubscribeNotifyResult.DecryptNotifyResult> {
21+
private static final long serialVersionUID = 1L;
22+
/**
23+
* 源数据
24+
*/
25+
private OriginNotifyResponse rawData;
26+
/**
27+
* 解密后的数据
28+
*/
29+
private DecryptNotifyResult result;
30+
31+
@Data
32+
@NoArgsConstructor
33+
public static class DecryptNotifyResult implements Serializable {
34+
private static final long serialVersionUID = 1L;
35+
/**
36+
* 商户号
37+
*/
38+
@SerializedName("merchant_code")
39+
private String merchantCode;
40+
/**
41+
* 商户全称
42+
*/
43+
@SerializedName("merchant_company_name")
44+
private String merchantCompanyName;
45+
/**
46+
* 业务发生时间
47+
*/
48+
@SerializedName("business_time")
49+
private String businessTime;
50+
/**
51+
* 业务单据
52+
*/
53+
@SerializedName("business_code")
54+
private String businessCode;
55+
/**
56+
* 业务状态
57+
*/
58+
@SerializedName("business_state")
59+
private String businessState;
60+
/**
61+
* 备注
62+
*/
63+
@SerializedName("remark")
64+
private String remark;
65+
}
66+
}

weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/WxPayService.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,6 +1164,16 @@ WxPayRefundQueryResult refundQuery(String transactionId, String outTradeNo, Stri
11641164
*/
11651165
WxPayPartnerRefundNotifyV3Result parsePartnerRefundNotifyV3Result(String notifyData, SignatureHeader header) throws WxPayException;
11661166

1167+
/**
1168+
* 解析合作伙伴订阅通知
1169+
*
1170+
* @param notifyData 通知数据
1171+
* @param header 通知头部数据
1172+
* @return 合作伙伴订阅通知
1173+
* @throws WxPayException the wx pay exception
1174+
*/
1175+
PartnerSubscribeNotifyResult parsePartnerSubscribeNotify(String notifyData, SignatureHeader header) throws WxPayException;
1176+
11671177
/**
11681178
* 解析扫码支付回调通知
11691179
* 详见https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=6_4

weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImpl.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,11 @@ public WxPayPartnerRefundNotifyV3Result parsePartnerRefundNotifyV3Result(String
631631
return this.baseParseOrderNotifyV3Result(notifyData, header, WxPayPartnerRefundNotifyV3Result.class, WxPayPartnerRefundNotifyV3Result.DecryptNotifyResult.class);
632632
}
633633

634+
@Override
635+
public PartnerSubscribeNotifyResult parsePartnerSubscribeNotify(String notifyData, SignatureHeader header) throws WxPayException {
636+
return this.baseParseOrderNotifyV3Result(notifyData, header, PartnerSubscribeNotifyResult.class, PartnerSubscribeNotifyResult.DecryptNotifyResult.class);
637+
}
638+
634639
@Override
635640
public WxScanPayNotifyResult parseScanPayNotifyResult(String xmlData, @Deprecated String signType) throws WxPayException {
636641
try {

0 commit comments

Comments
 (0)