diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/ecommerce/CombineTransactionsNotifyResult.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/ecommerce/CombineTransactionsNotifyResult.java index 0f0196a8c..dcfae8824 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/ecommerce/CombineTransactionsNotifyResult.java +++ b/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; /** - *
- * 字段名:合单商户appid - * 变量名:combine_appid - * 是否必填:是 - * 类型:string(32) - * 描述: - * 合单发起方的appid。(即电商平台appid) - * 示例值:wxd678efh567hg6787 - *- */ - @SerializedName(value = "combine_appid") - private String combineAppid; - - /** - *
- * 字段名:合单商户号 - * 变量名:combine_mchid - * 是否必填:是 - * 类型:string(32) - * 描述: - * 合单发起方商户号。(即电商平台mchid) - * 示例值:1900000109 - *- */ - @SerializedName(value = "combine_mchid") - private String combineMchid; - - /** - *
- * 字段名:合单商户订单号 - * 变量名:combine_out_trade_no - * 是否必填:是 - * 类型:string(32) - * 描述: - * 合单支付总订单号,要求32个字符内,只能是数字、大小写字母_-|*@ ,且在同一个商户号下唯一。 - * 示例值:P20150806125346 - *- */ - @SerializedName(value = "combine_out_trade_no") - private String combineOutTradeNo; - - /** - *
- * 字段名:+场景信息 - * 变量名:scene_info - * 是否必填:否 - * 类型:object - * 描述:支付场景信息描述 - *- */ - @SerializedName(value = "scene_info") - private SceneInfo sceneInfo; - - /** - *
- * 字段名:+子单信息 - * 变量名:sub_orders - * 是否必填:是 - * 类型:array - * 描述: - * 最多支持子单条数:50 - * - *- */ - @SerializedName(value = "sub_orders") - private List
- * 字段名:+支付者 - * 变量名:combine_payer_info - * 是否必填:否 - * 类型:object - * 描述:示例值:见请求示例 - *- */ - @SerializedName(value = "combine_payer_info") - private CombinePayerInfo combinePayerInfo; - - @Data - @NoArgsConstructor - public static class SubOrders implements Serializable { - /** - *
- * 字段名:子单商户号 - * 变量名:mchid - * 是否必填:是 - * 类型:string(32) - * 描述: - * 子单发起方商户号,必须与发起方Appid有绑定关系。(即电商平台mchid) - * 示例值:1900000109 - *- */ - @SerializedName(value = "mchid") - private String mchid; - - /** - *
- * 字段名:交易类型 - * 变量名:trade_type - * 是否必填:是 - * 类型:string (16) - * 描述: - * 枚举值: - * NATIVE:扫码支付 - * JSAPI:公众号支付 - * APP:APP支付 - * MWEB:H5支付 - * 示例值: JSAPI - *- */ - @SerializedName(value = "trade_type") - private String tradeType; - - /** - *
- * 字段名:交易状态 - * 变量名:trade_state - * 是否必填:是 - * 类型:string (32) - * 描述: - * 枚举值: - * SUCCESS:支付成功 - * REFUND:转入退款 - * NOTPAY:未支付 - * CLOSED:已关闭 - * USERPAYING:用户支付中 - * PAYERROR:支付失败(其他原因,如银行返回失败) - * 示例值: SUCCESS - *- */ - @SerializedName(value = "trade_state") - private String tradeState; - - /** - *
- * 字段名:付款银行 - * 变量名:bank_type - * 是否必填:否 - * 类型:string(16) - * 描述: - * 银行类型,采用字符串类型的银行标识。 - * 示例值:CMC - *- */ - @SerializedName(value = "bank_type") - private String bankType; - - /** - *
- * 字段名:附加信息 - * 变量名:attach - * 是否必填:是 - * 类型:string(128) - * 描述: - * 附加数据,在查询API和支付通知中原样返回,可作为自定义参数使用。 - * 示例值:深圳分店 - *- */ - @SerializedName(value = "attach") - private String attach; - - /** - *
- * 字段名:支付完成时间 - * 变量名: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 - *- */ - @SerializedName(value = "success_time") - private String successTime; - - /** - *
- * 字段名:微信订单号 - * 变量名:transaction_id - * 是否必填:是 - * 类型:string(32) - * 描述: - * 微信支付订单号。 - * 示例值: 1009660380201506130728806387 - *- */ - @SerializedName(value = "transaction_id") - private String transactionId; - - /** - *
- * 字段名:子单商户订单号 - * 变量名:out_trade_no - * 是否必填:是 - * 类型:string(32) - * 描述: - * 商户系统内部订单号,要求32个字符内,只能是数字、大小写字母_-|*@ ,且在同一个商户号下唯一。 - * 特殊规则:最小字符长度为6 - * 示例值:20150806125346 - *- */ - @SerializedName(value = "out_trade_no") - private String outTradeNo; - - /** - *
- * 字段名:二级商户号 - * 变量名:sub_mchid - * 是否必填:是 - * 类型:string(32) - * 描述: - * 二级商户商户号,由微信支付生成并下发。 - * 注意:仅适用于电商平台 服务商 - * 示例值:1900000109 - *- */ - @SerializedName(value = "sub_mchid") - private String subMchid; - - /** - *
- * 字段名:+订单金额 - * 变量名:amount - * 是否必填:是 - * 类型:object - * 描述:订单金额信息 - *- */ - @SerializedName(value = "amount") - private Amount amount; - - } - - @Data - @NoArgsConstructor - public static class SceneInfo implements Serializable { - /** - *
- * 字段名:商户端设备号 - * 变量名:device_id - * 是否必填:否 - * 类型:string(16) - * 描述: - * 终端设备号(门店号或收银设备ID)。 - * 特殊规则:长度最小7个字节 - * 示例值:POS1:1 - *- */ - @SerializedName(value = "device_id") - private String deviceId; - - } - - @Data - @NoArgsConstructor - public static class CombinePayerInfo implements Serializable { - /** - *
- * 字段名:用户标识 - * 变量名:openid - * 是否必填:是 - * 类型:string(128) - * 描述: - * 使用合单appid获取的对应用户openid。是用户在商户appid下的唯一标识。 - * 示例值:oUpF8uMuAJO_M2pxb1Q9zNjWeS6o - *- */ - @SerializedName(value = "openid") - private String openid; - - } - - @Data - @NoArgsConstructor - public static class Amount implements Serializable { - /** - *
- * 字段名:标价金额 - * 变量名:total_amount - * 是否必填:是 - * 类型:int64 - * 描述: - * 子单金额,单位为分。 - * 示例值:100 - *- */ - @SerializedName(value = "total_amount") - private Integer totalAmount; - - /** - *
- * 字段名:标价币种 - * 变量名:currency - * 是否必填:是 - * 类型:string(8) - * 描述: - * 符合ISO 4217标准的三位字母代码,人民币:CNY。 - * 示例值:CNY - *- */ - @SerializedName(value = "currency") - private String currency; - - /** - *
- * 字段名:现金支付金额 - * 变量名:payer_amount - * 是否必填:是 - * 类型:int64 - * 描述: - * 订单现金支付金额。 - * 示例值:10 - *- */ - @SerializedName(value = "payer_amount") - private Integer payerAmount; - - /** - *
- * 字段名:现金支付币种 - * 变量名:payer_currency - * 是否必填:是 - * 类型:string(8) - * 描述: - * 货币类型,符合ISO 4217标准的三位字母代码,默认人民币:CNY。 - * 示例值: CNY - *- */ - @SerializedName(value = "payer_currency") - private String payerCurrency; - } + * 解密后的数据 + */ + private CombineTransactionsResult result; } diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/ecommerce/CombineTransactionsResult.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/ecommerce/CombineTransactionsResult.java new file mode 100644 index 000000000..890df9acf --- /dev/null +++ b/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; + +/** + * 合单支付 查询结果 + *
+ * 文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/combine/chapter3_3.shtml + *+ */ +@Data +@NoArgsConstructor +public class CombineTransactionsResult implements Serializable { + + /** + *
+ * 字段名:合单商户appid + * 变量名:combine_appid + * 是否必填:是 + * 类型:string(32) + * 描述: + * 合单发起方的appid。(即电商平台appid) + * 示例值:wxd678efh567hg6787 + *+ */ + @SerializedName(value = "combine_appid") + private String combineAppid; + + /** + *
+ * 字段名:合单商户号 + * 变量名:combine_mchid + * 是否必填:是 + * 类型:string(32) + * 描述: + * 合单发起方商户号。(即电商平台mchid) + * 示例值:1900000109 + *+ */ + @SerializedName(value = "combine_mchid") + private String combineMchid; + + /** + *
+ * 字段名:合单商户订单号 + * 变量名:combine_out_trade_no + * 是否必填:是 + * 类型:string(32) + * 描述: + * 合单支付总订单号,要求32个字符内,只能是数字、大小写字母_-|*@ ,且在同一个商户号下唯一。 + * 示例值:P20150806125346 + *+ */ + @SerializedName(value = "combine_out_trade_no") + private String combineOutTradeNo; + + /** + *
+ * 字段名:+场景信息 + * 变量名:scene_info + * 是否必填:否 + * 类型:object + * 描述:支付场景信息描述 + *+ */ + @SerializedName(value = "scene_info") + private CombineTransactionsResult.SceneInfo sceneInfo; + + /** + *
+ * 字段名:+子单信息 + * 变量名:sub_orders + * 是否必填:是 + * 类型:array + * 描述: + * 最多支持子单条数:50 + * + *+ */ + @SerializedName(value = "sub_orders") + private List
+ * 字段名:+支付者 + * 变量名:combine_payer_info + * 是否必填:否 + * 类型:object + * 描述:示例值:见请求示例 + *+ */ + @SerializedName(value = "combine_payer_info") + private CombineTransactionsResult.CombinePayerInfo combinePayerInfo; + + @Data + @NoArgsConstructor + public static class SubOrders implements Serializable { + /** + *
+ * 字段名:子单商户号 + * 变量名:mchid + * 是否必填:是 + * 类型:string(32) + * 描述: + * 子单发起方商户号,必须与发起方Appid有绑定关系。(即电商平台mchid) + * 示例值:1900000109 + *+ */ + @SerializedName(value = "mchid") + private String mchid; + + /** + *
+ * 字段名:交易类型 + * 变量名:trade_type + * 是否必填:是 + * 类型:string (16) + * 描述: + * 枚举值: + * NATIVE:扫码支付 + * JSAPI:公众号支付 + * APP:APP支付 + * MWEB:H5支付 + * 示例值: JSAPI + *+ */ + @SerializedName(value = "trade_type") + private String tradeType; + + /** + *
+ * 字段名:交易状态 + * 变量名:trade_state + * 是否必填:是 + * 类型:string (32) + * 描述: + * 枚举值: + * SUCCESS:支付成功 + * REFUND:转入退款 + * NOTPAY:未支付 + * CLOSED:已关闭 + * USERPAYING:用户支付中 + * PAYERROR:支付失败(其他原因,如银行返回失败) + * 示例值: SUCCESS + *+ */ + @SerializedName(value = "trade_state") + private String tradeState; + + /** + *
+ * 字段名:付款银行 + * 变量名:bank_type + * 是否必填:否 + * 类型:string(16) + * 描述: + * 银行类型,采用字符串类型的银行标识。 + * 示例值:CMC + *+ */ + @SerializedName(value = "bank_type") + private String bankType; + + /** + *
+ * 字段名:附加信息 + * 变量名:attach + * 是否必填:是 + * 类型:string(128) + * 描述: + * 附加数据,在查询API和支付通知中原样返回,可作为自定义参数使用。 + * 示例值:深圳分店 + *+ */ + @SerializedName(value = "attach") + private String attach; + + /** + *
+ * 字段名:支付完成时间 + * 变量名: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 + *+ */ + @SerializedName(value = "success_time") + private String successTime; + + /** + *
+ * 字段名:微信订单号 + * 变量名:transaction_id + * 是否必填:是 + * 类型:string(32) + * 描述: + * 微信支付订单号。 + * 示例值: 1009660380201506130728806387 + *+ */ + @SerializedName(value = "transaction_id") + private String transactionId; + + /** + *
+ * 字段名:子单商户订单号 + * 变量名:out_trade_no + * 是否必填:是 + * 类型:string(32) + * 描述: + * 商户系统内部订单号,要求32个字符内,只能是数字、大小写字母_-|*@ ,且在同一个商户号下唯一。 + * 特殊规则:最小字符长度为6 + * 示例值:20150806125346 + *+ */ + @SerializedName(value = "out_trade_no") + private String outTradeNo; + + /** + *
+ * 字段名:二级商户号 + * 变量名:sub_mchid + * 是否必填:是 + * 类型:string(32) + * 描述: + * 二级商户商户号,由微信支付生成并下发。 + * 注意:仅适用于电商平台 服务商 + * 示例值:1900000109 + *+ */ + @SerializedName(value = "sub_mchid") + private String subMchid; + + /** + *
+ * 字段名:+订单金额 + * 变量名:amount + * 是否必填:是 + * 类型:object + * 描述:订单金额信息 + *+ */ + @SerializedName(value = "amount") + private CombineTransactionsResult.Amount amount; + + } + + @Data + @NoArgsConstructor + public static class SceneInfo implements Serializable { + /** + *
+ * 字段名:商户端设备号 + * 变量名:device_id + * 是否必填:否 + * 类型:string(16) + * 描述: + * 终端设备号(门店号或收银设备ID)。 + * 特殊规则:长度最小7个字节 + * 示例值:POS1:1 + *+ */ + @SerializedName(value = "device_id") + private String deviceId; + + } + + @Data + @NoArgsConstructor + public static class CombinePayerInfo implements Serializable { + /** + *
+ * 字段名:用户标识 + * 变量名:openid + * 是否必填:是 + * 类型:string(128) + * 描述: + * 使用合单appid获取的对应用户openid。是用户在商户appid下的唯一标识。 + * 示例值:oUpF8uMuAJO_M2pxb1Q9zNjWeS6o + *+ */ + @SerializedName(value = "openid") + private String openid; + + } + + @Data + @NoArgsConstructor + public static class Amount implements Serializable { + /** + *
+ * 字段名:标价金额 + * 变量名:total_amount + * 是否必填:是 + * 类型:int64 + * 描述: + * 子单金额,单位为分。 + * 示例值:100 + *+ */ + @SerializedName(value = "total_amount") + private Integer totalAmount; + + /** + *
+ * 字段名:标价币种 + * 变量名:currency + * 是否必填:是 + * 类型:string(8) + * 描述: + * 符合ISO 4217标准的三位字母代码,人民币:CNY。 + * 示例值:CNY + *+ */ + @SerializedName(value = "currency") + private String currency; + + /** + *
+ * 字段名:现金支付金额 + * 变量名:payer_amount + * 是否必填:是 + * 类型:int64 + * 描述: + * 订单现金支付金额。 + * 示例值:10 + *+ */ + @SerializedName(value = "payer_amount") + private Integer payerAmount; + + /** + *
+ * 字段名:现金支付币种 + * 变量名:payer_currency + * 是否必填:是 + * 类型:string(8) + * 描述: + * 货币类型,符合ISO 4217标准的三位字母代码,默认人民币:CNY。 + * 示例值: CNY + *+ */ + @SerializedName(value = "payer_currency") + private String payerCurrency; + } +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/ecommerce/PartnerTransactionsNotifyResult.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/ecommerce/PartnerTransactionsNotifyResult.java index abb4bfe73..03d9535fa 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/ecommerce/PartnerTransactionsNotifyResult.java +++ b/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; /** - *
- * 字段名:服务商公众号ID - * 变量名:sp_appid - * 是否必填:是 - * 类型:string(32) - * 描述: - * 服务商申请的公众号或移动应用appid。 - * 示例值:wx8888888888888888 - *+ * 解密后的数据 */ - @SerializedName(value = "sp_appid") - private String spAppid; - - /** - *
- * 字段名:服务商户号 - * 变量名:sp_mchid - * 是否必填:是 - * 类型:string(32) - * 描述: - * 服务商户号,由微信支付生成并下发 - * 示例值:1230000109 - *- */ - @SerializedName(value = "sp_mchid") - private String spMchid; - - /** - *
- * 字段名:二级商户公众号ID - * 变量名:sub_appid - * 是否必填:否 - * 类型:string(32) - * 描述: - * 二级商户申请的公众号或移动应用appid。 - * 示例值:wxd678efh567hg6999 - *- */ - @SerializedName(value = "sub_appid") - private String subAppid; - - /** - *
- * 字段名:二级商户号 - * 变量名:sub_mchid - * 是否必填:是 - * 类型:string(32) - * 描述: - * 二级商户的商户号,有微信支付生成并下发。 - * 示例值:1900000109 - *- */ - @SerializedName(value = "sub_mchid") - private String subMchid; - - /** - *
- * 字段名:+商户订单号 - * 变量名:out_trade_no - * 是否必填:是 - * 类型:string(32) - * 描述:商户系统内部订单号,只能是数字、大小写字母_-*且在同一个商户号下唯一,详见【商户订单号】。 - * 特殊规则:最小字符长度为6 - * 示例值:1217752501201407033233368018 - *- */ - @SerializedName(value = "out_trade_no") - private String outTradeNo; - - /** - *
- * 字段名:微信支付订单号 - * 变量名:transaction_id - * 是否必填:否 - * 类型:string(32) - * 描述:微信支付系统生成的订单号。 - * 示例值:1217752501201407033233368018 - *- */ - @SerializedName(value = "transaction_id") - private String transactionId; - - /** - *
- * 字段名:交易类型 - * 变量名:trade_type - * 是否必填:否 - * 类型:string(16) - * 描述:交易类型,枚举值: - * JSAPI:公众号支付 - * NATIVE:扫码支付 - * APP:APP支付 - * MICROPAY:付款码支付 - * MWEB:H5支付 - * FACEPAY:刷脸支付 - * - * 示例值: MICROPAY - *- */ - @SerializedName(value = "trade_type") - private String tradeType; - - /** - *
- * 字段名:交易状态 - * 变量名:trade_state - * 是否必填:是 - * 类型:string(32) - * 描述:交易状态,枚举值: - * SUCCESS:支付成功 - * REFUND:转入退款 - * NOTPAY:未支付 - * CLOSED:已关闭 - * REVOKED:已撤销(付款码支付) - * USERPAYING:用户支付中(付款码支付) - * PAYERROR:支付失败(其他原因,如银行返回失败) - * - * 示例值:SUCCESS - *- */ - @SerializedName(value = "trade_state") - private String tradeState; - - /** - *
- * 字段名:交易状态描述 - * 变量名:trade_state_desc - * 是否必填:是 - * 类型:string(256) - * 描述:交易状态描述 - * 示例值:支付失败,请重新下单支付 - *- */ - @SerializedName(value = "trade_state_desc") - private String tradeStateDesc; - - /** - *
- * 字段名:付款银行 - * 变量名:bank_type - * 是否必填:否 - * 类型:string(16) - * 描述:银行类型,采用字符串类型的银行标识。 - * 示例值:CMC - *- */ - @SerializedName(value = "bank_type") - private String bankType; - - /** - *
- * 字段名:附加数据 - * 变量名:attach - * 是否必填:否 - * 类型:string(128) - * 描述:附加数据,在查询API和支付通知中原样返回,可作为自定义参数使用 - * 示例值:自定义数据 - *- */ - @SerializedName(value = "attach") - private String attach; - - /** - *
- * 字段名:支付完成时间 - * 变量名: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 - *- */ - @SerializedName(value = "success_time") - private String successTime; - - /** - *
- * 字段名:+支付者 - * 变量名:combine_payer_info - * 是否必填:否 - * 类型:object - * 描述:示例值:见请求示例 - *- */ - @SerializedName(value = "combine_payer_info") - private CombinePayerInfo combinePayerInfo; - - /** - *
- * 字段名:订单金额 - * 变量名:amount - * 是否必填:是 - * 类型:object - * 描述:订单金额信息 - *- */ - @SerializedName(value = "amount") - private Amount amount; - - /** - *
- * 字段名:场景信息 - * 变量名:scene_info - * 是否必填:否 - * 类型:object - * 描述:支付场景信息描述 - *- */ - @SerializedName(value = "scene_info") - private SceneInfo sceneInfo; - - /** - *
- * 字段名:优惠功能 - * 变量名:promotion_detail - * 是否必填:否 - * 类型:array - * 描述:优惠功能,享受优惠时返回该字段。 - *- */ - @SerializedName(value = "promotion_detail") - private List
- * 字段名:商户端设备号 - * 变量名:device_id - * 是否必填:否 - * 类型:string(16) - * 描述: - * 终端设备号(门店号或收银设备ID)。 - * 特殊规则:长度最小7个字节 - * 示例值:POS1:1 - *- */ - @SerializedName(value = "device_id") - private String deviceId; - - } - - @Data - @NoArgsConstructor - public static class CombinePayerInfo implements Serializable { - /** - *
- * 字段名:用户标识 - * 变量名:sp_openid - * 是否必填:是 - * 类型:string(128) - * 描述: - * 用户在服务商appid下的唯一标识。 - * 示例值:oUpF8uMuAJO_M2pxb1Q9zNjWeS6o - *- */ - @SerializedName(value = "sp_openid") - private String spOpenid; - - - /** - *
- * 字段名:二级商户用户标识 - * 变量名:sub_openid - * 是否必填:否 - * 类型:string(128) - * 描述: - * 用户在二级商户appid下的唯一标识。 - * 示例值:oUpF8uMuAJO_M2pxb1Q9zNjWeS6o - *- */ - @SerializedName(value = "sub_openid") - private String subOpenid; - - } - - @Data - @NoArgsConstructor - public static class Amount implements Serializable { - /** - *
- * 字段名:总金额 - * 变量名:total - * 是否必填:否 - * 类型:int - * 描述: - * 订单总金额,单位为分 - * 示例值:100 - *- */ - @SerializedName(value = "total") - private Integer total; - - - /** - *
- * 字段名:用户支付金额 - * 变量名:payer_total - * 是否必填:否 - * 类型:int - * 描述: - * 用户支付金额,单位为分。 - * 示例值:100 - *- */ - @SerializedName(value = "payer_total") - private Integer payerTotal; - - - /** - *
- * 字段名:货币类型 - * 变量名:currency - * 是否必填:否 - * 类型:string(16) - * 描述: - * CNY:人民币,境内商户号仅支持人民币。 - * 示例值:CNY - *- */ - @SerializedName(value = "currency") - private String currency; - - - /** - *
- * 字段名:用户支付币种 - * 变量名:payer_currency - * 是否必填:否 - * 类型:string(8) - * 描述: - * 用户支付币种 - * 示例值: CNY - *- */ - @SerializedName(value = "payer_currency") - private String payerCurrency; - } - - @Data - @NoArgsConstructor - public static class PromotionDetail implements Serializable { - - /** - *
- * 字段名:券ID - * 变量名:coupon_id - * 是否必填:是 - * 类型:string(32) - * 描述: 券ID - * 示例值:109519 - *- */ - @SerializedName(value = "coupon_id") - private String couponId; - - /** - *
- * 字段名:优惠名称 - * 变量名:name - * 是否必填:否 - * 类型:string(64) - * 描述: 优惠名称 - * 示例值:单品惠-6 - *- */ - @SerializedName(value = "name") - private String name; - /** - *
- * 字段名:优惠范围 - * 变量名:scope - * 是否必填:否 - * 类型:string(32) - * 描述: 优惠名称 - * 示例值: - * GLOBAL:全场代金券 - * SINGLE:单品优惠 - * 示例值:GLOBAL - *- */ - @SerializedName(value = "scope") - private String scope; - - /** - *
- * 字段名:优惠类型 - * 变量名:type - * 是否必填:否 - * 类型:string(32) - * 描述: - * CASH:充值 - * NOCASH:预充值 - * 示例值:CASH - *- */ - @SerializedName(value = "type") - private String type; - - /** - *
- * 字段名:优惠券面额 - * 变量名:amount - * 是否必填:是 - * 类型:int - * 描述: 优惠券面额 - * 示例值:100 - *- */ - @SerializedName(value = "amount") - private Integer amount; - - /** - *
- * 字段名:活动ID - * 变量名:stock_id - * 是否必填:否 - * 类型:string(32) - * 描述:活动ID - * 示例值:931386 - *- */ - @SerializedName(value = "stock_id") - private String stockId; - - /** - *
- * 字段名:微信出资 - * 变量名:wechatpay_contribute - * 是否必填:否 - * 类型:int - * 描述:微信出资,单位为分 - * 示例值:0 - *- */ - @SerializedName(value = "wechatpay_contribute") - private Integer wechatpayContribute; - - /** - *
- * 字段名:商户出资 - * 变量名:merchant_contribute - * 是否必填:否 - * 类型:int - * 描述:商户出资,单位为分 - * 示例值:0 - *- */ - @SerializedName(value = "merchant_contribute") - private Integer merchantContribute; - - /** - *
- * 字段名:其他出资 - * 变量名:other_contribute - * 是否必填:否 - * 类型:int - * 描述:其他出资,单位为分 - * 示例值:0 - *- */ - @SerializedName(value = "other_contribute") - private Integer otherContribute; - - /** - *
- * 字段名:优惠币种 - * 变量名:currency - * 是否必填:否 - * 类型:String(16) - * 描述: - * CNY:人民币,境内商户号仅支持人民币。 - * 示例值:CNY - *- */ - @SerializedName(value = "currency") - private String currency; - - /** - *
- * 字段名:单品列表 - * 变量名:goods_detail - * 是否必填:否 - * 类型:array - * 描述:单品列表信息 - *- */ - @SerializedName(value = "goods_detail") - private List
- * 字段名:商品编码 - * 变量名:goods_id - * 是否必填:是 - * 类型:string(32) - * 描述:商品编码 - * 示例值:M1006 - *- */ - @SerializedName(value = "goods_id") - private String goodsId; - - /** - *
- * 字段名:商品数量 - * 变量名:quantity - * 是否必填:是 - * 类型:int64 - * 描述: - * 用户购买的数量 - * 示例值:1 - *- */ - @SerializedName(value = "quantity") - private Integer quantity; - - /** - *
- * 字段名:商品单价 - * 变量名:unit_price - * 是否必填:是 - * 类型:int64 - * 描述: - * 商品单价,单位为分 - * 示例值:100 - *- */ - @SerializedName(value = "unit_price") - private Integer unitPrice; - - /** - *
- * 字段名:商品优惠金额 - * 变量名:discount_amount - * 是否必填:是 - * 类型:int - * 描述:商品优惠金额 - * 示例值:0 - *- */ - @SerializedName(value = "discount_amount") - private Integer discountAmount; - - /** - *
- * 字段名:商品备注 - * 变量名:goods_remark - * 是否必填:否 - * 类型:string(128) - * 描述:商品备注信息 - * 示例值:商品备注信息 - *- */ - @SerializedName(value = "goods_remark") - private String goodsRemark; - } - + private PartnerTransactionsResult result; } diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/ecommerce/PartnerTransactionsQueryRequest.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/ecommerce/PartnerTransactionsQueryRequest.java new file mode 100644 index 000000000..2b90e432b --- /dev/null +++ b/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 { + + + /** + *
+ * 字段名:服务商户号 + * 变量名:sp_mchid + * 是否必填:是 + * 类型:string(32) + * 描述: + * 服务商户号,由微信支付生成并下发 + * 示例值:1230000109 + *+ */ + @SerializedName(value = "sp_mchid") + private String spMchid; + + /** + *
+ * 字段名:二级商户号 + * 变量名:sub_mchid + * 是否必填:是 + * 类型:string(32) + * 描述: + * 二级商户的商户号,有微信支付生成并下发。 + * 示例值:1900000109 + *+ */ + @SerializedName(value = "sub_mchid") + private String subMchid; + + /** + *
+ * 字段名:微信支付订单号 + * 变量名:transaction_id + * 是否必填:是 + * 类型:string(32) + * 描述: + * 微信支付系统生成的订单号 + * 示例值:1217752501201407033233368018 + *+ */ + @SerializedName(value = "transaction_id") + private String transactionId; + /** + *
+ * 字段名:商户订单号 + * 变量名:out_trade_no + * 是否必填:是 + * 类型:string(32) + * 描述: + * 商户系统内部订单号,只能是数字、大小写字母_-*且在同一个商户号下唯一,详见【商户订单号】。 + * 特殊规则:最小字符长度为6 + * 示例值:1217752501201407033233368018 + *+ */ + @SerializedName(value = "out_trade_no") + private String outTradeNo; +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/ecommerce/PartnerTransactionsResult.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/ecommerce/PartnerTransactionsResult.java new file mode 100644 index 000000000..94848a09f --- /dev/null +++ b/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; + +/** + * 普通支付 查询结果 + *
+ * 文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/e_transactions/chapter3_5.shtml + *+ */ +@Data +@NoArgsConstructor +public class PartnerTransactionsResult implements Serializable { + + /** + *
+ * 字段名:服务商公众号ID + * 变量名:sp_appid + * 是否必填:是 + * 类型:string(32) + * 描述: + * 服务商申请的公众号或移动应用appid。 + * 示例值:wx8888888888888888 + *+ */ + @SerializedName(value = "sp_appid") + private String spAppid; + + /** + *
+ * 字段名:服务商户号 + * 变量名:sp_mchid + * 是否必填:是 + * 类型:string(32) + * 描述: + * 服务商户号,由微信支付生成并下发 + * 示例值:1230000109 + *+ */ + @SerializedName(value = "sp_mchid") + private String spMchid; + + /** + *
+ * 字段名:二级商户公众号ID + * 变量名:sub_appid + * 是否必填:否 + * 类型:string(32) + * 描述: + * 二级商户申请的公众号或移动应用appid。 + * 示例值:wxd678efh567hg6999 + *+ */ + @SerializedName(value = "sub_appid") + private String subAppid; + + /** + *
+ * 字段名:二级商户号 + * 变量名:sub_mchid + * 是否必填:是 + * 类型:string(32) + * 描述: + * 二级商户的商户号,有微信支付生成并下发。 + * 示例值:1900000109 + *+ */ + @SerializedName(value = "sub_mchid") + private String subMchid; + + /** + *
+ * 字段名:+商户订单号 + * 变量名:out_trade_no + * 是否必填:是 + * 类型:string(32) + * 描述:商户系统内部订单号,只能是数字、大小写字母_-*且在同一个商户号下唯一,详见【商户订单号】。 + * 特殊规则:最小字符长度为6 + * 示例值:1217752501201407033233368018 + *+ */ + @SerializedName(value = "out_trade_no") + private String outTradeNo; + + /** + *
+ * 字段名:微信支付订单号 + * 变量名:transaction_id + * 是否必填:否 + * 类型:string(32) + * 描述:微信支付系统生成的订单号。 + * 示例值:1217752501201407033233368018 + *+ */ + @SerializedName(value = "transaction_id") + private String transactionId; + + /** + *
+ * 字段名:交易类型 + * 变量名:trade_type + * 是否必填:否 + * 类型:string(16) + * 描述:交易类型,枚举值: + * JSAPI:公众号支付 + * NATIVE:扫码支付 + * APP:APP支付 + * MICROPAY:付款码支付 + * MWEB:H5支付 + * FACEPAY:刷脸支付 + * + * 示例值: MICROPAY + *+ */ + @SerializedName(value = "trade_type") + private String tradeType; + + /** + *
+ * 字段名:交易状态 + * 变量名:trade_state + * 是否必填:是 + * 类型:string(32) + * 描述:交易状态,枚举值: + * SUCCESS:支付成功 + * REFUND:转入退款 + * NOTPAY:未支付 + * CLOSED:已关闭 + * REVOKED:已撤销(付款码支付) + * USERPAYING:用户支付中(付款码支付) + * PAYERROR:支付失败(其他原因,如银行返回失败) + * + * 示例值:SUCCESS + *+ */ + @SerializedName(value = "trade_state") + private String tradeState; + + /** + *
+ * 字段名:交易状态描述 + * 变量名:trade_state_desc + * 是否必填:是 + * 类型:string(256) + * 描述:交易状态描述 + * 示例值:支付失败,请重新下单支付 + *+ */ + @SerializedName(value = "trade_state_desc") + private String tradeStateDesc; + + /** + *
+ * 字段名:付款银行 + * 变量名:bank_type + * 是否必填:否 + * 类型:string(16) + * 描述:银行类型,采用字符串类型的银行标识。 + * 示例值:CMC + *+ */ + @SerializedName(value = "bank_type") + private String bankType; + + /** + *
+ * 字段名:附加数据 + * 变量名:attach + * 是否必填:否 + * 类型:string(128) + * 描述:附加数据,在查询API和支付通知中原样返回,可作为自定义参数使用 + * 示例值:自定义数据 + *+ */ + @SerializedName(value = "attach") + private String attach; + + /** + *
+ * 字段名:支付完成时间 + * 变量名: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 + *+ */ + @SerializedName(value = "success_time") + private String successTime; + + /** + *
+ * 字段名:+支付者 + * 变量名:combine_payer_info + * 是否必填:否 + * 类型:object + * 描述:示例值:见请求示例 + *+ */ + @SerializedName(value = "combine_payer_info") + private PartnerTransactionsResult.CombinePayerInfo combinePayerInfo; + + /** + *
+ * 字段名:订单金额 + * 变量名:amount + * 是否必填:是 + * 类型:object + * 描述:订单金额信息 + *+ */ + @SerializedName(value = "amount") + private PartnerTransactionsResult.Amount amount; + + /** + *
+ * 字段名:场景信息 + * 变量名:scene_info + * 是否必填:否 + * 类型:object + * 描述:支付场景信息描述 + *+ */ + @SerializedName(value = "scene_info") + private PartnerTransactionsResult.SceneInfo sceneInfo; + + /** + *
+ * 字段名:优惠功能 + * 变量名:promotion_detail + * 是否必填:否 + * 类型:array + * 描述:优惠功能,享受优惠时返回该字段。 + *+ */ + @SerializedName(value = "promotion_detail") + private List
+ * 字段名:商户端设备号 + * 变量名:device_id + * 是否必填:否 + * 类型:string(16) + * 描述: + * 终端设备号(门店号或收银设备ID)。 + * 特殊规则:长度最小7个字节 + * 示例值:POS1:1 + *+ */ + @SerializedName(value = "device_id") + private String deviceId; + + } + + @Data + @NoArgsConstructor + public static class CombinePayerInfo implements Serializable { + /** + *
+ * 字段名:用户标识 + * 变量名:sp_openid + * 是否必填:是 + * 类型:string(128) + * 描述: + * 用户在服务商appid下的唯一标识。 + * 示例值:oUpF8uMuAJO_M2pxb1Q9zNjWeS6o + *+ */ + @SerializedName(value = "sp_openid") + private String spOpenid; + + + /** + *
+ * 字段名:二级商户用户标识 + * 变量名:sub_openid + * 是否必填:否 + * 类型:string(128) + * 描述: + * 用户在二级商户appid下的唯一标识。 + * 示例值:oUpF8uMuAJO_M2pxb1Q9zNjWeS6o + *+ */ + @SerializedName(value = "sub_openid") + private String subOpenid; + + } + + @Data + @NoArgsConstructor + public static class Amount implements Serializable { + /** + *
+ * 字段名:总金额 + * 变量名:total + * 是否必填:否 + * 类型:int + * 描述: + * 订单总金额,单位为分 + * 示例值:100 + *+ */ + @SerializedName(value = "total") + private Integer total; + + + /** + *
+ * 字段名:用户支付金额 + * 变量名:payer_total + * 是否必填:否 + * 类型:int + * 描述: + * 用户支付金额,单位为分。 + * 示例值:100 + *+ */ + @SerializedName(value = "payer_total") + private Integer payerTotal; + + + /** + *
+ * 字段名:货币类型 + * 变量名:currency + * 是否必填:否 + * 类型:string(16) + * 描述: + * CNY:人民币,境内商户号仅支持人民币。 + * 示例值:CNY + *+ */ + @SerializedName(value = "currency") + private String currency; + + + /** + *
+ * 字段名:用户支付币种 + * 变量名:payer_currency + * 是否必填:否 + * 类型:string(8) + * 描述: + * 用户支付币种 + * 示例值: CNY + *+ */ + @SerializedName(value = "payer_currency") + private String payerCurrency; + } + + @Data + @NoArgsConstructor + public static class PromotionDetail implements Serializable { + + /** + *
+ * 字段名:券ID + * 变量名:coupon_id + * 是否必填:是 + * 类型:string(32) + * 描述: 券ID + * 示例值:109519 + *+ */ + @SerializedName(value = "coupon_id") + private String couponId; + + /** + *
+ * 字段名:优惠名称 + * 变量名:name + * 是否必填:否 + * 类型:string(64) + * 描述: 优惠名称 + * 示例值:单品惠-6 + *+ */ + @SerializedName(value = "name") + private String name; + /** + *
+ * 字段名:优惠范围 + * 变量名:scope + * 是否必填:否 + * 类型:string(32) + * 描述: 优惠名称 + * 示例值: + * GLOBAL:全场代金券 + * SINGLE:单品优惠 + * 示例值:GLOBAL + *+ */ + @SerializedName(value = "scope") + private String scope; + + /** + *
+ * 字段名:优惠类型 + * 变量名:type + * 是否必填:否 + * 类型:string(32) + * 描述: + * CASH:充值 + * NOCASH:预充值 + * 示例值:CASH + *+ */ + @SerializedName(value = "type") + private String type; + + /** + *
+ * 字段名:优惠券面额 + * 变量名:amount + * 是否必填:是 + * 类型:int + * 描述: 优惠券面额 + * 示例值:100 + *+ */ + @SerializedName(value = "amount") + private Integer amount; + + /** + *
+ * 字段名:活动ID + * 变量名:stock_id + * 是否必填:否 + * 类型:string(32) + * 描述:活动ID + * 示例值:931386 + *+ */ + @SerializedName(value = "stock_id") + private String stockId; + + /** + *
+ * 字段名:微信出资 + * 变量名:wechatpay_contribute + * 是否必填:否 + * 类型:int + * 描述:微信出资,单位为分 + * 示例值:0 + *+ */ + @SerializedName(value = "wechatpay_contribute") + private Integer wechatpayContribute; + + /** + *
+ * 字段名:商户出资 + * 变量名:merchant_contribute + * 是否必填:否 + * 类型:int + * 描述:商户出资,单位为分 + * 示例值:0 + *+ */ + @SerializedName(value = "merchant_contribute") + private Integer merchantContribute; + + /** + *
+ * 字段名:其他出资 + * 变量名:other_contribute + * 是否必填:否 + * 类型:int + * 描述:其他出资,单位为分 + * 示例值:0 + *+ */ + @SerializedName(value = "other_contribute") + private Integer otherContribute; + + /** + *
+ * 字段名:优惠币种 + * 变量名:currency + * 是否必填:否 + * 类型:String(16) + * 描述: + * CNY:人民币,境内商户号仅支持人民币。 + * 示例值:CNY + *+ */ + @SerializedName(value = "currency") + private String currency; + + /** + *
+ * 字段名:单品列表 + * 变量名:goods_detail + * 是否必填:否 + * 类型:array + * 描述:单品列表信息 + *+ */ + @SerializedName(value = "goods_detail") + private List
+ * 字段名:商品编码 + * 变量名:goods_id + * 是否必填:是 + * 类型:string(32) + * 描述:商品编码 + * 示例值:M1006 + *+ */ + @SerializedName(value = "goods_id") + private String goodsId; + + /** + *
+ * 字段名:商品数量 + * 变量名:quantity + * 是否必填:是 + * 类型:int64 + * 描述: + * 用户购买的数量 + * 示例值:1 + *+ */ + @SerializedName(value = "quantity") + private Integer quantity; + + /** + *
+ * 字段名:商品单价 + * 变量名:unit_price + * 是否必填:是 + * 类型:int64 + * 描述: + * 商品单价,单位为分 + * 示例值:100 + *+ */ + @SerializedName(value = "unit_price") + private Integer unitPrice; + + /** + *
+ * 字段名:商品优惠金额 + * 变量名:discount_amount + * 是否必填:是 + * 类型:int + * 描述:商品优惠金额 + * 示例值:0 + *+ */ + @SerializedName(value = "discount_amount") + private Integer discountAmount; + + /** + *
+ * 字段名:商品备注 + * 变量名:goods_remark + * 是否必填:否 + * 类型:string(128) + * 描述:商品备注信息 + * 示例值:商品备注信息 + *+ */ + @SerializedName(value = "goods_remark") + private String goodsRemark; + } + +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/ecommerce/SpWithdrawRequest.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/ecommerce/SpWithdrawRequest.java new file mode 100644 index 000000000..0b836366d --- /dev/null +++ b/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; + +/** + * 电商平台提现 + *
+ * 文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/fund/chapter3_5.shtml + *+ */ +@Data +@NoArgsConstructor +public class SpWithdrawRequest implements Serializable { + /** + *
+ * 字段名:商户提现单号 + * 变量名:out_request_no + * 是否必填:是 + * 类型:string(32) + * 描述: + * 商户提现单号,由商户自定义生成。 + * 示例值:20190611222222222200000000012122 + *+ */ + @SerializedName(value = "out_request_no") + private String outRequestNo; + + /** + *
+ * 字段名:提现金额 + * 变量名:amount + * 是否必填:是 + * 类型:int64 + * 描述: + * 提现金额,单位:分(RMB) + * 示例值:1 + *+ */ + @SerializedName(value = "amount") + private Integer amount; + + /** + *
+ * 字段名:备注 + * 变量名:remark + * 是否必填:否 + * 类型:string(56) + * 描述: + * 商户对提现单的备注 + * 示例值:交易提现 + *+ */ + @SerializedName(value = "remark") + private String remark; + + /** + *
+ * 字段名:银行附言 + * 变量名:bank_memo + * 是否必填:否 + * 类型:string(32) + * 描述: + * 展示在收款银行系统中的附言,数字、字母最长32个汉字(能否成功展示依赖银行系统支持)。 + * 示例值:xx平台提现 + *+ */ + @SerializedName(value = "bank_memo") + private String bankMemo; + + /** + *
+ * 字段名:账户类型 + * 变量名:account_type + * 是否必填:是 + * 类型:string(16) + * 描述: + * 枚举值: + * BASIC:基本账户 + * OPERATION:运营账户 + * FEES:手续费账户 + * 示例值:BASIC + *+ */ + @SerializedName(value = "account_type") + private String accountType; + +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/ecommerce/SpWithdrawResult.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/ecommerce/SpWithdrawResult.java new file mode 100644 index 000000000..b18e24667 --- /dev/null +++ b/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; + +/** + * 电商平台提现 结果 + *
+ * 文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/fund/chapter3_5.shtml + *+ */ +@Data +@NoArgsConstructor +public class SpWithdrawResult implements Serializable { + + /** + *
+ * 字段名:微信支付提现单号 + * 变量名:withdraw_id + * 是否必填:否 (文档里面是【否】,理论上应该都有值) + * 类型:string(128) + * 描述: + * 微信支付系统生成的提现单号。 + * 示例值:12321937198237912739132791732912793127931279317929791239112123 + *+ */ + @SerializedName(value = "withdraw_id") + private String withdrawId; + + /** + *
+ * 字段名:商户提现单号 + * 变量名:out_request_no + * 是否必填:是 + * 类型:string(32) + * 描述: + * 必须是字母数字 + * 示例值: 20190611222222222200000000012122 + *+ */ + @SerializedName(value = "out_request_no") + private String outRequestNo; +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/ecommerce/SubWithdrawRequest.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/ecommerce/SubWithdrawRequest.java new file mode 100644 index 000000000..3c74db24c --- /dev/null +++ b/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; + +/** + * 二级商户账户余额提现 + *
+ * 文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/combine/chapter3_3.shtml + *+ */ +@Data +@NoArgsConstructor +public class SubWithdrawRequest implements Serializable { + + /** + *
+ * 字段名:二级商户号 + * 变量名:sub_mchid + * 是否必填:是 + * 类型:string(32) + * 描述: + * 电商平台二级商户号,由微信支付生成并下发。 + * 示例值:1900000109 + *+ */ + @SerializedName(value = "sub_mchid") + private String subMchid; + + /** + *
+ * 字段名:商户提现单号 + * 变量名:out_request_no + * 是否必填:是 + * 类型:string(32) + * 描述: + * 必须是字母数字 + * 示例值: 20190611222222222200000000012122 + *+ */ + @SerializedName(value = "out_request_no") + private String outRequestNo; + + /** + *
+ * 字段名:提现金额 + * 变量名:amount + * 是否必填:是 + * 类型:int64 + * 描述: + * 提现金额(单位:分) + * 示例值:100 + *+ */ + @SerializedName(value = "amount") + private Integer amount; + + /** + *
+ * 字段名:备注 + * 变量名:remark + * 是否必填:否 + * 类型:string(56) + * 描述: + * 商户对提现单的备注 + * 示例值:交易提现 + *+ */ + @SerializedName(value = "remark") + private String remark; + + /** + *
+ * 字段名:银行附言 + * 变量名:bank_memo + * 是否必填:否 + * 类型:string(32) + * 描述: + * 展示在收款银行系统中的附言,数字、字母最长32个汉字(能否成功展示依赖银行系统支持)。 + * 示例值:微信支付提现 + *+ */ + @SerializedName(value = "bank_memo") + private String bankMemo; + +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/ecommerce/SubWithdrawResult.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/ecommerce/SubWithdrawResult.java new file mode 100644 index 000000000..21213dd42 --- /dev/null +++ b/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; + +/** + * 二级商户账户余额提现 结果 + *
+ * 文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/fund/chapter3_2.shtml + *+ */ +@Data +@NoArgsConstructor +public class SubWithdrawResult implements Serializable { + + /** + *
+ * 字段名:二级商户号 + * 变量名:sub_mchid + * 是否必填:是 + * 类型:string(32) + * 描述: + * 电商平台二级商户号,由微信支付生成并下发。 + * 示例值:1900000109 + *+ */ + @SerializedName(value = "sub_mchid") + private String subMchid; + + /** + *
+ * 字段名:微信支付提现单号 + * 变量名:withdraw_id + * 是否必填:是 + * 类型:string(128) + * 描述: + * 电商平台提交二级商户提现申请后,由微信支付返回的申请单号,作为查询申请状态的唯一标识。 + * 示例值: 12321937198237912739132791732912793127931279317929791239112123 + *+ */ + @SerializedName(value = "withdraw_id") + private String withdrawId; + + /** + *
+ * 字段名:商户提现单号 + * 变量名:out_request_no + * 是否必填:否 + * 类型:string(32) + * 描述: + * 必须是字母数字 + * 示例值: 20190611222222222200000000012122 + *+ */ + @SerializedName(value = "out_request_no") + private String outRequestNo; +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/EcommerceService.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/EcommerceService.java index 6d8160b00..262a233ac 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/EcommerceService.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/EcommerceService.java @@ -97,6 +97,18 @@ public interface EcommerceService { */ CombineTransactionsNotifyResult parseCombineNotifyResult(String notifyData, SignatureHeader header) throws WxPayException; + /** + *
+ * 合单查询订单API + * 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/combine/chapter3_3.shtml + *+ * + * @param outTradeNo 合单商户订单号 + * @return 支付订单信息 + * @throws WxPayException the wx pay exception + */ + CombineTransactionsResult queryCombineTransactions(String outTradeNo) throws WxPayException; + /** *
* 服务商模式普通支付API(APP支付、JSAPI支付、H5支付、NATIVE支付). @@ -139,6 +151,18 @@ public interface EcommerceService { */ PartnerTransactionsNotifyResult parsePartnerNotifyResult(String notifyData, SignatureHeader header) throws WxPayException; + /** + *+ * 普通查询订单API + * 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/e_transactions/chapter3_5.shtml + *+ * + * @param request 商户订单信息 + * @return 支付订单信息 + * @throws WxPayException the wx pay exception + */ + PartnerTransactionsResult queryPartnerTransactions(PartnerTransactionsQueryRequest request) throws WxPayException; + /** ** 服务商账户实时余额 @@ -237,4 +261,27 @@ public interface EcommerceService { */ RefundsResult refunds(RefundsRequest request) throws WxPayException; + /** + *+ * 二级商户账户余额提现API + * 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/fund/chapter3_2.shtml + *+ * + * @param request 提现请求 + * @return 返回数据 return withdraw result + * @throws WxPayException the wx pay exception + */ + SubWithdrawResult subWithdraw(SubWithdrawRequest request) throws WxPayException; + + /** + *+ * 电商平台提现API + * 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/fund/chapter3_5.shtml + *+ * + * @param request 提现请求 + * @return 返回数据 return withdraw result + * @throws WxPayException the wx pay exception + */ + SpWithdrawResult spWithdraw(SpWithdrawRequest request) throws WxPayException; } diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/EcommerceServiceImpl.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/EcommerceServiceImpl.java index 53ecb9ceb..1ed6e0fe4 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/EcommerceServiceImpl.java +++ b/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,14 +74,24 @@ 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); } } + @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(); @@ -108,14 +119,29 @@ 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); } } + @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); @@ -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(), diff --git a/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/impl/EcommerceServiceImplTest.java b/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/impl/EcommerceServiceImplTest.java new file mode 100644 index 000000000..b56084466 --- /dev/null +++ b/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); + } +}