diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/merchantlimitation/MerchantLimitationResult.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/merchantlimitation/MerchantLimitationResult.java
new file mode 100644
index 0000000000..6c0f31d41c
--- /dev/null
+++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/merchantlimitation/MerchantLimitationResult.java
@@ -0,0 +1,183 @@
+package com.github.binarywang.wxpay.bean.merchantlimitation;
+
+import com.google.gson.annotations.SerializedName;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 子商户管控情况
+ *
+ * @author zhangyl
+ */
+@Data
+public class MerchantLimitationResult implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 商户ID
+ */
+ @SerializedName("mchid")
+ private String mchId;
+ /**
+ * 商户被管控能力列表
+ */
+ @SerializedName("limited_functions")
+ private List
+ * 唯一标记本次管控动作的ID,可用来和“管控流水订阅通知”中的“业务单号”做关联
+ *
+ * 若商户被管控时会返回
+ *
+ * 被管控的原因,若商户被管控时会返回 + *
+ */ + @SerializedName("limitation_reason") + private String limitationReason; + /** + * 商户被管控原因描述 + *+ * 在该原因下,被管控的原因描述,若商户被管控时会返回 + *
+ */ + @SerializedName("limitation_reason_describe") + private String limitationReasonDescribe; + /** + * 商户被该原因管控的能力列表 + *+ * 在该原因下,若商户以下能力被管控时会返回 + *
+ * 在该原因下,若商户除了relate_limitations所罗列的被管控能力,还有其他被管控的能力时会返回(如有多项以英文逗号分隔) + *
+ */ + @SerializedName("other_relate_limitations") + private String otherRelateLimitations; + + /** + * 商户被该原因管控的解脱路径 + *+ * 在该原因下,若存在解脱路径时会返回 + *
+ * 若解脱路径recover_way为“填写尽调信息”、“补充受益所有人信息”,需通过提交尽调来解脱,此处会返回“尽调单号”;若解脱路径recover_way + * 为“提交相关信息申诉”,需通过提交资料来解脱,此处会返回“商户管理记录单号”;若解脱路径recover_way为“联系有权机关咨询”,此处会返回有权机关信息 + *
+ */ + @SerializedName("recover_way_param") + private String recoverWayParam; + + /** + * 商户被该原因管控的解脱帮助链接 + *+ * 在该原因下,若存在解脱帮助说明时会返回 + *
+ */ + @SerializedName("recover_help_url") + private String recoverHelpUrl; + + /** + * 处置方式 + *+ * 管控处置方式类型,默认是立即管控 + *
+ * 若商户被管控时会返回,延迟管控但是未到管控时间时不会返回 + *
+ */ + @SerializedName("limitation_date") + private String limitationDate; + + } +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/notify/PartnerSubscribeNotifyResult.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/notify/PartnerSubscribeNotifyResult.java new file mode 100644 index 0000000000..52917ddf17 --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/notify/PartnerSubscribeNotifyResult.java @@ -0,0 +1,66 @@ +package com.github.binarywang.wxpay.bean.notify; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 合作伙伴订阅通知 产品介绍 + *+ * 该类是订阅通知的通用结构,每个字段代表的含义和订阅类型有关。请依据文档自行判断使用。 + *
+ * + * @author zhangyl + */ +@Data +@NoArgsConstructor +public class PartnerSubscribeNotifyResult implements Serializable, + WxPayBaseNotifyV3Result+ * 产品介绍 + *
+ * + * @author zhangyl + */ +public interface MerchantLimitationService { + + /** + * 查询子商户管控情况 + *+ * 接口文档 + *
+ * + * @param subMchId 子商户号 + * @return 子商户管控情况 + * @throws WxPayException the wx pay exception + */ + MerchantLimitationResult fetchLimitations(String subMchId) 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 6a096c6338..a460d5f248 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 @@ -400,6 +400,13 @@ default WxPayService switchoverTo(String mchIdOrConfigKey) { */ void setEntPayService(EntPayService entPayService); + /** + * 获取商户被管控能力及原因查询接口 + * + * @return MerchantLimitationService + */ + MerchantLimitationService getMerchantLimitationService(); + /** *
* 查询订单.
@@ -1164,6 +1171,16 @@ WxPayRefundQueryResult refundQuery(String transactionId, String outTradeNo, Stri
*/
WxPayPartnerRefundNotifyV3Result parsePartnerRefundNotifyV3Result(String notifyData, SignatureHeader header) throws WxPayException;
+ /**
+ * 解析合作伙伴订阅通知
+ *
+ * @param notifyData 通知数据
+ * @param header 通知头部数据
+ * @return 合作伙伴订阅通知
+ * @throws WxPayException the wx pay exception
+ */
+ PartnerSubscribeNotifyResult parsePartnerSubscribeNotify(String notifyData, SignatureHeader header) throws WxPayException;
+
/**
* 解析扫码支付回调通知
* 详见https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=6_4
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 36987f637d..6868cb644f 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
@@ -143,6 +143,9 @@ public abstract class BaseWxPayServiceImpl implements WxPayService {
@Getter
private final MiPayService miPayService = new MiPayServiceImpl(this);
+ @Getter
+ private final MerchantLimitationService merchantLimitationService = new MerchantLimitationServiceImpl(this);
+
protected Map configMap = new ConcurrentHashMap<>();
@Override
@@ -631,6 +634,11 @@ public WxPayPartnerRefundNotifyV3Result parsePartnerRefundNotifyV3Result(String
return this.baseParseOrderNotifyV3Result(notifyData, header, WxPayPartnerRefundNotifyV3Result.class, WxPayPartnerRefundNotifyV3Result.DecryptNotifyResult.class);
}
+ @Override
+ public PartnerSubscribeNotifyResult parsePartnerSubscribeNotify(String notifyData, SignatureHeader header) throws WxPayException {
+ return this.baseParseOrderNotifyV3Result(notifyData, header, PartnerSubscribeNotifyResult.class, PartnerSubscribeNotifyResult.DecryptNotifyResult.class);
+ }
+
@Override
public WxScanPayNotifyResult parseScanPayNotifyResult(String xmlData, @Deprecated String signType) throws WxPayException {
try {
diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/MerchantLimitationServiceImpl.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/MerchantLimitationServiceImpl.java
new file mode 100644
index 0000000000..d946336e31
--- /dev/null
+++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/MerchantLimitationServiceImpl.java
@@ -0,0 +1,28 @@
+package com.github.binarywang.wxpay.service.impl;
+
+import com.github.binarywang.wxpay.bean.merchantlimitation.MerchantLimitationResult;
+import com.github.binarywang.wxpay.exception.WxPayException;
+import com.github.binarywang.wxpay.service.MerchantLimitationService;
+import com.github.binarywang.wxpay.service.WxPayService;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import lombok.RequiredArgsConstructor;
+
+/**
+ * 商户被管控能力及原因查询 接口实现
+ *
+ * @author zhangyl
+ */
+@RequiredArgsConstructor
+public class MerchantLimitationServiceImpl implements MerchantLimitationService {
+ private final WxPayService payService;
+ private static final Gson GSON = new GsonBuilder().create();
+
+ @Override
+ public MerchantLimitationResult fetchLimitations(String subMchId) throws WxPayException {
+ String url = String.format("%s/v3/mch-operation-manage/merchant-limitations/sub-mchid/%s",
+ this.payService.getPayBaseUrl(), subMchId);
+ String result = this.payService.getV3(url);
+ return GSON.fromJson(result, MerchantLimitationResult.class);
+ }
+}