Преглед изворни кода

:new: #1772 电商收付通增加支付结果查询和提现的接口

cloudX пре 4 година
родитељ
комит
5f0d1b320a

+ 3 - 334
weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/ecommerce/CombineTransactionsNotifyResult.java

@@ -1,11 +1,9 @@
 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;
 
 /**
  * 合单支付 通知结果
@@ -24,337 +22,8 @@ public class CombineTransactionsNotifyResult implements Serializable {
   private NotifyResponse rawData;
 
   /**
-     * <pre>
-     * 字段名:合单商户appid
-     * 变量名:combine_appid
-     * 是否必填:是
-     * 类型:string(32)
-     * 描述:
-     *  合单发起方的appid。(即电商平台appid)
-     *  示例值:wxd678efh567hg6787
-     * </pre>
-     */
-    @SerializedName(value = "combine_appid")
-    private String combineAppid;
-
-    /**
-     * <pre>
-     * 字段名:合单商户号
-     * 变量名:combine_mchid
-     * 是否必填:是
-     * 类型:string(32)
-     * 描述:
-     *  合单发起方商户号。(即电商平台mchid)
-     *  示例值:1900000109
-     * </pre>
-     */
-    @SerializedName(value = "combine_mchid")
-    private String combineMchid;
-
-    /**
-     * <pre>
-     * 字段名:合单商户订单号
-     * 变量名:combine_out_trade_no
-     * 是否必填:是
-     * 类型:string(32)
-     * 描述:
-     *  合单支付总订单号,要求32个字符内,只能是数字、大小写字母_-|*@ ,且在同一个商户号下唯一。
-     *  示例值:P20150806125346
-     * </pre>
-     */
-    @SerializedName(value = "combine_out_trade_no")
-    private String combineOutTradeNo;
-
-    /**
-     * <pre>
-     * 字段名:+场景信息
-     * 变量名:scene_info
-     * 是否必填:否
-     * 类型:object
-     * 描述:支付场景信息描述
-     * </pre>
-     */
-    @SerializedName(value = "scene_info")
-    private SceneInfo sceneInfo;
-
-    /**
-     * <pre>
-     * 字段名:+子单信息
-     * 变量名:sub_orders
-     * 是否必填:是
-     * 类型:array
-     * 描述:
-     *  最多支持子单条数:50
-     *
-     * </pre>
-     */
-    @SerializedName(value = "sub_orders")
-    private List<SubOrders> subOrders;
-
-    /**
-     * <pre>
-     * 字段名:+支付者
-     * 变量名:combine_payer_info
-     * 是否必填:否
-     * 类型:object
-     * 描述:示例值:见请求示例
-     * </pre>
-     */
-    @SerializedName(value = "combine_payer_info")
-    private CombinePayerInfo combinePayerInfo;
-
-  @Data
-  @NoArgsConstructor
-  public static class SubOrders implements  Serializable {
-    /**
-     * <pre>
-     * 字段名:子单商户号
-     * 变量名:mchid
-     * 是否必填:是
-     * 类型:string(32)
-     * 描述:
-     *  子单发起方商户号,必须与发起方Appid有绑定关系。(即电商平台mchid)
-     *  示例值:1900000109
-     * </pre>
-     */
-    @SerializedName(value = "mchid")
-    private String mchid;
-
-    /**
-     * <pre>
-     * 字段名:交易类型
-     * 变量名:trade_type
-     * 是否必填:是
-     * 类型:string (16)
-     * 描述:
-     *  枚举值:
-     *  NATIVE:扫码支付
-     *  JSAPI:公众号支付
-     *  APP:APP支付
-     *  MWEB:H5支付
-     *  示例值: JSAPI
-     * </pre>
-     */
-    @SerializedName(value = "trade_type")
-    private String tradeType;
-
-    /**
-     * <pre>
-     * 字段名:交易状态
-     * 变量名:trade_state
-     * 是否必填:是
-     * 类型:string (32)
-     * 描述:
-     *  枚举值:
-     *  SUCCESS:支付成功
-     *  REFUND:转入退款
-     *  NOTPAY:未支付
-     *  CLOSED:已关闭
-     *  USERPAYING:用户支付中
-     *  PAYERROR:支付失败(其他原因,如银行返回失败)
-     *  示例值: SUCCESS
-     * </pre>
-     */
-    @SerializedName(value = "trade_state")
-    private String tradeState;
-
-    /**
-     * <pre>
-     * 字段名:付款银行
-     * 变量名:bank_type
-     * 是否必填:否
-     * 类型:string(16)
-     * 描述:
-     *  银行类型,采用字符串类型的银行标识。
-     *  示例值:CMC
-     * </pre>
-     */
-    @SerializedName(value = "bank_type")
-    private String bankType;
-
-    /**
-     * <pre>
-     * 字段名:附加信息
-     * 变量名:attach
-     * 是否必填:是
-     * 类型:string(128)
-     * 描述:
-     *  附加数据,在查询API和支付通知中原样返回,可作为自定义参数使用。
-     *  示例值:深圳分店
-     * </pre>
-     */
-    @SerializedName(value = "attach")
-    private String attach;
-
-    /**
-     * <pre>
-     * 字段名:支付完成时间
-     * 变量名:success_time
-     * 是否必填:是
-     * 类型:string(16)
-     * 描述:
-     *  订单支付时间,遵循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 = "success_time")
-    private String successTime;
-
-    /**
-     * <pre>
-     * 字段名:微信订单号
-     * 变量名:transaction_id
-     * 是否必填:是
-     * 类型:string(32)
-     * 描述:
-     *  微信支付订单号。
-     *  示例值: 1009660380201506130728806387
-     * </pre>
-     */
-    @SerializedName(value = "transaction_id")
-    private String transactionId;
-
-    /**
-     * <pre>
-     * 字段名:子单商户订单号
-     * 变量名:out_trade_no
-     * 是否必填:是
-     * 类型:string(32)
-     * 描述:
-     *  商户系统内部订单号,要求32个字符内,只能是数字、大小写字母_-|*@ ,且在同一个商户号下唯一。
-     *  特殊规则:最小字符长度为6
-     *  示例值:20150806125346
-     * </pre>
-     */
-    @SerializedName(value = "out_trade_no")
-    private String outTradeNo;
-
-    /**
-     * <pre>
-     * 字段名:二级商户号
-     * 变量名:sub_mchid
-     * 是否必填:是
-     * 类型:string(32)
-     * 描述:
-     *  二级商户商户号,由微信支付生成并下发。
-     *  注意:仅适用于电商平台 服务商
-     *  示例值:1900000109
-     * </pre>
-     */
-    @SerializedName(value = "sub_mchid")
-    private String subMchid;
-
-    /**
-     * <pre>
-     * 字段名:+订单金额
-     * 变量名:amount
-     * 是否必填:是
-     * 类型:object
-     * 描述:订单金额信息
-     * </pre>
-     */
-    @SerializedName(value = "amount")
-    private Amount amount;
-
-  }
-
-  @Data
-  @NoArgsConstructor
-  public static class SceneInfo implements Serializable {
-    /**
-     * <pre>
-     * 字段名:商户端设备号
-     * 变量名:device_id
-     * 是否必填:否
-     * 类型:string(16)
-     * 描述:
-     *  终端设备号(门店号或收银设备ID)。
-     *  特殊规则:长度最小7个字节
-     *  示例值:POS1:1
-     * </pre>
-     */
-    @SerializedName(value = "device_id")
-    private String deviceId;
-
-  }
-
-  @Data
-  @NoArgsConstructor
-  public static class CombinePayerInfo implements Serializable {
-    /**
-     * <pre>
-     * 字段名:用户标识
-     * 变量名:openid
-     * 是否必填:是
-     * 类型:string(128)
-     * 描述:
-     *  使用合单appid获取的对应用户openid。是用户在商户appid下的唯一标识。
-     *  示例值:oUpF8uMuAJO_M2pxb1Q9zNjWeS6o
-     * </pre>
-     */
-    @SerializedName(value = "openid")
-    private String openid;
-
-  }
-
-  @Data
-  @NoArgsConstructor
-  public static class Amount implements Serializable {
-    /**
-     * <pre>
-     * 字段名:标价金额
-     * 变量名:total_amount
-     * 是否必填:是
-     * 类型:int64
-     * 描述:
-     *  子单金额,单位为分。
-     *  示例值:100
-     * </pre>
-     */
-    @SerializedName(value = "total_amount")
-    private Integer totalAmount;
-
-    /**
-     * <pre>
-     * 字段名:标价币种
-     * 变量名:currency
-     * 是否必填:是
-     * 类型:string(8)
-     * 描述:
-     *  符合ISO 4217标准的三位字母代码,人民币:CNY。
-     *  示例值:CNY
-     * </pre>
-     */
-    @SerializedName(value = "currency")
-    private String currency;
-
-    /**
-     * <pre>
-     * 字段名:现金支付金额
-     * 变量名:payer_amount
-     * 是否必填:是
-     * 类型:int64
-     * 描述:
-     *  订单现金支付金额。
-     *  示例值:10
-     * </pre>
-     */
-    @SerializedName(value = "payer_amount")
-    private Integer payerAmount;
-
-    /**
-     * <pre>
-     * 字段名:现金支付币种
-     * 变量名:payer_currency
-     * 是否必填:是
-     * 类型:string(8)
-     * 描述:
-     *  货币类型,符合ISO 4217标准的三位字母代码,默认人民币:CNY。
-     *  示例值: CNY
-     * </pre>
-     */
-    @SerializedName(value = "payer_currency")
-    private String payerCurrency;
-  }
+   * 解密后的数据
+   */
+  private CombineTransactionsResult result;
 
 }

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

@@ -0,0 +1,353 @@
+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;
+
+/**
+ * 合单支付 查询结果
+ * <pre>
+ *   文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/combine/chapter3_3.shtml
+ * </pre>
+ */
+@Data
+@NoArgsConstructor
+public class CombineTransactionsResult implements Serializable {
+
+  /**
+   * <pre>
+   * 字段名:合单商户appid
+   * 变量名:combine_appid
+   * 是否必填:是
+   * 类型:string(32)
+   * 描述:
+   *  合单发起方的appid。(即电商平台appid)
+   *  示例值:wxd678efh567hg6787
+   * </pre>
+   */
+  @SerializedName(value = "combine_appid")
+  private String combineAppid;
+
+  /**
+   * <pre>
+   * 字段名:合单商户号
+   * 变量名:combine_mchid
+   * 是否必填:是
+   * 类型:string(32)
+   * 描述:
+   *  合单发起方商户号。(即电商平台mchid)
+   *  示例值:1900000109
+   * </pre>
+   */
+  @SerializedName(value = "combine_mchid")
+  private String combineMchid;
+
+  /**
+   * <pre>
+   * 字段名:合单商户订单号
+   * 变量名:combine_out_trade_no
+   * 是否必填:是
+   * 类型:string(32)
+   * 描述:
+   *  合单支付总订单号,要求32个字符内,只能是数字、大小写字母_-|*@ ,且在同一个商户号下唯一。
+   *  示例值:P20150806125346
+   * </pre>
+   */
+  @SerializedName(value = "combine_out_trade_no")
+  private String combineOutTradeNo;
+
+  /**
+   * <pre>
+   * 字段名:+场景信息
+   * 变量名:scene_info
+   * 是否必填:否
+   * 类型:object
+   * 描述:支付场景信息描述
+   * </pre>
+   */
+  @SerializedName(value = "scene_info")
+  private CombineTransactionsResult.SceneInfo sceneInfo;
+
+  /**
+   * <pre>
+   * 字段名:+子单信息
+   * 变量名:sub_orders
+   * 是否必填:是
+   * 类型:array
+   * 描述:
+   *  最多支持子单条数:50
+   *
+   * </pre>
+   */
+  @SerializedName(value = "sub_orders")
+  private List<CombineTransactionsResult.SubOrders> subOrders;
+
+  /**
+   * <pre>
+   * 字段名:+支付者
+   * 变量名:combine_payer_info
+   * 是否必填:否
+   * 类型:object
+   * 描述:示例值:见请求示例
+   * </pre>
+   */
+  @SerializedName(value = "combine_payer_info")
+  private CombineTransactionsResult.CombinePayerInfo combinePayerInfo;
+
+  @Data
+  @NoArgsConstructor
+  public static class SubOrders implements  Serializable {
+    /**
+     * <pre>
+     * 字段名:子单商户号
+     * 变量名:mchid
+     * 是否必填:是
+     * 类型:string(32)
+     * 描述:
+     *  子单发起方商户号,必须与发起方Appid有绑定关系。(即电商平台mchid)
+     *  示例值:1900000109
+     * </pre>
+     */
+    @SerializedName(value = "mchid")
+    private String mchid;
+
+    /**
+     * <pre>
+     * 字段名:交易类型
+     * 变量名:trade_type
+     * 是否必填:是
+     * 类型:string (16)
+     * 描述:
+     *  枚举值:
+     *  NATIVE:扫码支付
+     *  JSAPI:公众号支付
+     *  APP:APP支付
+     *  MWEB:H5支付
+     *  示例值: JSAPI
+     * </pre>
+     */
+    @SerializedName(value = "trade_type")
+    private String tradeType;
+
+    /**
+     * <pre>
+     * 字段名:交易状态
+     * 变量名:trade_state
+     * 是否必填:是
+     * 类型:string (32)
+     * 描述:
+     *  枚举值:
+     *  SUCCESS:支付成功
+     *  REFUND:转入退款
+     *  NOTPAY:未支付
+     *  CLOSED:已关闭
+     *  USERPAYING:用户支付中
+     *  PAYERROR:支付失败(其他原因,如银行返回失败)
+     *  示例值: SUCCESS
+     * </pre>
+     */
+    @SerializedName(value = "trade_state")
+    private String tradeState;
+
+    /**
+     * <pre>
+     * 字段名:付款银行
+     * 变量名:bank_type
+     * 是否必填:否
+     * 类型:string(16)
+     * 描述:
+     *  银行类型,采用字符串类型的银行标识。
+     *  示例值:CMC
+     * </pre>
+     */
+    @SerializedName(value = "bank_type")
+    private String bankType;
+
+    /**
+     * <pre>
+     * 字段名:附加信息
+     * 变量名:attach
+     * 是否必填:是
+     * 类型:string(128)
+     * 描述:
+     *  附加数据,在查询API和支付通知中原样返回,可作为自定义参数使用。
+     *  示例值:深圳分店
+     * </pre>
+     */
+    @SerializedName(value = "attach")
+    private String attach;
+
+    /**
+     * <pre>
+     * 字段名:支付完成时间
+     * 变量名:success_time
+     * 是否必填:是
+     * 类型:string(16)
+     * 描述:
+     *  订单支付时间,遵循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 = "success_time")
+    private String successTime;
+
+    /**
+     * <pre>
+     * 字段名:微信订单号
+     * 变量名:transaction_id
+     * 是否必填:是
+     * 类型:string(32)
+     * 描述:
+     *  微信支付订单号。
+     *  示例值: 1009660380201506130728806387
+     * </pre>
+     */
+    @SerializedName(value = "transaction_id")
+    private String transactionId;
+
+    /**
+     * <pre>
+     * 字段名:子单商户订单号
+     * 变量名:out_trade_no
+     * 是否必填:是
+     * 类型:string(32)
+     * 描述:
+     *  商户系统内部订单号,要求32个字符内,只能是数字、大小写字母_-|*@ ,且在同一个商户号下唯一。
+     *  特殊规则:最小字符长度为6
+     *  示例值:20150806125346
+     * </pre>
+     */
+    @SerializedName(value = "out_trade_no")
+    private String outTradeNo;
+
+    /**
+     * <pre>
+     * 字段名:二级商户号
+     * 变量名:sub_mchid
+     * 是否必填:是
+     * 类型:string(32)
+     * 描述:
+     *  二级商户商户号,由微信支付生成并下发。
+     *  注意:仅适用于电商平台 服务商
+     *  示例值:1900000109
+     * </pre>
+     */
+    @SerializedName(value = "sub_mchid")
+    private String subMchid;
+
+    /**
+     * <pre>
+     * 字段名:+订单金额
+     * 变量名:amount
+     * 是否必填:是
+     * 类型:object
+     * 描述:订单金额信息
+     * </pre>
+     */
+    @SerializedName(value = "amount")
+    private CombineTransactionsResult.Amount amount;
+
+  }
+
+  @Data
+  @NoArgsConstructor
+  public static class SceneInfo implements Serializable {
+    /**
+     * <pre>
+     * 字段名:商户端设备号
+     * 变量名:device_id
+     * 是否必填:否
+     * 类型:string(16)
+     * 描述:
+     *  终端设备号(门店号或收银设备ID)。
+     *  特殊规则:长度最小7个字节
+     *  示例值:POS1:1
+     * </pre>
+     */
+    @SerializedName(value = "device_id")
+    private String deviceId;
+
+  }
+
+  @Data
+  @NoArgsConstructor
+  public static class CombinePayerInfo implements Serializable {
+    /**
+     * <pre>
+     * 字段名:用户标识
+     * 变量名:openid
+     * 是否必填:是
+     * 类型:string(128)
+     * 描述:
+     *  使用合单appid获取的对应用户openid。是用户在商户appid下的唯一标识。
+     *  示例值:oUpF8uMuAJO_M2pxb1Q9zNjWeS6o
+     * </pre>
+     */
+    @SerializedName(value = "openid")
+    private String openid;
+
+  }
+
+  @Data
+  @NoArgsConstructor
+  public static class Amount implements Serializable {
+    /**
+     * <pre>
+     * 字段名:标价金额
+     * 变量名:total_amount
+     * 是否必填:是
+     * 类型:int64
+     * 描述:
+     *  子单金额,单位为分。
+     *  示例值:100
+     * </pre>
+     */
+    @SerializedName(value = "total_amount")
+    private Integer totalAmount;
+
+    /**
+     * <pre>
+     * 字段名:标价币种
+     * 变量名:currency
+     * 是否必填:是
+     * 类型:string(8)
+     * 描述:
+     *  符合ISO 4217标准的三位字母代码,人民币:CNY。
+     *  示例值:CNY
+     * </pre>
+     */
+    @SerializedName(value = "currency")
+    private String currency;
+
+    /**
+     * <pre>
+     * 字段名:现金支付金额
+     * 变量名:payer_amount
+     * 是否必填:是
+     * 类型:int64
+     * 描述:
+     *  订单现金支付金额。
+     *  示例值:10
+     * </pre>
+     */
+    @SerializedName(value = "payer_amount")
+    private Integer payerAmount;
+
+    /**
+     * <pre>
+     * 字段名:现金支付币种
+     * 变量名:payer_currency
+     * 是否必填:是
+     * 类型:string(8)
+     * 描述:
+     *  货币类型,符合ISO 4217标准的三位字母代码,默认人民币:CNY。
+     *  示例值: CNY
+     * </pre>
+     */
+    @SerializedName(value = "payer_currency")
+    private String payerCurrency;
+  }
+}

+ 2 - 567
weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/ecommerce/PartnerTransactionsNotifyResult.java

@@ -1,11 +1,9 @@
 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;
 
 /**
  * 普通支付 通知结果
@@ -23,570 +21,7 @@ public class PartnerTransactionsNotifyResult implements Serializable {
   private NotifyResponse rawData;
 
   /**
-   * <pre>
-   * 字段名:服务商公众号ID
-   * 变量名:sp_appid
-   * 是否必填:是
-   * 类型:string(32)
-   * 描述:
-   *  服务商申请的公众号或移动应用appid。
-   *  示例值:wx8888888888888888
-   * </pre>
+   * 解密后的数据
    */
-  @SerializedName(value = "sp_appid")
-  private String spAppid;
-
-  /**
-   * <pre>
-   * 字段名:服务商户号
-   * 变量名:sp_mchid
-   * 是否必填:是
-   * 类型:string(32)
-   * 描述:
-   *  服务商户号,由微信支付生成并下发
-   *  示例值:1230000109
-   * </pre>
-   */
-  @SerializedName(value = "sp_mchid")
-  private String spMchid;
-
-  /**
-   * <pre>
-   * 字段名:二级商户公众号ID
-   * 变量名:sub_appid
-   * 是否必填:否
-   * 类型:string(32)
-   * 描述:
-   *  二级商户申请的公众号或移动应用appid。
-   *  示例值:wxd678efh567hg6999
-   * </pre>
-   */
-  @SerializedName(value = "sub_appid")
-  private String subAppid;
-
-  /**
-   * <pre>
-   * 字段名:二级商户号
-   * 变量名:sub_mchid
-   * 是否必填:是
-   * 类型:string(32)
-   * 描述:
-   *  二级商户的商户号,有微信支付生成并下发。
-   *  示例值:1900000109
-   * </pre>
-   */
-  @SerializedName(value = "sub_mchid")
-  private String subMchid;
-
-  /**
-   * <pre>
-   * 字段名:+商户订单号
-   * 变量名:out_trade_no
-   * 是否必填:是
-   * 类型:string(32)
-   * 描述:商户系统内部订单号,只能是数字、大小写字母_-*且在同一个商户号下唯一,详见【商户订单号】。
-   * 特殊规则:最小字符长度为6
-   * 示例值: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>
-   * 字段名:交易类型
-   * 变量名:trade_type
-   * 是否必填:否
-   * 类型:string(16)
-   * 描述:交易类型,枚举值:
-   *  JSAPI:公众号支付
-   *  NATIVE:扫码支付
-   *  APP:APP支付
-   *  MICROPAY:付款码支付
-   *  MWEB:H5支付
-   *  FACEPAY:刷脸支付
-   *
-   * 示例值: MICROPAY
-   * </pre>
-   */
-  @SerializedName(value = "trade_type")
-  private String tradeType;
-
-  /**
-   * <pre>
-   * 字段名:交易状态
-   * 变量名:trade_state
-   * 是否必填:是
-   * 类型:string(32)
-   * 描述:交易状态,枚举值:
-   *  SUCCESS:支付成功
-   *  REFUND:转入退款
-   *  NOTPAY:未支付
-   *  CLOSED:已关闭
-   *  REVOKED:已撤销(付款码支付)
-   *  USERPAYING:用户支付中(付款码支付)
-   *  PAYERROR:支付失败(其他原因,如银行返回失败)
-   *
-   * 示例值:SUCCESS
-   * </pre>
-   */
-  @SerializedName(value = "trade_state")
-  private String tradeState;
-
-  /**
-   * <pre>
-   * 字段名:交易状态描述
-   * 变量名:trade_state_desc
-   * 是否必填:是
-   * 类型:string(256)
-   * 描述:交易状态描述
-   * 示例值:支付失败,请重新下单支付
-   * </pre>
-   */
-  @SerializedName(value = "trade_state_desc")
-  private String tradeStateDesc;
-
-  /**
-   * <pre>
-   * 字段名:付款银行
-   * 变量名:bank_type
-   * 是否必填:否
-   * 类型:string(16)
-   * 描述:银行类型,采用字符串类型的银行标识。
-   * 示例值:CMC
-   * </pre>
-   */
-  @SerializedName(value = "bank_type")
-  private String bankType;
-
-  /**
-   * <pre>
-   * 字段名:附加数据
-   * 变量名:attach
-   * 是否必填:否
-   * 类型:string(128)
-   * 描述:附加数据,在查询API和支付通知中原样返回,可作为自定义参数使用
-   * 示例值:自定义数据
-   * </pre>
-   */
-  @SerializedName(value = "attach")
-  private String attach;
-
-  /**
-   * <pre>
-   * 字段名:支付完成时间
-   * 变量名:success_time
-   * 是否必填:否
-   * 类型:string(64)
-   * 描述:支付完成时间,遵循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秒。
-   * 示例值:2018-06-08T10:34:56+08:00
-   * </pre>
-   */
-  @SerializedName(value = "success_time")
-  private String successTime;
-
-  /**
-   * <pre>
-   * 字段名:+支付者
-   * 变量名:combine_payer_info
-   * 是否必填:否
-   * 类型:object
-   * 描述:示例值:见请求示例
-   * </pre>
-   */
-  @SerializedName(value = "combine_payer_info")
-  private CombinePayerInfo combinePayerInfo;
-
-  /**
-   * <pre>
-   * 字段名:订单金额
-   * 变量名:amount
-   * 是否必填:是
-   * 类型:object
-   * 描述:订单金额信息
-   * </pre>
-   */
-  @SerializedName(value = "amount")
-  private Amount amount;
-
-  /**
-   * <pre>
-   * 字段名:场景信息
-   * 变量名:scene_info
-   * 是否必填:否
-   * 类型:object
-   * 描述:支付场景信息描述
-   * </pre>
-   */
-  @SerializedName(value = "scene_info")
-  private SceneInfo sceneInfo;
-
-  /**
-   * <pre>
-   * 字段名:优惠功能
-   * 变量名:promotion_detail
-   * 是否必填:否
-   * 类型:array
-   * 描述:优惠功能,享受优惠时返回该字段。
-   * </pre>
-   */
-  @SerializedName(value = "promotion_detail")
-  private List<PromotionDetail> promotionDetails;
-
-  @Data
-  @NoArgsConstructor
-  public static class SceneInfo implements Serializable {
-    /**
-     * <pre>
-     * 字段名:商户端设备号
-     * 变量名:device_id
-     * 是否必填:否
-     * 类型:string(16)
-     * 描述:
-     *  终端设备号(门店号或收银设备ID)。
-     *  特殊规则:长度最小7个字节
-     *  示例值:POS1:1
-     * </pre>
-     */
-    @SerializedName(value = "device_id")
-    private String deviceId;
-
-  }
-
-  @Data
-  @NoArgsConstructor
-  public static class CombinePayerInfo implements Serializable {
-    /**
-     * <pre>
-     * 字段名:用户标识
-     * 变量名:sp_openid
-     * 是否必填:是
-     * 类型:string(128)
-     * 描述:
-     *  用户在服务商appid下的唯一标识。
-     *  示例值:oUpF8uMuAJO_M2pxb1Q9zNjWeS6o
-     * </pre>
-     */
-    @SerializedName(value = "sp_openid")
-    private String spOpenid;
-
-
-    /**
-     * <pre>
-     * 字段名:二级商户用户标识
-     * 变量名:sub_openid
-     * 是否必填:否
-     * 类型:string(128)
-     * 描述:
-     *  用户在二级商户appid下的唯一标识。
-     *  示例值:oUpF8uMuAJO_M2pxb1Q9zNjWeS6o
-     * </pre>
-     */
-    @SerializedName(value = "sub_openid")
-    private String subOpenid;
-
-  }
-
-  @Data
-  @NoArgsConstructor
-  public static class Amount implements Serializable {
-    /**
-     * <pre>
-     * 字段名:总金额
-     * 变量名:total
-     * 是否必填:否
-     * 类型:int
-     * 描述:
-     *  订单总金额,单位为分
-     *  示例值:100
-     * </pre>
-     */
-    @SerializedName(value = "total")
-    private Integer total;
-
-
-    /**
-     * <pre>
-     * 字段名:用户支付金额
-     * 变量名:payer_total
-     * 是否必填:否
-     * 类型:int
-     * 描述:
-     *  用户支付金额,单位为分。
-     *  示例值:100
-     * </pre>
-     */
-    @SerializedName(value = "payer_total")
-    private Integer payerTotal;
-
-
-    /**
-     * <pre>
-     * 字段名:货币类型
-     * 变量名:currency
-     * 是否必填:否
-     * 类型:string(16)
-     * 描述:
-     *  CNY:人民币,境内商户号仅支持人民币。
-     *  示例值:CNY
-     * </pre>
-     */
-    @SerializedName(value = "currency")
-    private String currency;
-
-
-    /**
-     * <pre>
-     * 字段名:用户支付币种
-     * 变量名:payer_currency
-     * 是否必填:否
-     * 类型:string(8)
-     * 描述:
-     *  用户支付币种
-     *  示例值: CNY
-     * </pre>
-     */
-    @SerializedName(value = "payer_currency")
-    private String payerCurrency;
-  }
-
-  @Data
-  @NoArgsConstructor
-  public static class PromotionDetail implements Serializable {
-
-    /**
-     * <pre>
-     * 字段名:券ID
-     * 变量名:coupon_id
-     * 是否必填:是
-     * 类型:string(32)
-     * 描述: 券ID
-     * 示例值:109519
-     * </pre>
-     */
-    @SerializedName(value = "coupon_id")
-    private String couponId;
-
-    /**
-     * <pre>
-     * 字段名:优惠名称
-     * 变量名:name
-     * 是否必填:否
-     * 类型:string(64)
-     * 描述: 优惠名称
-     * 示例值:单品惠-6
-     * </pre>
-     */
-    @SerializedName(value = "name")
-    private String name;
-    /**
-     * <pre>
-     * 字段名:优惠范围
-     * 变量名:scope
-     * 是否必填:否
-     * 类型:string(32)
-     * 描述: 优惠名称
-     * 示例值:
-     *    GLOBAL:全场代金券
-     *    SINGLE:单品优惠
-     * 示例值:GLOBAL
-     * </pre>
-     */
-    @SerializedName(value = "scope")
-    private String scope;
-
-    /**
-     * <pre>
-     * 字段名:优惠类型
-     * 变量名:type
-     * 是否必填:否
-     * 类型:string(32)
-     * 描述:
-     *    CASH:充值
-     *    NOCASH:预充值
-     * 示例值:CASH
-     * </pre>
-     */
-    @SerializedName(value = "type")
-    private String type;
-
-    /**
-     * <pre>
-     * 字段名:优惠券面额
-     * 变量名:amount
-     * 是否必填:是
-     * 类型:int
-     * 描述: 优惠券面额
-     * 示例值:100
-     * </pre>
-     */
-    @SerializedName(value = "amount")
-    private Integer amount;
-
-    /**
-     * <pre>
-     * 字段名:活动ID
-     * 变量名:stock_id
-     * 是否必填:否
-     * 类型:string(32)
-     * 描述:活动ID
-     * 示例值:931386
-     * </pre>
-     */
-    @SerializedName(value = "stock_id")
-    private String stockId;
-
-    /**
-     * <pre>
-     * 字段名:微信出资
-     * 变量名:wechatpay_contribute
-     * 是否必填:否
-     * 类型:int
-     * 描述:微信出资,单位为分
-     * 示例值:0
-     * </pre>
-     */
-    @SerializedName(value = "wechatpay_contribute")
-    private Integer wechatpayContribute;
-
-    /**
-     * <pre>
-     * 字段名:商户出资
-     * 变量名:merchant_contribute
-     * 是否必填:否
-     * 类型:int
-     * 描述:商户出资,单位为分
-     * 示例值:0
-     * </pre>
-     */
-    @SerializedName(value = "merchant_contribute")
-    private Integer merchantContribute;
-
-    /**
-     * <pre>
-     * 字段名:其他出资
-     * 变量名:other_contribute
-     * 是否必填:否
-     * 类型:int
-     * 描述:其他出资,单位为分
-     * 示例值:0
-     * </pre>
-     */
-    @SerializedName(value = "other_contribute")
-    private Integer otherContribute;
-
-    /**
-     * <pre>
-     * 字段名:优惠币种
-     * 变量名:currency
-     * 是否必填:否
-     * 类型:String(16)
-     * 描述:
-     *    CNY:人民币,境内商户号仅支持人民币。
-     * 示例值:CNY
-     * </pre>
-     */
-    @SerializedName(value = "currency")
-    private String currency;
-
-    /**
-     * <pre>
-     * 字段名:单品列表
-     * 变量名:goods_detail
-     * 是否必填:否
-     * 类型:array
-     * 描述:单品列表信息
-     * </pre>
-     */
-    @SerializedName(value = "goods_detail")
-    private List<GoodsDetail> goodsDetails;
-
-
-  }
-
-  @Data
-  @NoArgsConstructor
-  public static class GoodsDetail implements Serializable {
-
-    /**
-     * <pre>
-     * 字段名:商品编码
-     * 变量名:goods_id
-     * 是否必填:是
-     * 类型:string(32)
-     * 描述:商品编码
-     * 示例值:M1006
-     * </pre>
-     */
-    @SerializedName(value = "goods_id")
-    private String goodsId;
-
-    /**
-     * <pre>
-     * 字段名:商品数量
-     * 变量名:quantity
-     * 是否必填:是
-     * 类型:int64
-     * 描述:
-     *  用户购买的数量
-     * 示例值:1
-     * </pre>
-     */
-    @SerializedName(value = "quantity")
-    private Integer quantity;
-
-    /**
-     * <pre>
-     * 字段名:商品单价
-     * 变量名:unit_price
-     * 是否必填:是
-     * 类型:int64
-     * 描述:
-     *  商品单价,单位为分
-     * 示例值:100
-     * </pre>
-     */
-    @SerializedName(value = "unit_price")
-    private Integer unitPrice;
-
-    /**
-     * <pre>
-     * 字段名:商品优惠金额
-     * 变量名:discount_amount
-     * 是否必填:是
-     * 类型:int
-     * 描述:商品优惠金额
-     * 示例值:0
-     * </pre>
-     */
-    @SerializedName(value = "discount_amount")
-    private Integer discountAmount;
-
-    /**
-     * <pre>
-     * 字段名:商品备注
-     * 变量名:goods_remark
-     * 是否必填:否
-     * 类型:string(128)
-     * 描述:商品备注信息
-     * 示例值:商品备注信息
-     * </pre>
-     */
-    @SerializedName(value = "goods_remark")
-    private String goodsRemark;
-  }
-
+  private PartnerTransactionsResult result;
 }

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

@@ -0,0 +1,69 @@
+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 PartnerTransactionsQueryRequest implements Serializable {
+
+
+  /**
+   * <pre>
+   * 字段名:服务商户号
+   * 变量名:sp_mchid
+   * 是否必填:是
+   * 类型:string(32)
+   * 描述:
+   *  服务商户号,由微信支付生成并下发
+   * 示例值:1230000109
+   * </pre>
+   */
+  @SerializedName(value = "sp_mchid")
+  private String spMchid;
+
+  /**
+   * <pre>
+   * 字段名:二级商户号
+   * 变量名:sub_mchid
+   * 是否必填:是
+   * 类型:string(32)
+   * 描述:
+   *  二级商户的商户号,有微信支付生成并下发。
+   * 示例值:1900000109
+   * </pre>
+   */
+  @SerializedName(value = "sub_mchid")
+  private String subMchid;
+
+  /**
+   * <pre>
+   * 字段名:微信支付订单号
+   * 变量名:transaction_id
+   * 是否必填:是
+   * 类型:string(32)
+   * 描述:
+   *  微信支付系统生成的订单号
+   * 示例值:1217752501201407033233368018
+   * </pre>
+   */
+  @SerializedName(value = "transaction_id")
+  private String transactionId;
+  /**
+   * <pre>
+   * 字段名:商户订单号
+   * 变量名:out_trade_no
+   * 是否必填:是
+   * 类型:string(32)
+   * 描述:
+   *  商户系统内部订单号,只能是数字、大小写字母_-*且在同一个商户号下唯一,详见【商户订单号】。
+   * 特殊规则:最小字符长度为6
+   * 示例值:1217752501201407033233368018
+   * </pre>
+   */
+  @SerializedName(value = "out_trade_no")
+  private String outTradeNo;
+}

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

@@ -0,0 +1,587 @@
+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;
+
+/**
+ * 普通支付 查询结果
+ * <pre>
+ *   文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/e_transactions/chapter3_5.shtml
+ * </pre>
+ */
+@Data
+@NoArgsConstructor
+public class PartnerTransactionsResult implements Serializable {
+
+  /**
+   * <pre>
+   * 字段名:服务商公众号ID
+   * 变量名:sp_appid
+   * 是否必填:是
+   * 类型:string(32)
+   * 描述:
+   *  服务商申请的公众号或移动应用appid。
+   *  示例值:wx8888888888888888
+   * </pre>
+   */
+  @SerializedName(value = "sp_appid")
+  private String spAppid;
+
+  /**
+   * <pre>
+   * 字段名:服务商户号
+   * 变量名:sp_mchid
+   * 是否必填:是
+   * 类型:string(32)
+   * 描述:
+   *  服务商户号,由微信支付生成并下发
+   *  示例值:1230000109
+   * </pre>
+   */
+  @SerializedName(value = "sp_mchid")
+  private String spMchid;
+
+  /**
+   * <pre>
+   * 字段名:二级商户公众号ID
+   * 变量名:sub_appid
+   * 是否必填:否
+   * 类型:string(32)
+   * 描述:
+   *  二级商户申请的公众号或移动应用appid。
+   *  示例值:wxd678efh567hg6999
+   * </pre>
+   */
+  @SerializedName(value = "sub_appid")
+  private String subAppid;
+
+  /**
+   * <pre>
+   * 字段名:二级商户号
+   * 变量名:sub_mchid
+   * 是否必填:是
+   * 类型:string(32)
+   * 描述:
+   *  二级商户的商户号,有微信支付生成并下发。
+   *  示例值:1900000109
+   * </pre>
+   */
+  @SerializedName(value = "sub_mchid")
+  private String subMchid;
+
+  /**
+   * <pre>
+   * 字段名:+商户订单号
+   * 变量名:out_trade_no
+   * 是否必填:是
+   * 类型:string(32)
+   * 描述:商户系统内部订单号,只能是数字、大小写字母_-*且在同一个商户号下唯一,详见【商户订单号】。
+   * 特殊规则:最小字符长度为6
+   * 示例值: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>
+   * 字段名:交易类型
+   * 变量名:trade_type
+   * 是否必填:否
+   * 类型:string(16)
+   * 描述:交易类型,枚举值:
+   *  JSAPI:公众号支付
+   *  NATIVE:扫码支付
+   *  APP:APP支付
+   *  MICROPAY:付款码支付
+   *  MWEB:H5支付
+   *  FACEPAY:刷脸支付
+   *
+   * 示例值: MICROPAY
+   * </pre>
+   */
+  @SerializedName(value = "trade_type")
+  private String tradeType;
+
+  /**
+   * <pre>
+   * 字段名:交易状态
+   * 变量名:trade_state
+   * 是否必填:是
+   * 类型:string(32)
+   * 描述:交易状态,枚举值:
+   *  SUCCESS:支付成功
+   *  REFUND:转入退款
+   *  NOTPAY:未支付
+   *  CLOSED:已关闭
+   *  REVOKED:已撤销(付款码支付)
+   *  USERPAYING:用户支付中(付款码支付)
+   *  PAYERROR:支付失败(其他原因,如银行返回失败)
+   *
+   * 示例值:SUCCESS
+   * </pre>
+   */
+  @SerializedName(value = "trade_state")
+  private String tradeState;
+
+  /**
+   * <pre>
+   * 字段名:交易状态描述
+   * 变量名:trade_state_desc
+   * 是否必填:是
+   * 类型:string(256)
+   * 描述:交易状态描述
+   * 示例值:支付失败,请重新下单支付
+   * </pre>
+   */
+  @SerializedName(value = "trade_state_desc")
+  private String tradeStateDesc;
+
+  /**
+   * <pre>
+   * 字段名:付款银行
+   * 变量名:bank_type
+   * 是否必填:否
+   * 类型:string(16)
+   * 描述:银行类型,采用字符串类型的银行标识。
+   * 示例值:CMC
+   * </pre>
+   */
+  @SerializedName(value = "bank_type")
+  private String bankType;
+
+  /**
+   * <pre>
+   * 字段名:附加数据
+   * 变量名:attach
+   * 是否必填:否
+   * 类型:string(128)
+   * 描述:附加数据,在查询API和支付通知中原样返回,可作为自定义参数使用
+   * 示例值:自定义数据
+   * </pre>
+   */
+  @SerializedName(value = "attach")
+  private String attach;
+
+  /**
+   * <pre>
+   * 字段名:支付完成时间
+   * 变量名:success_time
+   * 是否必填:否
+   * 类型:string(64)
+   * 描述:支付完成时间,遵循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秒。
+   * 示例值:2018-06-08T10:34:56+08:00
+   * </pre>
+   */
+  @SerializedName(value = "success_time")
+  private String successTime;
+
+  /**
+   * <pre>
+   * 字段名:+支付者
+   * 变量名:combine_payer_info
+   * 是否必填:否
+   * 类型:object
+   * 描述:示例值:见请求示例
+   * </pre>
+   */
+  @SerializedName(value = "combine_payer_info")
+  private PartnerTransactionsResult.CombinePayerInfo combinePayerInfo;
+
+  /**
+   * <pre>
+   * 字段名:订单金额
+   * 变量名:amount
+   * 是否必填:是
+   * 类型:object
+   * 描述:订单金额信息
+   * </pre>
+   */
+  @SerializedName(value = "amount")
+  private PartnerTransactionsResult.Amount amount;
+
+  /**
+   * <pre>
+   * 字段名:场景信息
+   * 变量名:scene_info
+   * 是否必填:否
+   * 类型:object
+   * 描述:支付场景信息描述
+   * </pre>
+   */
+  @SerializedName(value = "scene_info")
+  private PartnerTransactionsResult.SceneInfo sceneInfo;
+
+  /**
+   * <pre>
+   * 字段名:优惠功能
+   * 变量名:promotion_detail
+   * 是否必填:否
+   * 类型:array
+   * 描述:优惠功能,享受优惠时返回该字段。
+   * </pre>
+   */
+  @SerializedName(value = "promotion_detail")
+  private List<PartnerTransactionsResult.PromotionDetail> promotionDetails;
+
+  @Data
+  @NoArgsConstructor
+  public static class SceneInfo implements Serializable {
+    /**
+     * <pre>
+     * 字段名:商户端设备号
+     * 变量名:device_id
+     * 是否必填:否
+     * 类型:string(16)
+     * 描述:
+     *  终端设备号(门店号或收银设备ID)。
+     *  特殊规则:长度最小7个字节
+     *  示例值:POS1:1
+     * </pre>
+     */
+    @SerializedName(value = "device_id")
+    private String deviceId;
+
+  }
+
+  @Data
+  @NoArgsConstructor
+  public static class CombinePayerInfo implements Serializable {
+    /**
+     * <pre>
+     * 字段名:用户标识
+     * 变量名:sp_openid
+     * 是否必填:是
+     * 类型:string(128)
+     * 描述:
+     *  用户在服务商appid下的唯一标识。
+     *  示例值:oUpF8uMuAJO_M2pxb1Q9zNjWeS6o
+     * </pre>
+     */
+    @SerializedName(value = "sp_openid")
+    private String spOpenid;
+
+
+    /**
+     * <pre>
+     * 字段名:二级商户用户标识
+     * 变量名:sub_openid
+     * 是否必填:否
+     * 类型:string(128)
+     * 描述:
+     *  用户在二级商户appid下的唯一标识。
+     *  示例值:oUpF8uMuAJO_M2pxb1Q9zNjWeS6o
+     * </pre>
+     */
+    @SerializedName(value = "sub_openid")
+    private String subOpenid;
+
+  }
+
+  @Data
+  @NoArgsConstructor
+  public static class Amount implements Serializable {
+    /**
+     * <pre>
+     * 字段名:总金额
+     * 变量名:total
+     * 是否必填:否
+     * 类型:int
+     * 描述:
+     *  订单总金额,单位为分
+     *  示例值:100
+     * </pre>
+     */
+    @SerializedName(value = "total")
+    private Integer total;
+
+
+    /**
+     * <pre>
+     * 字段名:用户支付金额
+     * 变量名:payer_total
+     * 是否必填:否
+     * 类型:int
+     * 描述:
+     *  用户支付金额,单位为分。
+     *  示例值:100
+     * </pre>
+     */
+    @SerializedName(value = "payer_total")
+    private Integer payerTotal;
+
+
+    /**
+     * <pre>
+     * 字段名:货币类型
+     * 变量名:currency
+     * 是否必填:否
+     * 类型:string(16)
+     * 描述:
+     *  CNY:人民币,境内商户号仅支持人民币。
+     *  示例值:CNY
+     * </pre>
+     */
+    @SerializedName(value = "currency")
+    private String currency;
+
+
+    /**
+     * <pre>
+     * 字段名:用户支付币种
+     * 变量名:payer_currency
+     * 是否必填:否
+     * 类型:string(8)
+     * 描述:
+     *  用户支付币种
+     *  示例值: CNY
+     * </pre>
+     */
+    @SerializedName(value = "payer_currency")
+    private String payerCurrency;
+  }
+
+  @Data
+  @NoArgsConstructor
+  public static class PromotionDetail implements Serializable {
+
+    /**
+     * <pre>
+     * 字段名:券ID
+     * 变量名:coupon_id
+     * 是否必填:是
+     * 类型:string(32)
+     * 描述: 券ID
+     * 示例值:109519
+     * </pre>
+     */
+    @SerializedName(value = "coupon_id")
+    private String couponId;
+
+    /**
+     * <pre>
+     * 字段名:优惠名称
+     * 变量名:name
+     * 是否必填:否
+     * 类型:string(64)
+     * 描述: 优惠名称
+     * 示例值:单品惠-6
+     * </pre>
+     */
+    @SerializedName(value = "name")
+    private String name;
+    /**
+     * <pre>
+     * 字段名:优惠范围
+     * 变量名:scope
+     * 是否必填:否
+     * 类型:string(32)
+     * 描述: 优惠名称
+     * 示例值:
+     *    GLOBAL:全场代金券
+     *    SINGLE:单品优惠
+     * 示例值:GLOBAL
+     * </pre>
+     */
+    @SerializedName(value = "scope")
+    private String scope;
+
+    /**
+     * <pre>
+     * 字段名:优惠类型
+     * 变量名:type
+     * 是否必填:否
+     * 类型:string(32)
+     * 描述:
+     *    CASH:充值
+     *    NOCASH:预充值
+     * 示例值:CASH
+     * </pre>
+     */
+    @SerializedName(value = "type")
+    private String type;
+
+    /**
+     * <pre>
+     * 字段名:优惠券面额
+     * 变量名:amount
+     * 是否必填:是
+     * 类型:int
+     * 描述: 优惠券面额
+     * 示例值:100
+     * </pre>
+     */
+    @SerializedName(value = "amount")
+    private Integer amount;
+
+    /**
+     * <pre>
+     * 字段名:活动ID
+     * 变量名:stock_id
+     * 是否必填:否
+     * 类型:string(32)
+     * 描述:活动ID
+     * 示例值:931386
+     * </pre>
+     */
+    @SerializedName(value = "stock_id")
+    private String stockId;
+
+    /**
+     * <pre>
+     * 字段名:微信出资
+     * 变量名:wechatpay_contribute
+     * 是否必填:否
+     * 类型:int
+     * 描述:微信出资,单位为分
+     * 示例值:0
+     * </pre>
+     */
+    @SerializedName(value = "wechatpay_contribute")
+    private Integer wechatpayContribute;
+
+    /**
+     * <pre>
+     * 字段名:商户出资
+     * 变量名:merchant_contribute
+     * 是否必填:否
+     * 类型:int
+     * 描述:商户出资,单位为分
+     * 示例值:0
+     * </pre>
+     */
+    @SerializedName(value = "merchant_contribute")
+    private Integer merchantContribute;
+
+    /**
+     * <pre>
+     * 字段名:其他出资
+     * 变量名:other_contribute
+     * 是否必填:否
+     * 类型:int
+     * 描述:其他出资,单位为分
+     * 示例值:0
+     * </pre>
+     */
+    @SerializedName(value = "other_contribute")
+    private Integer otherContribute;
+
+    /**
+     * <pre>
+     * 字段名:优惠币种
+     * 变量名:currency
+     * 是否必填:否
+     * 类型:String(16)
+     * 描述:
+     *    CNY:人民币,境内商户号仅支持人民币。
+     * 示例值:CNY
+     * </pre>
+     */
+    @SerializedName(value = "currency")
+    private String currency;
+
+    /**
+     * <pre>
+     * 字段名:单品列表
+     * 变量名:goods_detail
+     * 是否必填:否
+     * 类型:array
+     * 描述:单品列表信息
+     * </pre>
+     */
+    @SerializedName(value = "goods_detail")
+    private List<PartnerTransactionsResult.GoodsDetail> goodsDetails;
+
+
+  }
+
+  @Data
+  @NoArgsConstructor
+  public static class GoodsDetail implements Serializable {
+
+    /**
+     * <pre>
+     * 字段名:商品编码
+     * 变量名:goods_id
+     * 是否必填:是
+     * 类型:string(32)
+     * 描述:商品编码
+     * 示例值:M1006
+     * </pre>
+     */
+    @SerializedName(value = "goods_id")
+    private String goodsId;
+
+    /**
+     * <pre>
+     * 字段名:商品数量
+     * 变量名:quantity
+     * 是否必填:是
+     * 类型:int64
+     * 描述:
+     *  用户购买的数量
+     * 示例值:1
+     * </pre>
+     */
+    @SerializedName(value = "quantity")
+    private Integer quantity;
+
+    /**
+     * <pre>
+     * 字段名:商品单价
+     * 变量名:unit_price
+     * 是否必填:是
+     * 类型:int64
+     * 描述:
+     *  商品单价,单位为分
+     * 示例值:100
+     * </pre>
+     */
+    @SerializedName(value = "unit_price")
+    private Integer unitPrice;
+
+    /**
+     * <pre>
+     * 字段名:商品优惠金额
+     * 变量名:discount_amount
+     * 是否必填:是
+     * 类型:int
+     * 描述:商品优惠金额
+     * 示例值:0
+     * </pre>
+     */
+    @SerializedName(value = "discount_amount")
+    private Integer discountAmount;
+
+    /**
+     * <pre>
+     * 字段名:商品备注
+     * 变量名:goods_remark
+     * 是否必填:否
+     * 类型:string(128)
+     * 描述:商品备注信息
+     * 示例值:商品备注信息
+     * </pre>
+     */
+    @SerializedName(value = "goods_remark")
+    private String goodsRemark;
+  }
+
+}

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

@@ -0,0 +1,91 @@
+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/fund/chapter3_5.shtml
+ * </pre>
+ */
+@Data
+@NoArgsConstructor
+public class SpWithdrawRequest implements Serializable {
+  /**
+   * <pre>
+   * 字段名:商户提现单号
+   * 变量名:out_request_no
+   * 是否必填:是
+   * 类型:string(32)
+   * 描述:
+   *  商户提现单号,由商户自定义生成。
+   * 示例值:20190611222222222200000000012122
+   * </pre>
+   */
+  @SerializedName(value = "out_request_no")
+  private String outRequestNo;
+
+  /**
+   * <pre>
+   * 字段名:提现金额
+   * 变量名:amount
+   * 是否必填:是
+   * 类型:int64
+   * 描述:
+   *  提现金额,单位:分(RMB)
+   * 示例值:1
+   * </pre>
+   */
+  @SerializedName(value = "amount")
+  private Integer amount;
+
+  /**
+   * <pre>
+   * 字段名:备注
+   * 变量名:remark
+   * 是否必填:否
+   * 类型:string(56)
+   * 描述:
+   *  商户对提现单的备注
+   * 示例值:交易提现
+   * </pre>
+   */
+  @SerializedName(value = "remark")
+  private String remark;
+
+  /**
+   * <pre>
+   * 字段名:银行附言
+   * 变量名:bank_memo
+   * 是否必填:否
+   * 类型:string(32)
+   * 描述:
+   *  展示在收款银行系统中的附言,数字、字母最长32个汉字(能否成功展示依赖银行系统支持)。
+   * 示例值:xx平台提现
+   * </pre>
+   */
+  @SerializedName(value = "bank_memo")
+  private String bankMemo;
+
+  /**
+   * <pre>
+   * 字段名:账户类型
+   * 变量名:account_type
+   * 是否必填:是
+   * 类型:string(16)
+   * 描述:
+   *  枚举值:
+   *    BASIC:基本账户
+   *    OPERATION:运营账户
+   *    FEES:手续费账户
+   * 示例值:BASIC
+   * </pre>
+   */
+  @SerializedName(value = "account_type")
+  private String accountType;
+
+}

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

@@ -0,0 +1,46 @@
+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/fund/chapter3_5.shtml
+ * </pre>
+ */
+@Data
+@NoArgsConstructor
+public class SpWithdrawResult implements Serializable {
+
+  /**
+   * <pre>
+   * 字段名:微信支付提现单号
+   * 变量名:withdraw_id
+   * 是否必填:否 (文档里面是【否】,理论上应该都有值)
+   * 类型:string(128)
+   * 描述:
+   *  微信支付系统生成的提现单号。
+   * 示例值:12321937198237912739132791732912793127931279317929791239112123
+   * </pre>
+   */
+  @SerializedName(value = "withdraw_id")
+  private String withdrawId;
+
+  /**
+   * <pre>
+   * 字段名:商户提现单号
+   * 变量名:out_request_no
+   * 是否必填:是
+   * 类型:string(32)
+   * 描述:
+   *  必须是字母数字
+   * 示例值: 20190611222222222200000000012122
+   * </pre>
+   */
+  @SerializedName(value = "out_request_no")
+  private String outRequestNo;
+}

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

@@ -0,0 +1,89 @@
+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/pay/combine/chapter3_3.shtml
+ * </pre>
+ */
+@Data
+@NoArgsConstructor
+public class SubWithdrawRequest implements Serializable {
+
+  /**
+   * <pre>
+   * 字段名:二级商户号
+   * 变量名:sub_mchid
+   * 是否必填:是
+   * 类型:string(32)
+   * 描述:
+   *  电商平台二级商户号,由微信支付生成并下发。
+   * 示例值:1900000109
+   * </pre>
+   */
+  @SerializedName(value = "sub_mchid")
+  private String subMchid;
+
+  /**
+   * <pre>
+   * 字段名:商户提现单号
+   * 变量名:out_request_no
+   * 是否必填:是
+   * 类型:string(32)
+   * 描述:
+   *  必须是字母数字
+   * 示例值: 20190611222222222200000000012122
+   * </pre>
+   */
+  @SerializedName(value = "out_request_no")
+  private String outRequestNo;
+
+  /**
+   * <pre>
+   * 字段名:提现金额
+   * 变量名:amount
+   * 是否必填:是
+   * 类型:int64
+   * 描述:
+   *  提现金额(单位:分)
+   * 示例值:100
+   * </pre>
+   */
+  @SerializedName(value = "amount")
+  private Integer amount;
+
+  /**
+   * <pre>
+   * 字段名:备注
+   * 变量名:remark
+   * 是否必填:否
+   * 类型:string(56)
+   * 描述:
+   *  商户对提现单的备注
+   * 示例值:交易提现
+   * </pre>
+   */
+  @SerializedName(value = "remark")
+  private String remark;
+
+  /**
+   * <pre>
+   * 字段名:银行附言
+   * 变量名:bank_memo
+   * 是否必填:否
+   * 类型:string(32)
+   * 描述:
+   *  展示在收款银行系统中的附言,数字、字母最长32个汉字(能否成功展示依赖银行系统支持)。
+   * 示例值:微信支付提现
+   * </pre>
+   */
+  @SerializedName(value = "bank_memo")
+  private String bankMemo;
+
+}

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

@@ -0,0 +1,60 @@
+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/fund/chapter3_2.shtml
+ * </pre>
+ */
+@Data
+@NoArgsConstructor
+public class SubWithdrawResult implements Serializable {
+
+  /**
+   * <pre>
+   * 字段名:二级商户号
+   * 变量名:sub_mchid
+   * 是否必填:是
+   * 类型:string(32)
+   * 描述:
+   *  电商平台二级商户号,由微信支付生成并下发。
+   * 示例值:1900000109
+   * </pre>
+   */
+  @SerializedName(value = "sub_mchid")
+  private String subMchid;
+
+  /**
+   * <pre>
+   * 字段名:微信支付提现单号
+   * 变量名:withdraw_id
+   * 是否必填:是
+   * 类型:string(128)
+   * 描述:
+   *  电商平台提交二级商户提现申请后,由微信支付返回的申请单号,作为查询申请状态的唯一标识。
+   * 示例值: 12321937198237912739132791732912793127931279317929791239112123
+   * </pre>
+   */
+  @SerializedName(value = "withdraw_id")
+  private String withdrawId;
+
+  /**
+   * <pre>
+   * 字段名:商户提现单号
+   * 变量名:out_request_no
+   * 是否必填:否
+   * 类型:string(32)
+   * 描述:
+   *  必须是字母数字
+   * 示例值: 20190611222222222200000000012122
+   * </pre>
+   */
+  @SerializedName(value = "out_request_no")
+  private String outRequestNo;
+}

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

@@ -99,6 +99,18 @@ public interface EcommerceService {
 
   /**
    * <pre>
+   * 合单查询订单API
+   * 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/combine/chapter3_3.shtml
+   * </pre>
+   *
+   * @param outTradeNo 合单商户订单号
+   * @return 支付订单信息
+   * @throws WxPayException the wx pay exception
+   */
+  CombineTransactionsResult queryCombineTransactions(String outTradeNo) throws WxPayException;
+
+  /**
+   * <pre>
    *  服务商模式普通支付API(APP支付、JSAPI支付、H5支付、NATIVE支付).
    *  请求URL:https://api.mch.weixin.qq.com/v3/pay/partner/transactions/jsapi
    *  文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pages/transactions_sl.shtml
@@ -141,6 +153,18 @@ public interface EcommerceService {
 
   /**
    * <pre>
+   * 普通查询订单API
+   * 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/e_transactions/chapter3_5.shtml
+   * </pre>
+   *
+   * @param request 商户订单信息
+   * @return 支付订单信息
+   * @throws WxPayException the wx pay exception
+   */
+  PartnerTransactionsResult queryPartnerTransactions(PartnerTransactionsQueryRequest request) throws WxPayException;
+
+  /**
+   * <pre>
    * 服务商账户实时余额
    * 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pages/amount.shtml
    * </pre>
@@ -237,4 +261,27 @@ public interface EcommerceService {
    */
   RefundsResult refunds(RefundsRequest request) throws WxPayException;
 
+  /**
+   * <pre>
+   * 二级商户账户余额提现API
+   * 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/fund/chapter3_2.shtml
+   * </pre>
+   *
+   * @param request 提现请求
+   * @return 返回数据 return withdraw result
+   * @throws WxPayException the wx pay exception
+   */
+  SubWithdrawResult subWithdraw(SubWithdrawRequest request) throws WxPayException;
+
+  /**
+   * <pre>
+   * 电商平台提现API
+   * 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/fund/chapter3_5.shtml
+   * </pre>
+   *
+   * @param request 提现请求
+   * @return 返回数据 return withdraw result
+   * @throws WxPayException the wx pay exception
+   */
+  SpWithdrawResult spWithdraw(SpWithdrawRequest request) throws WxPayException;
 }

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

@@ -20,6 +20,7 @@ import java.util.Objects;
 
 @RequiredArgsConstructor
 public class EcommerceServiceImpl implements EcommerceService {
+
   private static final Gson GSON = new GsonBuilder().create();
   private final WxPayService payService;
 
@@ -73,8 +74,11 @@ public class EcommerceServiceImpl implements EcommerceService {
     String apiV3Key = this.payService.getConfig().getApiV3Key();
     try {
       String result = AesUtils.decryptToString(associatedData, nonce,cipherText, apiV3Key);
-      CombineTransactionsNotifyResult notifyResult = GSON.fromJson(result, CombineTransactionsNotifyResult.class);
+      CombineTransactionsResult transactionsResult = GSON.fromJson(result, CombineTransactionsResult.class);
+
+      CombineTransactionsNotifyResult notifyResult = new CombineTransactionsNotifyResult();
       notifyResult.setRawData(response);
+      notifyResult.setResult(transactionsResult);
       return notifyResult;
     } catch (GeneralSecurityException | IOException e) {
       throw new WxPayException("解析报文异常!", e);
@@ -82,6 +86,13 @@ public class EcommerceServiceImpl implements EcommerceService {
   }
 
   @Override
+  public CombineTransactionsResult queryCombineTransactions(String outTradeNo) throws WxPayException {
+    String url = String.format("%s/v3/combine-transactions/out-trade-no/%s", this.payService.getPayBaseUrl(), outTradeNo);
+    String response = this.payService.getV3(URI.create(url));
+    return GSON.fromJson(response, CombineTransactionsResult.class);
+  }
+
+  @Override
   public TransactionsResult partner(TradeTypeEnum tradeType, PartnerTransactionsRequest request) throws WxPayException {
     String url = this.payService.getPayBaseUrl() + tradeType.getPartnerUrl();
     String response = this.payService.postV3(url, GSON.toJson(request));
@@ -108,8 +119,11 @@ public class EcommerceServiceImpl implements EcommerceService {
     String apiV3Key = this.payService.getConfig().getApiV3Key();
     try {
       String result = AesUtils.decryptToString(associatedData, nonce,cipherText, apiV3Key);
-      PartnerTransactionsNotifyResult notifyResult = GSON.fromJson(result, PartnerTransactionsNotifyResult.class);
+      PartnerTransactionsResult transactionsResult = GSON.fromJson(result, PartnerTransactionsResult.class);
+
+      PartnerTransactionsNotifyResult notifyResult = new PartnerTransactionsNotifyResult();
       notifyResult.setRawData(response);
+      notifyResult.setResult(transactionsResult);
       return notifyResult;
     } catch (GeneralSecurityException | IOException e) {
       throw new WxPayException("解析报文异常!", e);
@@ -117,6 +131,18 @@ public class EcommerceServiceImpl implements EcommerceService {
   }
 
   @Override
+  public PartnerTransactionsResult queryPartnerTransactions(PartnerTransactionsQueryRequest request) throws WxPayException {
+    String url = String.format("%s/v3/pay/partner/transactions/out-trade-no/%s", this.payService.getPayBaseUrl(), request.getOutTradeNo());
+    if (Objects.isNull(request.getOutTradeNo())) {
+      url = String.format("%s/v3/pay/partner/transactions/id/%s", this.payService.getPayBaseUrl(), request.getTransactionId());
+    }
+    String query = String.format("?sp_mchid=%s&sub_mchid=%s", request.getSpMchid(), request.getSubMchid());
+    URI uri = URI.create(url + query);
+    String response = this.payService.getV3(uri);
+    return GSON.fromJson(response, PartnerTransactionsResult.class);
+  }
+
+  @Override
   public FundBalanceResult spNowBalance(SpAccountTypeEnum accountType) throws WxPayException {
     String url = String.format("%s/v3/merchant/fund/balance/%s", this.payService.getPayBaseUrl(), accountType);
     URI uri = URI.create(url);
@@ -176,6 +202,26 @@ public class EcommerceServiceImpl implements EcommerceService {
     return GSON.fromJson(response, RefundsResult.class);
   }
 
+  @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));
+    return GSON.fromJson(response, SubWithdrawResult.class);
+  }
+
+  @Override
+  public SpWithdrawResult spWithdraw(SpWithdrawRequest request) throws WxPayException {
+    String url = String.format("%s/v3/merchant/fund/withdraw", this.payService.getPayBaseUrl());
+    String response = this.payService.postV3(url, GSON.toJson(request));
+    return GSON.fromJson(response, SpWithdrawResult.class);
+  }
+
+  /**
+   * 校验通知签名
+   * @param header 通知头信息
+   * @param data 通知数据
+   * @return true:校验通过 false:校验不通过
+   */
   private boolean verifyNotifySign(SignatureHeader header, String data) {
     String beforeSign = String.format("%s\n%s\n%s\n",
       header.getTimeStamp(),

+ 78 - 0
weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/impl/EcommerceServiceImplTest.java

@@ -0,0 +1,78 @@
+package com.github.binarywang.wxpay.service.impl;
+
+import com.github.binarywang.wxpay.bean.ecommerce.PartnerTransactionsQueryRequest;
+import com.github.binarywang.wxpay.bean.ecommerce.PartnerTransactionsResult;
+import com.github.binarywang.wxpay.bean.ecommerce.SignatureHeader;
+import com.github.binarywang.wxpay.exception.WxPayException;
+import com.github.binarywang.wxpay.service.WxPayService;
+import com.github.binarywang.wxpay.testbase.ApiTestModule;
+import com.google.inject.Inject;
+import lombok.extern.slf4j.Slf4j;
+import org.testng.annotations.Guice;
+import org.testng.annotations.Test;
+
+import java.nio.charset.StandardCharsets;
+
+@Slf4j
+@Test
+@Guice(modules = ApiTestModule.class)
+public class EcommerceServiceImplTest {
+
+  @Inject
+  private  WxPayService wxPayService;
+
+  @Test
+  public void testNotifySign(){
+    //通知报文主体
+    String notifyData = "";
+    //请求头  Wechatpay-Timestamp
+    String timeStamp = "";
+    //请求头  Wechatpay-Nonce
+    String nonce = "";
+    //请求头  Wechatpay-Signature
+    String signed = "";
+    //请求头  Wechatpay-Serial
+    String serialNo = "";
+
+    SignatureHeader header = new SignatureHeader();
+    header.setNonce(nonce);
+    header.setSerialNo(serialNo);
+    header.setTimeStamp(timeStamp);
+    header.setSigned(signed);
+
+    String beforeSign = String.format("%s\n%s\n%s\n",
+      header.getTimeStamp(),
+      header.getNonce(),
+      notifyData);
+    boolean signResult = wxPayService.getConfig().getVerifier().verify(header.getSerialNo(),
+      beforeSign.getBytes(StandardCharsets.UTF_8), header.getSigned());
+    log.info("签名结果:{} \nheader:{} \ndata:{}", signResult, header, notifyData);
+  }
+
+  @Test
+  public void testQueryPartnerTransactions() throws WxPayException {
+    PartnerTransactionsQueryRequest request = new PartnerTransactionsQueryRequest();
+    //服务商商户号
+    request.setSpMchid("");
+    //二级商户号
+    request.setSubMchid("");
+    //商户订单号
+    request.setOutTradeNo("");
+    //微信订单号
+    request.setTransactionId("");
+    wxPayService.getEcommerceService().queryPartnerTransactions(request);
+  }
+
+  @Test
+  public void testSubNowBalance() throws WxPayException {
+    String subMchid = "";
+    wxPayService.getEcommerceService().subNowBalance(subMchid);
+  }
+
+  @Test
+  public void testSubDayEndBalance() throws WxPayException {
+    String subMchid = "";
+    String date = "";
+    wxPayService.getEcommerceService().subDayEndBalance(subMchid,date);
+  }
+}