Procházet zdrojové kódy

:new: #1775 微信支付电商收付通增加修改二级商户结算账户和退款查询的接口

cloudX před 4 roky
rodič
revize
807ed7d0b5

+ 4 - 4
weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/ecommerce/CombineTransactionsResult.java

@@ -69,7 +69,7 @@ public class CombineTransactionsResult implements Serializable {
    * </pre>
    */
   @SerializedName(value = "scene_info")
-  private CombineTransactionsResult.SceneInfo sceneInfo;
+  private SceneInfo sceneInfo;
 
   /**
    * <pre>
@@ -83,7 +83,7 @@ public class CombineTransactionsResult implements Serializable {
    * </pre>
    */
   @SerializedName(value = "sub_orders")
-  private List<CombineTransactionsResult.SubOrders> subOrders;
+  private List<SubOrders> subOrders;
 
   /**
    * <pre>
@@ -95,7 +95,7 @@ public class CombineTransactionsResult implements Serializable {
    * </pre>
    */
   @SerializedName(value = "combine_payer_info")
-  private CombineTransactionsResult.CombinePayerInfo combinePayerInfo;
+  private CombinePayerInfo combinePayerInfo;
 
   @Data
   @NoArgsConstructor
@@ -248,7 +248,7 @@ public class CombineTransactionsResult implements Serializable {
      * </pre>
      */
     @SerializedName(value = "amount")
-    private CombineTransactionsResult.Amount amount;
+    private Amount amount;
 
   }
 

+ 5 - 5
weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/ecommerce/PartnerTransactionsResult.java

@@ -203,7 +203,7 @@ public class PartnerTransactionsResult implements Serializable {
    * </pre>
    */
   @SerializedName(value = "combine_payer_info")
-  private PartnerTransactionsResult.CombinePayerInfo combinePayerInfo;
+  private CombinePayerInfo combinePayerInfo;
 
   /**
    * <pre>
@@ -215,7 +215,7 @@ public class PartnerTransactionsResult implements Serializable {
    * </pre>
    */
   @SerializedName(value = "amount")
-  private PartnerTransactionsResult.Amount amount;
+  private Amount amount;
 
   /**
    * <pre>
@@ -227,7 +227,7 @@ public class PartnerTransactionsResult implements Serializable {
    * </pre>
    */
   @SerializedName(value = "scene_info")
-  private PartnerTransactionsResult.SceneInfo sceneInfo;
+  private SceneInfo sceneInfo;
 
   /**
    * <pre>
@@ -239,7 +239,7 @@ public class PartnerTransactionsResult implements Serializable {
    * </pre>
    */
   @SerializedName(value = "promotion_detail")
-  private List<PartnerTransactionsResult.PromotionDetail> promotionDetails;
+  private List<PromotionDetail> promotionDetails;
 
   @Data
   @NoArgsConstructor
@@ -507,7 +507,7 @@ public class PartnerTransactionsResult implements Serializable {
      * </pre>
      */
     @SerializedName(value = "goods_detail")
-    private List<PartnerTransactionsResult.GoodsDetail> goodsDetails;
+    private List<GoodsDetail> goodsDetails;
 
 
   }

+ 54 - 0
weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/ecommerce/ProfitSharingQueryRequest.java

@@ -0,0 +1,54 @@
+package com.github.binarywang.wxpay.bean.ecommerce;
+
+import com.google.gson.annotations.SerializedName;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+
+@Data
+@NoArgsConstructor
+public class ProfitSharingQueryRequest implements Serializable {
+
+  /**
+   * <pre>
+   * 字段名:二级商户号
+   * 变量名:sub_mchid
+   * 是否必填:是
+   * 类型:string(32)
+   * 描述:
+   *  分账出资的电商平台二级商户,填写微信支付分配的商户号。
+   *  示例值:1900000109
+   * </pre>
+   */
+  @SerializedName(value = "sub_mchid")
+  private String subMchid;
+
+  /**
+   * <pre>
+   * 字段名:微信订单号
+   * 变量名:transaction_id
+   * 是否必填:是
+   * 类型:string(32)
+   * 描述:
+   *  微信支付订单号。
+   * 示例值: 4208450740201411110007820472
+   * </pre>
+   */
+  @SerializedName(value = "transaction_id")
+  private String transactionId;
+
+  /**
+   * <pre>
+   * 字段名:商户分账单号
+   * 变量名:out_order_no
+   * 是否必填:是
+   * 类型:string(64)
+   * 描述:
+   *  商户系统内部的分账单号,在商户系统内部唯一(单次分账、多次分账、完结分账应使用不同的商户分账单号),同一分账单号多次请求等同一次。
+   * 示例值:P20150806125346
+   * </pre>
+   */
+  @SerializedName(value = "out_order_no")
+  private String outOrderNo;
+}

+ 206 - 0
weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/ecommerce/ProfitSharingResult.java

@@ -5,6 +5,7 @@ import lombok.Data;
 import lombok.NoArgsConstructor;
 
 import java.io.Serializable;
+import java.util.List;
 
 /**
  * 请求分账 结果响应
@@ -72,4 +73,209 @@ public class ProfitSharingResult implements Serializable {
   @SerializedName(value = "order_id")
   private String orderId;
 
+  /**
+   * <pre>
+   * 字段名:分账单状态
+   * 变量名:status
+   * 是否必填:是
+   * 类型:string (64)
+   * 描述:
+   *  分账单状态,枚举值:
+   *    ACCEPTED:受理成功
+   *    PROCESSING:处理中
+   *    FINISHED:分账成功
+   *    CLOSED:处理失败,已关单
+   *  示例值:FINISHED
+   * </pre>
+   */
+  @SerializedName(value = "status")
+  private String status;
+
+  /**
+   * <pre>
+   * 字段名:分账接收方列表
+   * 变量名:receivers
+   * 是否必填:否
+   * 类型:array
+   * 描述:
+   *  分账接收方列表。当查询分账完结的执行结果时,不返回该字段
+   * </pre>
+   */
+  @SerializedName(value = "receivers")
+  private List<Receiver> receivers;
+  /**
+   * <pre>
+   * 字段名:关单原因
+   * 变量名:close_reason
+   * 是否必填:否
+   * 类型:string (32)
+   * 描述:
+   *  关单原因描述,当分账单状态status为CLOSED(处理失败,已关单)时,返回该字段。
+   * 枚举值:
+   *    NO_AUTH:分账授权已解除
+   * 示例值:NO_AUTH
+   * </pre>
+   */
+  @SerializedName(value = "close_reason")
+  private String closeReason;
+
+  /**
+   * <pre>
+   * 字段名:分账完结金额
+   * 变量名:finish_amount
+   * 是否必填:否
+   * 类型:int
+   * 描述:
+   *  分账完结的分账金额,单位为分, 仅当查询分账完结的执行结果时,存在本字段。
+   * 示例值:100
+   * </pre>
+   */
+  @SerializedName(value = "finish_amount")
+  private Integer finishAmount;
+
+  /**
+   * <pre>
+   * 字段名:分账完结描述
+   * 变量名:finish_description
+   * 是否必填:否
+   * 类型:string (80)
+   * 描述:
+   *  分账完结的原因描述,仅当查询分账完结的执行结果时,存在本字段。
+   * 示例值:分账完结
+   * </pre>
+   */
+  @SerializedName(value = "finish_description")
+  private String finishDescription;
+
+  @Data
+  @NoArgsConstructor
+  public static class Receiver implements Serializable {
+
+    /**
+     * <pre>
+     * 字段名:分账接收商户号
+     * 变量名:receiver_mchid
+     * 是否必填:是
+     * 类型:string (32)
+     * 描述:
+     *  填写微信支付分配的商户号,仅支持通过添加分账接收方接口添加的接收方;电商平台商户已默认添加到分账接收方,无需重复添加。
+     * 示例值:1900000109
+     * </pre>
+     */
+    @SerializedName(value = "receiver_mchid")
+    private String receiverMchid;
+
+    /**
+     * <pre>
+     * 字段名:分账金额
+     * 变量名:amount
+     * 是否必填:否
+     * 类型:int
+     * 描述:
+     *  分账金额,单位为分,只能为整数,不能超过原订单支付金额及最大分账比例金额。
+     * 示例值: 4208450740201411110007820472
+     * </pre>
+     */
+    @SerializedName(value = "amount")
+    private Integer amount;
+
+    /**
+     * <pre>
+     * 字段名:分账描述
+     * 变量名:description
+     * 是否必填:是
+     * 类型:string (80)
+     * 描述:
+     *  分账的原因描述,分账账单中需要体现。
+     * 示例值:分帐1900000110
+     * </pre>
+     */
+    @SerializedName(value = "description")
+    private String description;
+
+    /**
+     * <pre>
+     * 字段名:分账结果
+     * 变量名:result
+     * 是否必填:是
+     * 类型:string (32)
+     * 描述:
+     *  分账结果,枚举值:
+     *    PENDING:待分账
+     *    SUCCESS:分账成功
+     *    ADJUST:分账失败待调账
+     *    RETURNED:已转回分账方
+     *    CLOSED:已关闭
+     * 示例值:SUCCESS
+     * </pre>
+     */
+    @SerializedName(value = "result")
+    private String result;
+
+    /**
+     * <pre>
+     * 字段名:完成时间
+     * 变量名:finish_time
+     * 是否必填:是
+     * 类型:string (64)
+     * 描述:
+     *  分账完成时间,遵循rfc3339标准格式,格式为YYYY-MM-DDTHH:mm:ss.sss+TIMEZONE,YYYY-MM-DD表示年月日,
+     *  T出现在字符串中,表示time元素的开头,HH:mm:ss.sss表示时分秒毫秒,TIMEZONE表示时区
+     *  (+08:00表示东八区时间,领先UTC 8小时,即北京时间)。例如:2015-05-20T13:29:35.120+08:00表示,北京时间2015年5月20日 13点29分35秒。
+     * 示例值: 2015-05-20T13:29:35.120+08:00
+     * </pre>
+     */
+    @SerializedName(value = "finish_time")
+    private String finishTime;
+
+    /**
+     * <pre>
+     * 字段名:分账失败原因
+     * 变量名:fail_reason
+     * 是否必填:否
+     * 类型:string (32)
+     * 描述:
+     *  分账失败原因,当分账结果result为RETURNED(已转回分账方)或CLOSED(已关闭)时,返回该字段
+     * 枚举值:
+     *    ACCOUNT_ABNORMAL:分账接收账户异常
+     *    NO_RELATION:分账关系已解除
+     *    RECEIVER_HIGH_RISK:高风险接收方
+     * 示例值:NO_RELATION
+     * </pre>
+     */
+    @SerializedName(value = "fail_reason")
+    private String failReason;
+
+    /**
+     * <pre>
+     * 字段名:分账接收方类型
+     * 变量名:type
+     * 是否必填:是
+     * 类型:string (32)
+     * 描述:
+     *  分账接收方类型,枚举值:
+     *    MERCHANT_ID:商户
+     *    PERSONAL_OPENID:个人
+     * 示例值:MERCHANT_ID
+     * </pre>
+     */
+    @SerializedName(value = "type")
+    private String type;
+
+    /**
+     * <pre>
+     * 字段名:分账接收方类型
+     * 变量名:receiver_account
+     * 是否必填:是
+     * 类型:string (64)
+     * 描述:
+     *  分账接收方账号:
+     * 类型是MERCHANT_ID时,是商户ID
+     * 类型是PERSONAL_OPENID时,是个人openid
+     * 示例值:1900000109
+     * </pre>
+     */
+    @SerializedName(value = "receiver_account")
+    private String receiverAccount;
+  }
 }

+ 233 - 0
weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/ecommerce/RefundNotifyResult.java

@@ -0,0 +1,233 @@
+package com.github.binarywang.wxpay.bean.ecommerce;
+
+import com.google.gson.annotations.SerializedName;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+
+/**
+ * 退款结果 查询结果
+ * <pre>
+ *   文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/refunds/chapter3_3.shtml
+ * </pre>
+ */
+@Data
+@NoArgsConstructor
+public class RefundNotifyResult implements Serializable {
+
+  /**
+   * 源数据
+   */
+  private NotifyResponse rawData;
+
+  /**
+   * <pre>
+   * 字段名:电商平台商户号
+   * 变量名:sp_mchid
+   * 是否必填:是
+   * 类型:string(32)
+   * 描述:
+   *  微信支付分配给电商平台的商户号
+   * 示例值:1900000100
+   * </pre>
+   */
+  @SerializedName(value = "sp_mchid")
+  private String spMchid;
+
+  /**
+   * <pre>
+   * 字段名:二级商户号
+   * 变量名:sub_mchid
+   * 是否必填:是
+   * 类型:string(32)
+   * 描述:
+   *  分账出资的电商平台二级商户,填写微信支付分配的商户号。
+   *  示例值:1900000109
+   * </pre>
+   */
+  @SerializedName(value = "sub_mchid")
+  private String subMchid;
+
+  /**
+   * <pre>
+   * 字段名:商户订单号
+   * 变量名:out_trade_no
+   * 是否必填:是
+   * 类型:string(32)
+   * 描述:
+   *  返回的商户订单号
+   * 示例值: 1217752501201407033233368018
+   * </pre>
+   */
+  @SerializedName(value = "out_trade_no")
+  private String outTradeNo;
+
+  /**
+   * <pre>
+   * 字段名:微信订单号
+   * 变量名:transaction_id
+   * 是否必填:是
+   * 类型:string(32)
+   * 描述:
+   *  微信支付订单号
+   * 示例值: 1217752501201407033233368018
+   * </pre>
+   */
+  @SerializedName(value = "transaction_id")
+  private String transactionId;
+
+  /**
+   * <pre>
+   * 字段名:商户退款单号
+   * 变量名:out_refund_no
+   * 是否必填:是
+   * 类型:string(32)
+   * 描述:
+   *  商户退款单号
+   * 示例值: 1217752501201407033233368018
+   * </pre>
+   */
+  @SerializedName(value = "out_refund_no")
+  private String outRefundNo;
+
+  /**
+   * <pre>
+   * 字段名:微信退款单号
+   * 变量名:refund_id
+   * 是否必填:是
+   * 类型:string(32)
+   * 描述:
+   *  微信退款单号
+   * 示例值: 1217752501201407033233368018
+   * </pre>
+   */
+  @SerializedName(value = "refund_id")
+  private String refundId;
+
+  /**
+   * <pre>
+   * 字段名:退款状态
+   * 变量名:refund_status
+   * 是否必填:是
+   * 类型:string(16)
+   * 描述:
+   *  退款状态,枚举值:
+   *    SUCCESS:退款成功
+   *    CLOSE:退款关闭
+   *    ABNORMAL:退款异常,退款到银行发现用户的卡作废或者冻结了,导致原路退款银行卡失败,可前往【服务商平台—>交易中心】,手动处理此笔退款
+   * 示例值:SUCCESS
+   * </pre>
+   */
+  @SerializedName(value = "refund_status")
+  private String refundStatus;
+
+  /**
+   * <pre>
+   * 字段名:退款成功时间
+   * 变量名:success_time
+   * 是否必填:否
+   * 类型:string(64)
+   * 描述:
+   *  1、退款成功时间,遵循rfc3339标准格式,格式为YYYY-MM-DDTHH:mm:ss+TIMEZONE,YYYY-MM-DD表示年月日,T出现在字符串中,
+   *  表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间)。
+   *  例如:2015-05-20T13:29:35+08:00表示,北京时间2015年5月20日13点29分35秒。
+   * 2、当退款状态为退款成功时返回此参数。
+   * 示例值:2018-06-08T10:34:56+08:00
+   * </pre>
+   */
+  @SerializedName(value = "success_time")
+  private String successTime;
+
+  /**
+   * <pre>
+   * 字段名:退款入账账户
+   * 变量名:user_received_account
+   * 是否必填:是
+   * 类型:string(64)
+   * 描述:
+   *  取当前退款单的退款入账方。
+   *    退回银行卡:{银行名称}{卡类型}{卡尾号}
+   *    退回支付用户零钱: 支付用户零钱
+   *    退还商户: 商户基本账户、商户结算银行账户
+   *    退回支付用户零钱通:支付用户零钱通
+   * 示例值:招商银行信用卡0403
+   * </pre>
+   */
+  @SerializedName(value = "user_received_account")
+  private String userReceivedAccount;
+
+  /**
+   * <pre>
+   * 字段名:金额信息
+   * 变量名:amount
+   * 是否必填:是
+   * 类型:object
+   * 描述:
+   *  金额信息
+   * </pre>
+   */
+  @SerializedName(value = "amount")
+  private Amount amount;
+
+  @Data
+  @NoArgsConstructor
+  public static class Amount implements Serializable {
+    /**
+     * <pre>
+     * 字段名:订单金额
+     * 变量名:total
+     * 是否必填:是
+     * 类型:int
+     * 描述:
+     *  订单总金额,单位为分,只能为整数,详见支付金额
+     * 示例值:999
+     * </pre>
+     */
+    @SerializedName(value = "total")
+    private Integer total;
+
+    /**
+     * <pre>
+     * 字段名:退款金额
+     * 变量名:refund
+     * 是否必填:是
+     * 类型:int
+     * 描述:
+     *  退款金额,币种的最小单位,只能为整数,不能超过原订单支付金额,如果有使用券,后台会按比例退。
+     * 示例值:999
+     * </pre>
+     */
+    @SerializedName(value = "refund")
+    private String refund;
+
+    /**
+     * <pre>
+     * 字段名:用户支付金额
+     * 变量名:payer_total
+     * 是否必填:是
+     * 类型:int
+     * 描述:
+     *  用户支付金额,单位为分。
+     *  示例值:100
+     * </pre>
+     */
+    @SerializedName(value = "payer_total")
+    private Integer payerTotal;
+
+    /**
+     * <pre>
+     * 字段名:用户退款金额
+     * 变量名:payer_refund
+     * 是否必填:是
+     * 类型:int
+     * 描述:
+     *  退款给用户的金额,不包含所有优惠券金额
+     * 示例值:999
+     * </pre>
+     */
+    @SerializedName(value = "payer_refund")
+    private String payerRefund;
+  }
+
+}

+ 325 - 0
weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/ecommerce/RefundQueryResult.java

@@ -0,0 +1,325 @@
+package com.github.binarywang.wxpay.bean.ecommerce;
+
+import com.google.gson.annotations.SerializedName;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 查询退款结果
+ * 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/refunds/chapter3_2.shtml
+ */
+@Data
+@NoArgsConstructor
+public class RefundQueryResult implements Serializable {
+
+  /**
+   * <pre>
+   * 字段名:微信退款单号
+   * 变量名:refund_id
+   * 是否必填:是
+   * 类型:string(32)
+   * 描述:
+   *  微信退款单号
+   * 示例值: 1217752501201407033233368018
+   * </pre>
+   */
+  @SerializedName(value = "refund_id")
+  private String refundId;
+
+  /**
+   * <pre>
+   * 字段名:商户退款单号
+   * 变量名:out_refund_no
+   * 是否必填:是
+   * 类型:string(32)
+   * 描述:
+   *  商户退款单号
+   * 示例值: 1217752501201407033233368018
+   * </pre>
+   */
+  @SerializedName(value = "out_refund_no")
+  private String outRefundNo;
+
+  /**
+   * <pre>
+   * 字段名:微信订单号
+   * 变量名:transaction_id
+   * 是否必填:是
+   * 类型:string(32)
+   * 描述:
+   *  微信支付订单号
+   * 示例值: 1217752501201407033233368018
+   * </pre>
+   */
+  @SerializedName(value = "transaction_id")
+  private String transactionId;
+
+  /**
+   * <pre>
+   * 字段名:商户订单号
+   * 变量名:out_trade_no
+   * 是否必填:是
+   * 类型:string(32)
+   * 描述:
+   *  返回的商户订单号
+   * 示例值: 1217752501201407033233368018
+   * </pre>
+   */
+  @SerializedName(value = "out_trade_no")
+  private String outTradeNo;
+
+  /**
+   * <pre>
+   * 字段名:退款渠道
+   * 变量名:channel
+   * 是否必填:否
+   * 类型:string(16)
+   * 描述:
+   *  ORIGINAL:原路退款
+   *  BALANCE:退回到余额
+   *  OTHER_BALANCE:原账户异常退到其他余额账户
+   *  OTHER_BANKCARD:原银行卡异常退到其他银行卡
+   * 示例值: ORIGINAL
+   * </pre>
+   */
+  @SerializedName(value = "channel")
+  private String channel;
+
+  /**
+   * <pre>
+   * 字段名:退款入账账户
+   * 变量名:user_received_account
+   * 是否必填:是
+   * 类型:string(64)
+   * 描述:
+   *  取当前退款单的退款入账方。
+   *    退回银行卡:{银行名称}{卡类型}{卡尾号}
+   *    退回支付用户零钱: 支付用户零钱
+   *    退还商户: 商户基本账户、商户结算银行账户
+   *    退回支付用户零钱通:支付用户零钱通
+   * 示例值:招商银行信用卡0403
+   * </pre>
+   */
+  @SerializedName(value = "user_received_account")
+  private String userReceivedAccount;
+
+  /**
+   * <pre>
+   * 字段名:退款成功时间
+   * 变量名:success_time
+   * 是否必填:否
+   * 类型:string(64)
+   * 描述:
+   *  1、退款成功时间,遵循rfc3339标准格式,格式为YYYY-MM-DDTHH:mm:ss+TIMEZONE,YYYY-MM-DD表示年月日,T出现在字符串中,
+   *  表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间)。
+   *  例如:2015-05-20T13:29:35+08:00表示,北京时间2015年5月20日13点29分35秒。
+   * 2、当退款状态为退款成功时返回此参数。
+   * 示例值:2018-06-08T10:34:56+08:00
+   * </pre>
+   */
+  @SerializedName(value = "success_time")
+  private String successTime;
+
+  /**
+   * <pre>
+   * 字段名:退款创建时间
+   * 变量名:create_time
+   * 是否必填:是
+   * 类型:string(64)
+   * 描述:
+   *  1、退款受理时间,遵循rfc3339标准格式,格式为YYYY-MM-DDTHH:mm:ss+TIMEZONE,YYYY-MM-DD表示年月日,T出现在字符串中,
+   *  表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间)。
+   *  例如:2015-05-20T13:29:35+08:00表示,北京时间2015年5月20日13点29分35秒。
+   * 2、当退款状态为退款成功时返回此字段。
+   * 示例值:2018-06-08T10:34:56+08:00
+   * </pre>
+   */
+  @SerializedName(value = "create_time")
+  private String createTime;
+
+  /**
+   * <pre>
+   * 字段名:退款状态
+   * 变量名:status
+   * 是否必填:是
+   * 类型:string(16)
+   * 描述:
+   *  退款状态,枚举值:
+   *    SUCCESS:退款成功
+   *    REFUNDCLOSE:退款关闭
+   *    PROCESSING:退款处理中
+   *    ABNORMAL:退款异常,退款到银行发现用户的卡作废或者冻结了,导致原路退款银行卡失败,可前往【服务商平台—>交易中心】,手动处理此笔退款
+   * 示例值:SUCCESS
+   * </pre>
+   */
+  @SerializedName(value = "status")
+  private String status;
+
+  /**
+   * <pre>
+   * 字段名:金额信息
+   * 变量名:amount
+   * 是否必填:是
+   * 类型:object
+   * 描述:
+   *  金额信息
+   * </pre>
+   */
+  @SerializedName(value = "amount")
+  private Amount amount;
+
+  /**
+   * <pre>
+   * 字段名:营销详情
+   * 变量名:promotion_detail
+   * 是否必填:否
+   * 类型:array
+   * 描述:
+   *  优惠退款信息
+   * </pre>
+   */
+  public List<PromotionDetail> promotionDetails;
+
+  @Data
+  @NoArgsConstructor
+  public static class Amount implements Serializable {
+
+    /**
+     * <pre>
+     * 字段名:退款金额
+     * 变量名:refund
+     * 是否必填:是
+     * 类型:int
+     * 描述:
+     *  退款金额,币种的最小单位,只能为整数,不能超过原订单支付金额。
+     * 示例值:888
+     * </pre>
+     */
+    @SerializedName(value = "refund")
+    private String refund;
+
+    /**
+     * <pre>
+     * 字段名:用户退款金额
+     * 变量名:payer_refund
+     * 是否必填:是
+     * 类型:int
+     * 描述:
+     *  退款给用户的金额,不包含所有优惠券金额。
+     * 示例值:888
+     * </pre>
+     */
+    @SerializedName(value = "payer_refund")
+    private String payerRefund;
+
+    /**
+     * <pre>
+     * 字段名:优惠退款金额
+     * 变量名:discount_refund
+     * 是否必填:否
+     * 类型:int
+     * 描述:
+     *  优惠券的退款金额,原支付单的优惠按比例退款。
+     * 示例值:888
+     * </pre>
+     */
+    @SerializedName(value = "discount_refund")
+    private Integer discountRefund;
+
+
+    /**
+     * <pre>
+     * 字段名:退款币种
+     * 变量名:currency
+     * 是否必填:否
+     * 类型:string(18)
+     * 描述:
+     *  符合ISO 4217标准的三位字母代码,目前只支持人民币:CNY 。
+     * 示例值: CNY
+     * </pre>
+     */
+    @SerializedName(value = "currency")
+    private String currency;
+
+  }
+
+  @Data
+  @NoArgsConstructor
+  public static class PromotionDetail implements Serializable {
+
+    /**
+     * <pre>
+     * 字段名:券ID
+     * 变量名:promotion_id
+     * 是否必填:是
+     * 类型:string(32)
+     * 描述:券或者立减优惠id 。
+     * 示例值:109519
+     * </pre>
+     */
+    @SerializedName(value = "promotion_id")
+    private String promotionId;
+
+    /**
+     * <pre>
+     * 字段名:优惠范围
+     * 变量名:scope
+     * 是否必填:是
+     * 类型:string(32)
+     * 描述: 优惠范围
+     * 枚举值:
+     *    GLOBAL:全场代金券
+     *    SINGLE:单品优惠
+     * 示例值:GLOBAL
+     * </pre>
+     */
+    @SerializedName(value = "scope")
+    private String scope;
+
+    /**
+     * <pre>
+     * 字段名:优惠类型
+     * 变量名:type
+     * 是否必填:是
+     * 类型:string(32)
+     * 描述:
+     *   枚举值:
+     *    COUPON:充值型代金券,商户需要预先充值营销经费
+     *    DISCOUNT:免充值型优惠券,商户不需要预先充值营销经费
+     * 示例值:DISCOUNT
+     * </pre>
+     */
+    @SerializedName(value = "type")
+    private String type;
+
+    /**
+     * <pre>
+     * 字段名:优惠券面额
+     * 变量名:amount
+     * 是否必填:是
+     * 类型:int
+     * 描述: 用户享受优惠的金额(优惠券面额=微信出资金额+商家出资金额+其他出资方金额 )。
+     * 示例值:5
+     * </pre>
+     */
+    @SerializedName(value = "amount")
+    private Integer amount;
+
+    /**
+     * <pre>
+     * 字段名:优惠退款金额
+     * 变量名:refund_amount
+     * 是否必填:是
+     * 类型:int
+     * 描述: 代金券退款金额<=退款金额,退款金额-代金券或立减优惠退款金额为现金,说明详见《代金券或立减优惠》。
+     * 示例值:100
+     * </pre>
+     */
+    @SerializedName(value = "refund_amount")
+    private Integer refundAmount;
+
+  }
+}

+ 1 - 1
weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/ecommerce/ReturnOrdersResult.java

@@ -72,7 +72,7 @@ public class ReturnOrdersResult implements Serializable {
    * </pre>
    */
   @SerializedName(value = "out_return_no")
-  private String R20190516001;
+  private String outReturnNo;
 
   /**
    * <pre>

+ 114 - 0
weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/ecommerce/SettlementRequest.java

@@ -0,0 +1,114 @@
+package com.github.binarywang.wxpay.bean.ecommerce;
+
+import com.github.binarywang.wxpay.v3.SpecEncrypt;
+import com.google.gson.annotations.SerializedName;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+
+/**
+ * <pre>
+ * 普通服务商(支付机构、银行不可用),可使用本接口修改其进件、已签约的特约商户-结算账户信息。
+ * 文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/applyments/chapter3_4.shtml
+ * </pre>
+ */
+@Data
+@NoArgsConstructor
+public class SettlementRequest implements Serializable {
+
+  /**
+   * <pre>
+   * 字段名:账户类型
+   * 变量名:account_type
+   * 是否必填:是
+   * 类型:string(32)
+   * 描述:
+   *  根据特约商户号的主体类型,可选择的账户类型如下:
+   * 1、小微主体:经营者个人银行卡
+   * 2、个体工商户主体:经营者个人银行卡/ 对公银行账户
+   * 3、企业主体:对公银行账户
+   * 4、党政、机关及事业单位主体:对公银行账户
+   * 5、其他组织主体:对公银行账户
+   * 枚举值:
+   *    ACCOUNT_TYPE_BUSINESS:对公银行账户
+   *    ACCOUNT_TYPE_PRIVATE:经营者个人银行卡
+   * 示例值:ACCOUNT_TYPE_BUSINESS
+   * </pre>
+   */
+  @SerializedName(value = "account_type")
+  private String accountType;
+
+  /**
+   * <pre>
+   * 字段名:开户银行
+   * 变量名:account_bank
+   * 是否必填:是
+   * 类型:string(128)
+   * 描述:
+   *  请填写开户银行名称,详细参见《开户银行对照表》https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/applyments/chapter4_1.shtml。
+   * 示例值:工商银行
+   * </pre>
+   */
+  @SerializedName(value = "account_bank")
+  private String accountBank;
+
+  /**
+   * <pre>
+   * 字段名:开户银行省市编码
+   * 变量名:bank_address_code
+   * 是否必填:是
+   * 类型:string(128)
+   * 描述:
+   *  需至少精确到市,详细参见《省市区编号对照表》。
+   * 示例值:110000
+   * </pre>
+   */
+  @SerializedName(value = "bank_address_code")
+  private String bankAddressCode;
+
+  /**
+   * <pre>
+   * 字段名:开户银行全称(含支行)
+   * 变量名:bank_name
+   * 是否必填:否
+   * 类型:string(128)
+   * 描述:
+   *  若开户银行为“其他银行”,则需二选一填写“开户银行全称(含支行)”或“开户银行联行号”。
+   * 填写银行全称,如"深圳农村商业银行XXX支行" ,详细参见开户银行全称(含支行)对照表。
+   * 示例值:施秉县农村信用合作联社城关信用社
+   * </pre>
+   */
+  @SerializedName(value = "bank_name")
+  private String bankName;
+
+  /**
+   * <pre>
+   * 字段名:开户银行联行号
+   * 变量名:bank_branch_id
+   * 是否必填:否
+   * 类型:string(128)
+   * 描述:
+   *  若开户银行为“其他银行”,则需二选一填写“开户银行全称(含支行)”或“开户银行联行号”。
+   * 填写银行联行号,详细参见《开户银行全称(含支行)对照表》。
+   * 示例值:402713354941
+   * </pre>
+   */
+  @SerializedName(value = "bank_branch_id")
+  private String bankBranchId;
+
+  /**
+   * <pre>
+   * 字段名:银行账号
+   * 变量名:account_number
+   * 是否必填:是
+   * 类型:string(128)
+   * 描述:
+   *  1、数字,长度遵循系统支持的对公/对私卡号长度要求
+   * 2、该字段需进行加密处理,加密方法详见《敏感信息加密说明》。(提醒:必须在HTTP头中上送Wechatpay-Serial)
+   * </pre>
+   */
+  @SpecEncrypt
+  @SerializedName(value = "account_number")
+  private String accountNumber;
+}

+ 106 - 0
weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/ecommerce/SettlementResult.java

@@ -0,0 +1,106 @@
+package com.github.binarywang.wxpay.bean.ecommerce;
+
+import com.google.gson.annotations.SerializedName;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+
+/**
+ * 查询结算账户结果
+ * <pre>
+ *   文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/applyments/chapter3_5.shtml
+ * </pre>
+ */
+@Data
+@NoArgsConstructor
+public class SettlementResult implements Serializable {
+  /**
+   * <pre>
+   * 字段名:账户类型
+   * 变量名:account_type
+   * 是否必填:是
+   * 类型:string(32)
+   * 描述:
+   * 枚举值:
+   *    ACCOUNT_TYPE_BUSINESS:对公银行账户
+   *    ACCOUNT_TYPE_PRIVATE:经营者个人银行卡
+   * 示例值:ACCOUNT_TYPE_BUSINESS
+   * </pre>
+   */
+  @SerializedName(value = "account_type")
+  private String accountType;
+
+  /**
+   * <pre>
+   * 字段名:开户银行
+   * 变量名:account_bank
+   * 是否必填:是
+   * 类型:string(128)
+   * 描述:
+   *  返回特约商户的结算账户-开户银行全称。
+   * 示例值:工商银行
+   * </pre>
+   */
+  @SerializedName(value = "account_bank")
+  private String accountBank;
+
+  /**
+   * <pre>
+   * 字段名:开户银行全称(含支行)
+   * 变量名:bank_name
+   * 是否必填:是
+   * 类型:string(128)
+   * 描述:
+   *  返回特约商户的结算账户-开户银行全称(含支行)。
+   * 示例值:施秉县农村信用合作联社城关信用社
+   * </pre>
+   */
+  @SerializedName(value = "bank_name")
+  private String bankName;
+
+  /**
+   * <pre>
+   * 字段名:开户银行联行号
+   * 变量名:bank_branch_id
+   * 是否必填:是
+   * 类型:string(128)
+   * 描述:
+   *  返回特约商户的结算账户-联行号。
+   * 示例值:402713354941
+   * </pre>
+   */
+  @SerializedName(value = "bank_branch_id")
+  private String bankBranchId;
+
+  /**
+   * <pre>
+   * 字段名:银行账号
+   * 变量名:account_number
+   * 是否必填:是
+   * 类型:string(128)
+   * 描述:
+   *  返回特约商户的结算账户-银行账号,掩码显示。
+   * 示例值:62*************78
+   * </pre>
+   */
+  @SerializedName(value = "account_number")
+  private String accountNumber;
+
+  /**
+   * <pre>
+   * 字段名:汇款验证结果
+   * 变量名:verify_result
+   * 是否必填:是
+   * 类型:string(32)
+   * 描述:
+   *  返回特约商户的结算账户-汇款验证结果。
+   *    VERIFYING:系统汇款验证中,商户可发起提现尝试。
+   *    VERIFY_SUCCESS:系统成功汇款,该账户可正常发起提现。
+   *    VERIFY_FAIL:系统汇款失败,该账户无法发起提现,请检查修改。
+   * 示例值:VERIFY_SUCCESS
+   * </pre>
+   */
+  @SerializedName(value = "verify_result")
+  private String verifyResult;
+}

+ 76 - 0
weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/EcommerceService.java

@@ -227,6 +227,18 @@ public interface EcommerceService {
 
   /**
    * <pre>
+   * 查询分账结果API
+   * 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/profitsharing/chapter3_2.shtml
+   * </pre>
+   *
+   * @param request 查询分账请求
+   * @return 返回数据 profit sharing result
+   * @throws WxPayException the wx pay exception
+   */
+  ProfitSharingResult queryProfitSharing(ProfitSharingQueryRequest request) throws WxPayException;
+
+  /**
+   * <pre>
    * 请求分账回退API
    * 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/profitsharing/chapter3_3.shtml
    * </pre>
@@ -263,6 +275,45 @@ public interface EcommerceService {
 
   /**
    * <pre>
+   * 查询退款API
+   * 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/refunds/chapter3_2.shtml
+   * </pre>
+   *
+   * @param subMchid 二级商户号
+   * @param refundId 微信退款单号
+   * @return 返回数据 return refunds result
+   * @throws WxPayException the wx pay exception
+   */
+  RefundQueryResult queryRefundByRefundId(String subMchid, String refundId) throws WxPayException;
+
+  /**
+   * <pre>
+   * 查询退款API
+   * 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/refunds/chapter3_2.shtml
+   * </pre>
+   *
+   * @param subMchid 二级商户号
+   * @param outRefundNo 商户退款单号
+   * @return 返回数据 return refunds result
+   * @throws WxPayException the wx pay exception
+   */
+  RefundQueryResult queryRefundByOutRefundNo(String subMchid, String outRefundNo) throws WxPayException;
+
+  /**
+   * <pre>
+   * 退款通知回调数据处理
+   * 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/refunds/chapter3_3.shtml
+   * </pre>
+   *
+   * @param notifyData 通知数据
+   * @param header     通知头部数据,不传则表示不校验头
+   * @return 解密后通知数据 partner refund notify result
+   * @throws WxPayException the wx pay exception
+   */
+  RefundNotifyResult parseRefundNotifyResult(String notifyData, SignatureHeader header) throws WxPayException;
+
+  /**
+   * <pre>
    * 二级商户账户余额提现API
    * 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/fund/chapter3_2.shtml
    * </pre>
@@ -284,4 +335,29 @@ public interface EcommerceService {
    * @throws WxPayException the wx pay exception
    */
   SpWithdrawResult spWithdraw(SpWithdrawRequest request) throws WxPayException;
+
+  /**
+   * <pre>
+   * 修改结算帐号API
+   * 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/applyments/chapter3_4.shtml
+   * </pre>
+   *
+   * @param subMchid 二级商户号。
+   * @param request 结算帐号
+   * @throws WxPayException the wx pay exception
+   */
+  void modifySettlement(String subMchid, SettlementRequest request) throws WxPayException;
+
+  /**
+   * <pre>
+   * 查询结算账户API
+   * 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/applyments/chapter3_5.shtml
+   * </pre>
+   *
+   * @param subMchid 二级商户号。
+   * @return 返回数据 return settlement result
+   * @throws WxPayException the wx pay exception
+   */
+  SettlementResult querySettlement(String subMchid) throws WxPayException;
+
 }

+ 57 - 0
weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/EcommerceServiceImpl.java

@@ -182,6 +182,14 @@ public class EcommerceServiceImpl implements EcommerceService {
   }
 
   @Override
+  public ProfitSharingResult queryProfitSharing(ProfitSharingQueryRequest request) throws WxPayException {
+    String url = String.format("%s/v3/ecommerce/profitsharing/orders?sub_mchid=%s&transaction_id=%s&out_order_no=%s",
+      this.payService.getPayBaseUrl(), request.getSubMchid(), request.getTransactionId(), request.getOutOrderNo());
+    String response = this.payService.getV3(URI.create(url));
+    return GSON.fromJson(response, ProfitSharingResult.class);
+  }
+
+  @Override
   public ReturnOrdersResult returnOrders(ReturnOrdersRequest request) throws WxPayException {
     String url = String.format("%s/v3/ecommerce/profitsharing/returnorders", this.payService.getPayBaseUrl());
     String response = this.payService.postV3(url, GSON.toJson(request));
@@ -203,6 +211,41 @@ public class EcommerceServiceImpl implements EcommerceService {
   }
 
   @Override
+  public RefundQueryResult queryRefundByRefundId(String subMchid, String refundId) throws WxPayException {
+    String url = String.format("%s/v3/ecommerce/refunds/id/%s?sub_mchid=%s", this.payService.getPayBaseUrl(), refundId, subMchid);
+    String response = this.payService.getV3(URI.create(url));
+    return GSON.fromJson(response, RefundQueryResult.class);
+  }
+
+  @Override
+  public RefundQueryResult queryRefundByOutRefundNo(String subMchid, String outRefundNo) throws WxPayException {
+    String url = String.format("%s/v3/ecommerce/applyments/out-request-no/%s?sub_mchid=%s", this.payService.getPayBaseUrl(), outRefundNo, subMchid);
+    String response = this.payService.getV3(URI.create(url));
+    return GSON.fromJson(response, RefundQueryResult.class);
+  }
+
+  @Override
+  public RefundNotifyResult parseRefundNotifyResult(String notifyData, SignatureHeader header) throws WxPayException {
+    if(Objects.nonNull(header) && !this.verifyNotifySign(header, notifyData)){
+      throw new WxPayException("非法请求,头部信息验证失败");
+    }
+    NotifyResponse response = GSON.fromJson(notifyData, NotifyResponse.class);
+    NotifyResponse.Resource resource = response.getResource();
+    String cipherText = resource.getCiphertext();
+    String associatedData = resource.getAssociatedData();
+    String nonce = resource.getNonce();
+    String apiV3Key = this.payService.getConfig().getApiV3Key();
+    try {
+      String result = AesUtils.decryptToString(associatedData, nonce,cipherText, apiV3Key);
+      RefundNotifyResult notifyResult = GSON.fromJson(result, RefundNotifyResult.class);
+      notifyResult.setRawData(response);
+      return notifyResult;
+    } catch (GeneralSecurityException | IOException e) {
+      throw new WxPayException("解析报文异常!", e);
+    }
+  }
+
+  @Override
   public SubWithdrawResult subWithdraw(SubWithdrawRequest request) throws WxPayException {
     String url = String.format("%s/v3/ecommerce/fund/withdraw", this.payService.getPayBaseUrl());
     String response = this.payService.postV3(url, GSON.toJson(request));
@@ -216,6 +259,20 @@ public class EcommerceServiceImpl implements EcommerceService {
     return GSON.fromJson(response, SpWithdrawResult.class);
   }
 
+  @Override
+  public void modifySettlement(String subMchid, SettlementRequest request) throws WxPayException {
+    String url = String.format("%s/v3/apply4sub/sub_merchants/%s/modify-settlement", this.payService.getPayBaseUrl(), subMchid);
+    RsaCryptoUtil.encryptFields(request, this.payService.getConfig().getVerifier().getValidCertificate());
+    this.payService.postV3WithWechatpaySerial(url, GSON.toJson(request));
+  }
+
+  @Override
+  public SettlementResult querySettlement(String subMchid) throws WxPayException {
+    String url = String.format("%s/v3/apply4sub/sub_merchants/%s/settlement", this.payService.getPayBaseUrl(), subMchid);
+    String response = this.payService.getV3(URI.create(url));
+    return GSON.fromJson(response, SettlementResult.class);
+  }
+
   /**
    * 校验通知签名
    * @param header 通知头信息