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 limitedFunctions; + /** + * 商户其他被管控能力描述 + */ + @SerializedName("other_limited_functions") + private String otherLimitedFunctions; + /** + * 被管控原因及解脱路径列表 + */ + @SerializedName("recovery_specifications") + private List recoverySpecifications; + + @Data + @NoArgsConstructor + public static class RecoverySpecification implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 商户被该原因管控的单据号 + *

+ * 唯一标记本次管控动作的ID,可用来和“管控流水订阅通知”中的“业务单号”做关联 + *

+ */ + @SerializedName("limitation_case_id") + private String limitationCaseId; + /** + * 商户被管控原因类型 + *

+ * 若商户被管控时会返回 + *

  • LICENSE_ABNORMAL:经营证照异常
  • + *
  • NO_TRADE:无交易
  • + *
  • SETTLE_ACCOUNT_ABNORMAL:结算信息异常
  • + *
  • RISK_ABNORMAL:风险异常
  • + *
  • OTHER:其他
  • + *
  • INSPECT_ABNORMAL:巡检异常
  • + *
  • INVALID_REPRESENTATIVE_INFORMATION:法定代表人/负责人资料异常
  • + *
  • INVALID_BUSINESS_STATUS:经营状态异常
  • + *
  • INVALID_BUSINESS_LICENSE:经营证照资料异常
  • + *
  • INVALID_BENEFICIARY_INFORMATION:受益所有人资料异常
  • + *

    + */ + @SerializedName("limitation_reason_type") + private String limitationReasonType; + /** + * 商户被管控原因 + *

    + * 被管控的原因,若商户被管控时会返回 + *

    + */ + @SerializedName("limitation_reason") + private String limitationReason; + /** + * 商户被管控原因描述 + *

    + * 在该原因下,被管控的原因描述,若商户被管控时会返回 + *

    + */ + @SerializedName("limitation_reason_describe") + private String limitationReasonDescribe; + /** + * 商户被该原因管控的能力列表 + *

    + * 在该原因下,若商户以下能力被管控时会返回 + *

  • NO_TRANSACTION_AND_RECHARGE:关闭收单和充值
  • + *
  • NO_PAYMENT:关闭付款
  • + *
  • NO_WITHDRAWAL:关闭提现
  • + *
  • NO_REFUND:关闭退款
  • + *
  • NO_TRANSACTION:关闭收单
  • + *
  • NO_PROFIT_SHARING:关闭分账分出
  • + *
  • NO_PAYMENT_POINT_COMPLETE_ORDER:关闭支付分服务结单
  • + *

    + */ + @SerializedName("relate_limitations") + private List relateLimitations; + + /** + * 商户被该原因管控的其他能力描述 + *

    + * 在该原因下,若商户除了relate_limitations所罗列的被管控能力,还有其他被管控的能力时会返回(如有多项以英文逗号分隔) + *

    + */ + @SerializedName("other_relate_limitations") + private String otherRelateLimitations; + + /** + * 商户被该原因管控的解脱路径 + *

    + * 在该原因下,若存在解脱路径时会返回 + *

  • IRRECOVERABLE:不可恢复
  • + *
  • MODIFY_SUBJECT_INFORMATION:修改主体资料
  • + *
  • MODIFY_SETTLE_ACCOUNT_INFORMATION:修改结算银行账户
  • + *
  • VERIFY_INACTIVE_MERCHANT_IDENTITY:核实商户身份
  • + *
  • SUBMIT_OFFLINE_BUSINESS_SCENARIO_INFORMATION:提交线下经营场景信息
  • + *
  • SUBMIT_INFORMATION_FOR_APPEAL:提交相关信息申诉
  • + *
  • RESOLVE_TRANSACTION_DISPUTES:解决交易纠纷
  • + *
  • MODIFY_ADMINISTRATOR_INFORMATION:修改超级管理员
  • + *
  • CALL_CUSTOMER_SERVICE_AT_95017:拨打微信支付客服电话95017
  • + *
  • UPDATE_BUSINESS_SCENARIO_INFORMATION:更新经营场景信息
  • + *
  • SUBMIT_CDD_INFORMATION:填写尽调信息
  • + *
  • WAITING_FOR_PLATFORM_REVIEW:等待平台审核
  • + *
  • SUBMIT_UBO_INFORMATION:补充受益所有人信息
  • + *
  • SIGN_ANTI_FRAUD_PLEDGE_AND_VERIFY_FACE:签署反诈承诺书并刷脸核实身份
  • + *
  • CONTACT_APPROPRIATE_AUTHORITY_FOR_CONSULTATION:联系有权机关咨询
  • + *
  • MODIFY_ABBREVIATION_INFORMATION:修改商户简称
  • + *

    + */ + @SerializedName("recover_way") + private String recoverWay; + + /** + * 商户被该原因管控的解脱路径参数 + *

    + * 若解脱路径recover_way为“填写尽调信息”、“补充受益所有人信息”,需通过提交尽调来解脱,此处会返回“尽调单号”;若解脱路径recover_way + * 为“提交相关信息申诉”,需通过提交资料来解脱,此处会返回“商户管理记录单号”;若解脱路径recover_way为“联系有权机关咨询”,此处会返回有权机关信息 + *

    + */ + @SerializedName("recover_way_param") + private String recoverWayParam; + + /** + * 商户被该原因管控的解脱帮助链接 + *

    + * 在该原因下,若存在解脱帮助说明时会返回 + *

    + */ + @SerializedName("recover_help_url") + private String recoverHelpUrl; + + /** + * 处置方式 + *

    + * 管控处置方式类型,默认是立即管控 + *

  • LIMIT_ACTION_TYPE_IMMEDIATE_CONTROL:立即管控
  • + *
  • LIMIT_ACTION_TYPE_DELAY_CONTROL:延迟管控
  • + *

    + */ + @SerializedName("limitation_action_type") + private String limitationActionType; + + /** + * 预计管控开始时间 + */ + @SerializedName("limitation_start_date") + private String limitationStartDate; + + /** + * 商户被该原因管控的时间 + *

    + * 若商户被管控时会返回,延迟管控但是未到管控时间时不会返回 + *

    + */ + @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 { + private static final long serialVersionUID = 1L; + /** + * 源数据 + */ + private OriginNotifyResponse rawData; + /** + * 解密后的数据 + */ + private DecryptNotifyResult result; + + @Data + @NoArgsConstructor + public static class DecryptNotifyResult implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 商户号 + */ + @SerializedName("merchant_code") + private String merchantCode; + /** + * 商户全称 + */ + @SerializedName("merchant_company_name") + private String merchantCompanyName; + /** + * 业务发生时间 + */ + @SerializedName("business_time") + private String businessTime; + /** + * 业务单据 + */ + @SerializedName("business_code") + private String businessCode; + /** + * 业务状态 + */ + @SerializedName("business_state") + private String businessState; + /** + * 备注 + */ + @SerializedName("remark") + private String remark; + } +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/MerchantLimitationService.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/MerchantLimitationService.java new file mode 100644 index 0000000000..bc3753cce5 --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/MerchantLimitationService.java @@ -0,0 +1,28 @@ +package com.github.binarywang.wxpay.service; + +import com.github.binarywang.wxpay.bean.merchantlimitation.MerchantLimitationResult; +import com.github.binarywang.wxpay.exception.WxPayException; + +/** + * 商户被管控能力及原因查询 接口 + *

    + * 产品介绍 + *

    + * + * @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);
    +  }
    +}