diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorCallbacksRequest.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorCallbacksRequest.java new file mode 100644 index 0000000000..55d38d0bd8 --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorCallbacksRequest.java @@ -0,0 +1,46 @@ +package com.github.binarywang.wxpay.bean.marketing; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 设置商家券事件通知地址请求对象 + *
+ *   文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_7.shtml
+ * 
+ * + * @author yujam + */ +@Data +@NoArgsConstructor +public class BusiFavorCallbacksRequest implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + *
* 字段名:商户号
+   * 变量名:mchid
+   * 是否必填:否
+   * 类型:string[8,15]
+   * 描述:
+   * body 微信支付商户的商户号,由微信支付生成并下发,不填默认查询调用方商户的通知URL。 示例值:10000098
+   * 
+ */ + @SerializedName(value = "mchid") + private String mchid; + + /** + *
* 字段名:通知URL地址
+   * 变量名:notify_url
+   * 是否必填:是
+   * 类型:string[10,256]
+   * 描述:
+   * body 商户提供的用于接收商家券事件通知的url地址,必须支持https。 示例值:https://pay.weixin.qq.com
+   * 
+ */ + @SerializedName(value = "notify_url") + private String notifyUrl; +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorCallbacksResult.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorCallbacksResult.java new file mode 100644 index 0000000000..407c580ff9 --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorCallbacksResult.java @@ -0,0 +1,57 @@ +package com.github.binarywang.wxpay.bean.marketing; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 设置商家券事件通知地址返回对象 + *
+ *   文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_7.shtml
+ * 
+ * + * @author yujam + */ +@Data +@NoArgsConstructor +public class BusiFavorCallbacksResult implements Serializable { + private static final long serialVersionUID = 1L; + + /** + *
* 字段名:修改时间
+   * 变量名:update_time
+   * 是否必填:否
+   * 类型:string[1,32]
+   * 描述:
+   * 修改时间,遵循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秒。 示例值:2015-05-20T13:29:35+08:00
+   * 
+ */ + @SerializedName(value = "update_time") + private String updateTime; + + /** + *
* 字段名:通知URL地址
+   * 变量名:notify_url
+   * 是否必填:是
+   * 类型:string[10,256]
+   * 描述:
+   * 商户提供的用于接收商家券事件通知的url地址,必须支持https。 示例值:https://pay.weixin.qq.com
+   * 
+ */ + @SerializedName(value = "notify_url") + private String notifyUrl; + + /** + *
* 字段名:商户号
+   * 变量名:mchid
+   * 是否必填:是
+   * 类型:string[8,15]
+   * 描述:
+   * 微信支付商户的商户号,由微信支付生成并下发。 示例值:10000098
+   * 
+ */ + @SerializedName(value = "mchid") + private String mchid; +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorCouponCodeRequest.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorCouponCodeRequest.java new file mode 100644 index 0000000000..fa6ca553e9 --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorCouponCodeRequest.java @@ -0,0 +1,58 @@ +package com.github.binarywang.wxpay.bean.marketing; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * 上传预存code请求对象 + *
+ *   文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_6.shtml
+ * 
+ * + * @author yujam + */ +@Data +@NoArgsConstructor +public class BusiFavorCouponCodeRequest implements Serializable { + public static final float serialVersionUID = 1L; + + /** + *
* 字段名:批次号
+   * 变量名:stock_id
+   * 是否必填:是
+   * 类型:string[1,20]
+   * 描述:
+   * path 微信为每个商家券批次分配的唯一ID 示例值:98065001
+   * 
+ */ + @SerializedName(value = "stock_id") + private String stockId; + +/** + *
* 字段名:券code列表
+ * 变量名:coupon_code_list
+ * 是否必填:否
+ * 类型:array
+ * 描述:
+ * body 商户上传的券code列表,code允许包含的字符有0-9、a-z、A-Z、-、_、\、/、=、|。 特殊规则:单个券code长度为【1,32】,条目个数限制为【1,200】。 示例值:ABC9588200,ABC9588201
+ * 
+ */ + @SerializedName(value = "coupon_code_list") + private List couponCodeList; + + /** + *
* 字段名:请求业务单据号
+   * 变量名:upload_request_no
+   * 是否必填:是
+   * 类型:string[1,128]
+   * 描述:
+   * body 商户上传code的凭据号,商户侧需保持唯一性。 示例值:100002322019090134234sfdf
+   * 
+ */ + @SerializedName(value = "upload_request_no") + private String uploadRequestNo; +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorCouponCodeResult.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorCouponCodeResult.java new file mode 100644 index 0000000000..ca45a091c4 --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorCouponCodeResult.java @@ -0,0 +1,172 @@ +package com.github.binarywang.wxpay.bean.marketing; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * 上传预存code返回对象 + *
+ *   文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_6.shtml
+ * 
+ * + * @author yujam + */ +@Data +@NoArgsConstructor +public class BusiFavorCouponCodeResult implements Serializable { + public static final float serialVersionUID = 1L; + + /** + *
* 字段名:批次号
+   * 变量名:stock_id
+   * 是否必填:是
+   * 类型:string[1,20]
+   * 描述:
+   * 微信为每个商家券批次分配的唯一ID。 示例值:98065001
+   * 
+ */ + @SerializedName(value = "stock_id") + private String stockId; + + /** + *
* 字段名:去重后上传code总数
+   * 变量名:total_count
+   * 是否必填:是
+   * 类型:uint64
+   * 描述:
+   * 本次上传操作,去重后实际上传的code数目。 示例值:500
+   * 
+ */ + @SerializedName(value = "total_count") + private Integer totalCount; + + /** + *
* 字段名:上传成功code个数
+   * 变量名:success_count
+   * 是否必填:是
+   * 类型:uint64
+   * 描述:
+   * 本次上传操作上传成功个数。 示例值:20
+   * 
+ */ + @SerializedName(value = "success_count") + private Integer successCount; + + /** + *
* 字段名:上传成功的code列表
+   * 变量名:success_codes
+   * 是否必填:否
+   * 类型:array
+   * 描述:
+   * 本次新增上传成功的code信息。 特殊规则:单个券code长度为【1,32】,条目个数限制为【1,200】。 示例值:MMAA12345
+   * 
+ */ + @SerializedName(value = "success_codes") + private List successCodes; + + /** + *
* 字段名:上传成功时间
+   * 变量名:success_time
+   * 是否必填:是
+   * 类型:string[1,32]
+   * 描述:
+   * 上传操作完成时间,遵循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秒。 示例值:2015-05-20T13:29:35+08:00
+   * 
+ */ + @SerializedName(value = "success_time") + private String successTime; + + /** + *
* 字段名:上传失败code个数
+   * 变量名:fail_count
+   * 是否必填:否
+   * 类型:uint64
+   * 描述:
+   * 本次上传操作上传失败的code数。 示例值:10
+   * 
+ */ + @SerializedName(value = "fail_count") + private Integer failCount; + + /** + *
* 字段名:+上传失败的code及原因
+   * 变量名:fail_codes
+   * 是否必填:否
+   * 类型:array
+   * 描述:
+   * 本次导入失败的code信息,请参照错误信息,修改后重试。
+   * 
+ */ + @SerializedName(value = "fail_codes") + private List failCodes; + + /** + *
* 字段名:已存在的code列表
+   * 变量名:exist_codes
+   * 是否必填:否
+   * 类型:array
+   * 描述:
+   * 历史已存在的code列表,本次不会重复导入。 特殊规则:单个券code长度为【1,32】,条目个数限制为【1,200】。 示例值:ABCD2345
+   * 
+ */ + @SerializedName(value = "exist_codes") + private List existCodes; + + /** + *
* 字段名:本次请求中重复的code列表
+   * 变量名:duplicate_codes
+   * 是否必填:否
+   * 类型:array
+   * 描述:
+   * 本次重复导入的code会被自动过滤,仅保留一个做导入,如满足要求则成功;如不满足要求,则失败;请参照报错提示修改重试。 特殊规则:单个券code长度为【1,32】,条目个数限制为【1,200】。 示例值:AACC2345
+   * 
+ */ + @SerializedName(value = "duplicate_codes") + private List duplicateCodes; + + @Data + @NoArgsConstructor + public static class FailCode { + public static final float serialVersionUID = 1L; + + /** + *
* 字段名:上传失败的券code
+     * 变量名:coupon_code
+     * 是否必填:是
+     * 类型:string[1,32]
+     * 描述:
+     * 商户通过API上传的券code。 示例值:ABCD23456
+     * 
+ */ + @SerializedName(value = "coupon_code") + private String couponCode; + + /** + *
* 字段名:上传失败错误码
+     * 变量名:code
+     * 是否必填:是
+     * 类型:string[1,32]
+     * 描述:
+     * 对应券code上传失败的错误码。 示例值:LENGTH_LIMIT
+     * 
+ */ + @SerializedName(value = "code") + private String code; + + /** + *
* 字段名:上传失败错误信息
+     * 变量名:message
+     * 是否必填:是
+     * 类型:string[1,128]
+     * 描述:
+     * 上传失败的错误信息描述。 示例值:长度超过最大值32位
+     * 
+ */ + @SerializedName(value = "message") + private String message; + } +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorCouponsAssociateRequest.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorCouponsAssociateRequest.java new file mode 100644 index 0000000000..8ca5f5d0f2 --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorCouponsAssociateRequest.java @@ -0,0 +1,69 @@ +package com.github.binarywang.wxpay.bean.marketing; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 关联订单信息请求对象 + *
+ *   文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_9.shtml
+ * 
+ * + * @author yujam + */ +@Data +@NoArgsConstructor +public class BusiFavorCouponsAssociateRequest implements Serializable { + private static final long serialVersionUID = 1L; + + /** + *
* 字段名:批次号
+   * 变量名:stock_id
+   * 是否必填:是
+   * 类型:string[1,20]
+   * 描述:
+   * body 微信为每个商家券批次分配的唯一ID,对于商户自定义code的批次,关联请求必须填写批次号 示例值:100088
+   * 
+ */ + @SerializedName(value = "stock_id") + private String stockId; + + /** + *
* 字段名:券code
+   * 变量名:coupon_code
+   * 是否必填:是
+   * 类型:string[1,32]
+   * 描述:
+   * body 券的唯一标识 示例值:sxxe34343434
+   * 
+ */ + @SerializedName(value = "coupon_code") + private String couponCode; + + /** + *
* 字段名:关联的商户订单号
+   * 变量名:out_trade_no
+   * 是否必填:是
+   * 类型:string[1,128]
+   * 描述:
+   * body 微信支付下单时的商户订单号,欲与该商家券关联的微信支付 示例值:MCH_102233445
+   * 
+ */ + @SerializedName(value = "out_trade_no") + private String outTradeNo; + + /** + *
* 字段名:商户请求单号
+   * 变量名:out_request_no
+   * 是否必填:是
+   * 类型:string[1,128]
+   * 描述:
+   * body 商户创建批次凭据号(格式:商户id+日期+流水号),商户侧需保持唯一性,可包含英文字母,数字,|,_,*,-等内容,不允许出现其他不合法符号。 示例值:1002600620019090123143254435
+   * 
+ */ + @SerializedName(value = "out_request_no") + private String outRequestNo; +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorCouponsAssociateResult.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorCouponsAssociateResult.java new file mode 100644 index 0000000000..635f3bc56a --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorCouponsAssociateResult.java @@ -0,0 +1,47 @@ +package com.github.binarywang.wxpay.bean.marketing; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 关联订单信息返回对象 + *
+ *   文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_9.shtml
+ * 
+ * + * @author yujam + */ +@Data +@NoArgsConstructor +public class BusiFavorCouponsAssociateResult implements Serializable { + private static final long serialVersionUID = 1L; + + /** + *
* 字段名:关联成功时间
+   * 变量名:wechatpay_associate_time
+   * 是否必填:是
+   * 类型:string[1,32]
+   * 描述:
+   * 系统关联券成功的时间,遵循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秒。 示例值:2015-05-20T13:29:35+08:00
+   * 
+ */ + @SerializedName(value = "wechatpay_associate_time") + private String wechatpayAssociateTime; + + /** + *
* 字段名:取消关联时间
+   * 变量名:wechatpay_associate_time
+   * 是否必填:是
+   * 类型:string[1,32]
+   * 描述:
+   * 系统成功取消商家券与订单信息关联关系的时间,遵循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秒。
+   * 示例值:2015-05-20T13:29:35+08:00
+   * 
+ */ + @SerializedName(value = "wechatpay_disassociate_time") + private String wechatpayDisassociateTime; + +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorCouponsDeactivateRequest.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorCouponsDeactivateRequest.java new file mode 100644 index 0000000000..36d83acc4d --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorCouponsDeactivateRequest.java @@ -0,0 +1,68 @@ +package com.github.binarywang.wxpay.bean.marketing; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 使券失效请求对象 + *
+ *   文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_14.shtml
+ * 
+ * + * @author yujam + */ +@Data +@NoArgsConstructor +public class BusiFavorCouponsDeactivateRequest implements Serializable { + + /** + *
* 字段名:券code
+   * 变量名:coupon_code
+   * 是否必填:是
+   * 类型:string[1,32]
+   * 描述:
+   * body券的唯一标识 示例值:sxxe34343434
+   * 
+ */ + @SerializedName(value = "coupon_code") + private String couponCode; + + /** + *
* 字段名:批次号
+   * 变量名:stock_id
+   * 是否必填:是
+   * 类型:string[1,20]
+   * 描述:
+   * body券的所属批次号 示例值:1234567891
+   * 
+ */ + @SerializedName(value = "stock_id") + private String stockId; + + /** + *
* 字段名:失效请求单据号
+   * 变量名:deactivate_request_no
+   * 是否必填:是
+   * 类型:string[1, 128]
+   * 描述:
+   * body每次失效请求的唯一标识,商户需保证唯一 示例值:1002600620019090123143254436
+   * 
+ */ + @SerializedName(value = "deactivate_request_no") + private String deactivateRequestNo; + + /** + *
* 字段名:失效原因
+   * 变量名:deactivate_reason
+   * 是否必填:否
+   * 类型:string[1, 64]
+   * 描述:
+   * body商户失效券的原因 示例值:此券使用时间设置错误
+   * 
+ */ + @SerializedName(value = "deactivate_reason") + private String deactivateReason; +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorCouponsDeactivateResult.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorCouponsDeactivateResult.java new file mode 100644 index 0000000000..b17f0fa6f0 --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorCouponsDeactivateResult.java @@ -0,0 +1,32 @@ +package com.github.binarywang.wxpay.bean.marketing; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 使券失效返回对象 + *
+ *   文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_14.shtml
+ * 
+ * + * @author yujam + */ +@Data +@NoArgsConstructor +public class BusiFavorCouponsDeactivateResult implements Serializable { + + /** + *
* 字段名:券成功失效的时间
+   * 变量名:wechatpay_deactivate_time
+   * 是否必填:是
+   * 类型:string[1,32]
+   * 描述:
+   * 系统券成功失效的时间,遵循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秒。 示例值:2020-05-20T13:29:35.08:00
+   * 
+ */ + @SerializedName(value = "wechatpay_deactivate_time") + private String wechatpayDeactivateTime; +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorCouponsReturnRequest.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorCouponsReturnRequest.java new file mode 100644 index 0000000000..4dd4c3edaf --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorCouponsReturnRequest.java @@ -0,0 +1,56 @@ +package com.github.binarywang.wxpay.bean.marketing; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 申请退券请求对象 + *
+ *   文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_13.shtml
+ * 
+ * + * @author yujam + */ +@Data +@NoArgsConstructor +public class BusiFavorCouponsReturnRequest implements Serializable { + + /** + *
* 字段名:券code
+   * 变量名:coupon_code
+   * 是否必填:是
+   * 类型:string[1,20]
+   * 描述:
+   * body券的唯一标识 示例值:sxxe34343434
+   * 
+ */ + @SerializedName(value = "coupon_code") + private String couponCode; + + /** + *
* 字段名:批次号
+   * 变量名:stock_id
+   * 是否必填:是
+   * 类型:string[1,32]
+   * 描述:
+   * body券的所属批次号 示例值:1234567891
+   * 
+ */ + @SerializedName(value = "stock_id") + private String stockId; + + /** + *
* 字段名:退券请求单据号
+   * 变量名:return_request_no
+   * 是否必填:是
+   * 类型:string[1, 128]
+   * 描述:
+   * body每次退券请求的唯一标识,商户需保证唯一 示例值:1002600620019090123143254436
+   * 
+ */ + @SerializedName(value = "return_request_no") + private String returnRequestNo; +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorCouponsReturnResult.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorCouponsReturnResult.java new file mode 100644 index 0000000000..2d758ee731 --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorCouponsReturnResult.java @@ -0,0 +1,32 @@ +package com.github.binarywang.wxpay.bean.marketing; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 申请退券返回对象 + *
+ *   文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_13.shtml
+ * 
+ * + * @author yujam + */ +@Data +@NoArgsConstructor +public class BusiFavorCouponsReturnResult implements Serializable { + + /** + *
* 字段名:微信退券成功的时间
+   * 变量名:wechatpay_return_time
+   * 是否必填:是
+   * 类型:string[1,32]
+   * 描述:
+   * 微信退券成功的时间,遵循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秒。 示例值:2020-05-20T13:29:35+08:00
+   * 
+ */ + @SerializedName(value = "wechatpay_return_time") + private String wechatpayReturnTime; +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorCouponsUrlRequest.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorCouponsUrlRequest.java new file mode 100644 index 0000000000..11319e56b4 --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorCouponsUrlRequest.java @@ -0,0 +1,90 @@ +package com.github.binarywang.wxpay.bean.marketing; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * H5发券请求对象 + *
+ *   文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_4_1.shtml
+ * 
+ * + * @author yujam + */ +@Data +@NoArgsConstructor +public class BusiFavorCouponsUrlRequest { + public static final float serialVersionUID = 1L; + + /** + *
+   * 字段名:批次号
+   * 变量名:stock_id
+   * 是否必填:否
+   * 类型:string[1,20]
+   * 描述:
+   * 微信为每个商家券批次分配的唯一ID,批次券Code模式是MERCHANT_API或者MERCHANT_UPLOAD时,核销时必须填写批次号
+   * 示例值:100088
+   * 
+ */ + @SerializedName(value = "stock_id") + private String stockId; + + /** + *
+   * 字段名:核销请求单据号
+   * 变量名:out_request_no
+   * 是否必填:是
+   * 类型:string[1,128]
+   * 描述:
+   *  发券凭证(示例格式:商户 id+日期+流水号),可包含英文字母、数字,不允许出现其他不合法符号,商户侧需保证发放凭据号唯一性
+   * 
+ */ + @SerializedName(value = "out_request_no") + private String outRequestNo; + + /** + *
+   * 字段名:签名
+   * 变量名:sign
+   * 是否必填:是
+   * 类型:string
+   * 描述:
+   *  签名计算值。
+   *  签名方式:HMAC-SHA256。
+   *  签名规则:详见《V2 签名规则》 https://pay.weixin.qq.com/wiki/doc/api/wxpay_v2/jiekouguize/chapter1_1.shtml
+   *  参与签名字段说明
+   *  注意:为了安全,签名必须在后台服务器计算,禁止在H5中计算,签名 key 为微信支付 apiv2 的 signkey
+   *  示例值:9A0A8659F005D6984697E2CA0A9CF3B79A0A8659F005D6984697E2CA0A9CF3B7
+   * 
+ */ + @SerializedName(value = "sign") + private String sign; + + /** + *
+   * 字段名:发券商户号
+   * 变量名:send_coupon_merchant
+   * 是否必填:是
+   * 类型:string[1,15]
+   * 描述:
+   *  调用发券接口的商户号
+   * 
+ */ + @SerializedName(value = "send_coupon_merchant") + private String sendCouponMerchant; + + /** + *
+   * 字段名:用户标识
+   * 变量名:openid
+   * 是否必填:是
+   * 类型:string[1,128]
+   * 描述:
+   *   目标发券的用户openid
+   * 
+ */ + @SerializedName(value = "openid") + private String openid; +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorCouponsUseRequest.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorCouponsUseRequest.java new file mode 100644 index 0000000000..ab8a8ba2a5 --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorCouponsUseRequest.java @@ -0,0 +1,103 @@ +package com.github.binarywang.wxpay.bean.marketing; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 核销用户券请求对象 + *
+ *   文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_3.shtml
+ * 
+ * + * @author yujam + */ +@Data +@NoArgsConstructor +public class BusiFavorCouponsUseRequest { + public static final float serialVersionUID = 1L; + + /** + *
+   * 字段名:券code
+   * 变量名:coupon_code
+   * 是否必填:是
+   * 类型:string[1,32]
+   * 描述:
+   * 券的唯一标识。
+   * 示例值:sxxe34343434
+   * 
+ */ + @SerializedName(value = "coupon_code") + private String couponCode; + + /** + *
+   * 字段名:批次号
+   * 变量名:stock_id
+   * 是否必填:否
+   * 类型:string[1,20]
+   * 描述:
+   * 微信为每个商家券批次分配的唯一ID,批次券Code模式是MERCHANT_API或者MERCHANT_UPLOAD时,核销时必须填写批次号
+   * 示例值:100088
+   * 
+ */ + @SerializedName(value = "stock_id") + private String stockId; + + /** + *
+   * 字段名:公众账号ID
+   * 变量名:appid
+   * 是否必填:是
+   * 类型:string[1,32]
+   * 描述:
+   * 支持传入与当前调用接口商户号有绑定关系的appid。支持小程序appid与公众号appid。核销接口返回的openid会在该传入appid下进行计算获得。
+   * 示例值:wx1234567889999
+   * 
+ */ + @SerializedName(value = "appid") + private String appId; + + /** + *
+   * 字段名:请求核销时间
+   * 变量名:use_time
+   * 是否必填:是
+   * 类型:string[1,32]
+   * 描述:
+   * 商户请求核销用户券的时间。 遵循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秒。
+   * 示例值:2015-05-20T13:29:35+08:00
+   * 
+ */ + @SerializedName(value = "use_time") + private String useTime; + + /** + *
+   * 字段名:核销请求单据号
+   * 变量名:use_request_no
+   * 是否必填:是
+   * 类型:string[1,32]
+   * 描述:
+   * 每次核销请求的唯一标识,商户需保证唯一。
+   * 示例值:1002600620019090123143254435
+   * 
+ */ + @SerializedName(value = "use_request_no") + private String useRequestNo; + + /** + *
+   * 字段名:用户标识
+   * 变量名:openid
+   * 是否必填:是
+   * 类型:string[1,128]
+   * 描述:
+   * 用户的唯一标识,做安全校验使用,非必填。
+   * 示例值:xsd3434454567676
+   * 
+ */ + @SerializedName(value = "openid") + private String openid; +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorCouponsUseResult.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorCouponsUseResult.java new file mode 100644 index 0000000000..56475da2cf --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorCouponsUseResult.java @@ -0,0 +1,63 @@ +package com.github.binarywang.wxpay.bean.marketing; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 核销用户券返回对象 + *
+ *   文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_3.shtml
+ * 
+ * + * @author yujam + */ +@Data +@NoArgsConstructor +public class BusiFavorCouponsUseResult implements Serializable { + private static final long serialVersionUID = 1L; + + /** + *
+   * 字段名:批次号
+   * 变量名:stock_id
+   * 是否必填:是
+   * 类型:string[1,20]
+   * 描述:
+   * 微信为每个商家券批次分配的唯一ID
+   * 示例值: 100088
+   * 
+ */ + @SerializedName(value = "stock_id") + private String stockId; + + /** + *
+   * 字段名:用户标识
+   * 变量名:openid
+   * 是否必填:是
+   * 类型:string[1,128]
+   * 描述:
+   * 用户在公众号内的唯一身份标识。
+   * 示例值:dsadas34345454545
+   * 
+ */ + @SerializedName(value = "openid") + private String openid; + + /** + *
+   * 字段名:系统核销券成功的时间
+   * 变量名:wechatpay_use_time
+   * 是否必填:是
+   * 类型:string[1,32]
+   * 描述:
+   * 系统成功核销券的时间,遵循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秒。
+   * 示例值:2015-05-20T13:29:35+08:00
+   * 
+ */ + @SerializedName(value = "wechatpay_use_time") + private String wechatpayUseTime; +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorNotifyRequest.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorNotifyRequest.java new file mode 100644 index 0000000000..fa35ab59a9 --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorNotifyRequest.java @@ -0,0 +1,158 @@ +package com.github.binarywang.wxpay.bean.marketing; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 领券事件回调通知API请求对象 + *
+ *   文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_15.shtml
+ * 
+ * + * @author yujam + */ +@Data +@NoArgsConstructor +public class BusiFavorNotifyRequest implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + *
* 字段名:通知ID
+   * 变量名:id
+   * 是否必填:是
+   * 类型:string[1,36]
+   * 描述:
+   * 通知的唯一id。 示例值:8b33f79f-8869-5ae5-b41b-3c0b59f957d0
+   * 
+ */ + @SerializedName(value = "id") + private String id; + + /** + *
* 字段名:通知创建时间
+   * 变量名:create_time
+   * 是否必填:是
+   * 类型:string[1,32]
+   * 描述:
+   * 通知创建的时间,遵循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秒。 示例值:2019-12-12T16:54:38+08:00
+   * 
+ */ + @SerializedName(value = "create_time") + private String createTime; + + /** + *
* 字段名:通知类型
+   * 变量名:event_type
+   * 是否必填:是
+   * 类型:string[1,32]
+   * 描述:
+   * 券的回调通知类型,枚举值: COUPON.SEND:领券 示例值:COUPON.SEND
+   * 
+ */ + @SerializedName(value = "event_type") + private String eventType; + + /** + *
* 字段名:通知数据类型
+   * 变量名:resource_type
+   * 是否必填:是
+   * 类型:string[1,32]
+   * 描述:
+   * 通知的资源数据类型,券的回调通知为encrypt-resource。 示例值:encrypt-resource
+   * 
+ */ + @SerializedName(value = "resource_type") + private String resourceType; + + /** + *
* 字段名:回调摘要
+   * 变量名:summary
+   * 是否必填:是
+   * 类型:string[1,64]
+   * 描述:
+   * 回调摘要 示例值:商家券领券通知
+   * 
+ */ + @SerializedName(value = "summary") + private String summary; + + /** + *
* 字段名:+通知数据
+   * 变量名:resource
+   * 是否必填:是
+   * 类型:object
+   * 描述:
+   * 通知资源数据。 json格式,见示例
+   * 
+ */ + @SerializedName(value = "resource") + private Resource resource; + + @Data + @NoArgsConstructor + public static class Resource { + /** + *
* 字段名:加密算法类型
+     * 变量名:algorithm
+     * 是否必填:是
+     * 类型:string[1,32]
+     * 描述:
+     * 对开启结果数据进行加密的加密算法,目前只支持AEAD_AES_256_GCM。 示例值:AEAD_AES_256_GCM
+     * 
+ */ + @SerializedName(value = "algorithm") + private String algorithm; + + /** + *
* 字段名:数据密文
+     * 变量名:ciphertext
+     * 是否必填:是
+     * 类型:string[1,1048576]
+     * 描述:
+     * Base64编码后的开启/停用结果数据密文。
+     * 
+ */ + @SerializedName(value = "ciphertext") + private String ciphertext; + + /** + *
* 字段名:附加数据
+     * 变量名:associated_data
+     * 是否必填:否
+     * 类型:string[1,16]
+     * 描述:
+     * 附加数据 示例值:coupon
+     * 
+ */ + @SerializedName(value = "associated_data") + private String associatedData; + + /** + *
* 字段名:随机串
+     * 变量名:nonce
+     * 是否必填:是
+     * 类型:string[1,16]
+     * 描述:
+     * 加密使用的随机串。 示例值:j9g1wAzF9Xn1
+     * 
+ */ + @SerializedName(value = "nonce") + private String nonce; + + /** + *
* 字段名:原始回调类型
+     * 变量名:original_type
+     * 是否必填:是
+     * 类型:string[1,64]
+     * 描述:
+     * 原始回调类型,券的原始回调类型为coupon 示例值:coupon
+     * 
+ */ + @SerializedName(value = "original_type") + private String originalType; + } +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorNotifyResult.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorNotifyResult.java new file mode 100644 index 0000000000..0cc64c9ab6 --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorNotifyResult.java @@ -0,0 +1,46 @@ +package com.github.binarywang.wxpay.bean.marketing; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 领券事件回调通知API返回对象 + *
+ *   文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_15.shtml
+ * 
+ * + * @author yujam + */ +@Data +@NoArgsConstructor +public class BusiFavorNotifyResult implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + *
* 字段名:返回状态码
+   * 变量名:code
+   * 是否必填:是
+   * 类型:string[1,32]
+   * 描述:
+   * 错误码,SUCCESS为清算机构接收成功,其他错误码为失败。 示例值:SUCCESS
+   * 
+ */ + @SerializedName(value = "code") + private String code; + + /** + *
* 字段名:返回信息
+   * 变量名:message
+   * 是否必填:是
+   * 类型:string[1,64]
+   * 描述:
+   * 返回信息,如非空,为错误原因。 示例值:系统错误
+   * 
+ */ + @SerializedName(value = "message") + private String message; +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorQueryOneUserCouponsRequest.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorQueryOneUserCouponsRequest.java new file mode 100644 index 0000000000..3dad3fe5d1 --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorQueryOneUserCouponsRequest.java @@ -0,0 +1,57 @@ +package com.github.binarywang.wxpay.bean.marketing; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 查询用户单张券详情API请求对象 + *
+ *   文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_5.shtml
+ * 
+ * + * @author yujam + */ +@Data +@NoArgsConstructor +public class BusiFavorQueryOneUserCouponsRequest implements Serializable { + public static final float serialVersionUID = 1L; + + /** + *
* 字段名:用户标识
+   * 变量名:openid
+   * 是否必填:是
+   * 类型:string[1,128]
+   * 描述:
+   * path Openid信息,用户在appid下的唯一标识。 示例值:2323dfsdf342342
+   * 
+ */ + @SerializedName(value = "openid") + private String openid; + + /** + *
* 字段名:公众账号ID
+   * 变量名:appid
+   * 是否必填:是
+   * 类型:string[1,32]
+   * 描述:
+   * query 支持传入与当前调用接口商户号有绑定关系的appid。支持小程序appid与公众号appid。 示例值:wx233544546545989
+   * 
+ */ + @SerializedName(value = "appid") + private String appid; + + /** + *
* 字段名:券code
+   * 变量名:coupon_code
+   * 是否必填:是
+   * 类型:string[1,32]
+   * 描述:
+   * path 券的唯一标识。 示例值:123446565767
+   * 
+ */ + @SerializedName(value = "coupon_code") + private String couponCode; +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorQueryOneUserCouponsResult.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorQueryOneUserCouponsResult.java new file mode 100644 index 0000000000..6db7d303a9 --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorQueryOneUserCouponsResult.java @@ -0,0 +1,252 @@ +package com.github.binarywang.wxpay.bean.marketing; + +import com.github.binarywang.wxpay.bean.marketing.busifavor.CouponUseRule; +import com.github.binarywang.wxpay.bean.marketing.busifavor.CustomEntrance; +import com.github.binarywang.wxpay.bean.marketing.busifavor.DisplayPatternInfo; +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 查询用户单张券详情API返回对象 + *
+ *   文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_5.shtml
+ * 
+ * + * @author yujam + */ +@Data +@NoArgsConstructor +public class BusiFavorQueryOneUserCouponsResult implements Serializable { + public static final float serialVersionUID = 1L; + + /** + *
* 字段名:批次归属商户号
+   * 变量名:belong_merchant
+   * 是否必填:是
+   * 类型:string[8,15]
+   * 描述:
+   * 批次归属于哪个商户。 示例值:10000022
+   * 
+ */ + @SerializedName(value = "belong_merchant") + private String belongMerchant; + + /** + *
* 字段名:商家券批次名称
+   * 变量名:stock_name
+   * 是否必填:是
+   * 类型:string[1,21]
+   * 描述:
+   * 批次名称,字数上限为21个,一个中文汉字/英文字母/数字均占用一个字数。 示例值:商家券
+   * 
+ */ + @SerializedName(value = "stock_name") + private String stockName; + + /** + *
* 字段名:批次备注
+   * 变量名:comment
+   * 是否必填:否
+   * 类型:string[1,20]
+   * 描述:
+   * 仅配置商户可见,用于自定义信息。字数上限为20个,一个中文汉字/英文字母/数字均占用一个字数。 示例值:xxx可用
+   * 
+ */ + @SerializedName(value = "comment") + private String comment; + + /** + *
* 字段名:适用商品范围
+   * 变量名:goods_name
+   * 是否必填:是
+   * 类型:string[1,15]
+   * 描述:
+   * 适用商品范围,字数上限为15个,一个中文汉字/英文字母/数字均占用一个字数。 示例值:xxx商品可用
+   * 
+ */ + @SerializedName(value = "goods_name") + private String goodsName; + + /** + *
* 字段名:批次类型
+   * 变量名:stock_type
+   * 是否必填:是
+   * 类型:string[1,128]
+   * 描述:
+   * 批次类型 NORMAL:固定面额满减券批次 DISCOUNT:折扣券批次 EXCHANGE:换购券批次 示例值:NORMAL
+   * 
+ */ + @SerializedName(value = "stock_type") + private String stockType; + + /** + *
* 字段名:是否允许转赠
+   * 变量名:transferable
+   * 是否必填:否
+   * 类型:bool
+   * 描述:
+   * 不填默认否,枚举值: true:是 false:否 该字段暂未开放 示例值:false
+   * 
+ */ + @SerializedName(value = "transferable") + private Boolean transferable; + + /** + *
* 字段名:是否允许分享领券链接
+   * 变量名:shareable
+   * 是否必填:否
+   * 类型:bool
+   * 描述:
+   * 不填默认否,枚举值: true:是 false:否 该字段暂未开放 示例值:false
+   * 
+ */ + @SerializedName(value = "shareable") + private Boolean shareable; + + /** + *
* 字段名:券状态
+   * 变量名:coupon_state
+   * 是否必填:否
+   * 类型:string[1,16]
+   * 描述:
+   * 商家券状态 枚举值: SENDED:可用 USED:已核销 EXPIRED:已过期 示例值:SENDED
+   * 
+ */ + @SerializedName(value = "coupon_state") + private String couponState; + + /** + *
* 字段名:+样式信息
+   * 变量名:display_pattern_info
+   * 是否必填:否
+   * 类型:object
+   * 描述:
+   * 商家券详细信息
+   * 
+ */ + @SerializedName(value = "display_pattern_info") + private DisplayPatternInfo displayPatternInfo; + + /** + *
* 字段名:+券核销规则
+   * 变量名:coupon_use_rule
+   * 是否必填:是
+   * 类型:券核销规则
+   * 描述:
+   * 券核销相关规则
+   * 
+ */ + @SerializedName(value = "coupon_use_rule") + private CouponUseRule couponUseRule; + + /** + *
* 字段名:+自定义入口
+   * 变量名:custom_entrance
+   * 是否必填:否
+   * 类型:object
+   * 描述:
+   * 卡详情页面,可选择多种入口引导用户。
+   * 
+ */ + @SerializedName(value = "custom_entrance") + private CustomEntrance customEntrance; + + /** + *
* 字段名:券code
+   * 变量名:coupon_code
+   * 是否必填:否
+   * 类型:string[1,32]
+   * 描述:
+   * 券的唯一标识。 示例值:123446565767
+   * 
+ */ + @SerializedName(value = "coupon_code") + private String couponCode; + + /** + *
* 字段名:批次号
+   * 变量名:stock_id
+   * 是否必填:否
+   * 类型:string[1,20]
+   * 描述:
+   * 微信为每个商家券批次分配的唯一ID,是否指定批次号查询。 示例值:1002323
+   * 
+ */ + @SerializedName(value = "stock_id") + private String stockId; + + /** + *
* 字段名:券可使用开始时间
+   * 变量名:available_start_time
+   * 是否必填:是
+   * 类型:string[1,32]
+   * 描述:
+   * 1、用户领取到该张券实际可使用的开始时间,遵循rfc3339标准格式,格式为YYYY-MM-DDTHH:mm:ss+TIMEZONE,YYYY-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间)。例如:2015-05-20T13:29:35.+08:00表示,北京时间2015年5月20日 13点29分35秒。 示例值:2015-05-20T13:29:35+08:00
+   * 
+ */ + @SerializedName(value = "available_start_time") + private String availableStartTime; + + /** + *
* 字段名:券过期时间
+   * 变量名:expire_time
+   * 是否必填:是
+   * 类型:string[1,32]
+   * 描述:
+   * 用户领取到该张券的过期时间,遵循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秒。 示例值:2015-05-20T13:29:35+08:00
+   * 
+ */ + @SerializedName(value = "expire_time") + private String expireTime; + + /** + *
* 字段名:券领券时间
+   * 变量名:receive_time
+   * 是否必填:是
+   * 类型:string[1,32]
+   * 描述:
+   * 用户领取到该张券的时间,遵循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秒。 示例值:2015-05-20T13:29:35+08:00
+   * 
+ */ + @SerializedName(value = "receive_time") + private String receiveTime; + + /** + *
* 字段名:发券请求单号
+   * 变量名:send_request_no
+   * 是否必填:是
+   * 类型:string[1,32]
+   * 描述:
+   * 发券时传入的唯一凭证 示例值: MCHSEND202003101234
+   * 
+ */ + @SerializedName(value = "send_request_no") + private String sendRequestNo; + + /** + *
* 字段名:核销请求单号
+   * 变量名:use_request_no
+   * 是否必填:否
+   * 类型:string[1,32]
+   * 描述:
+   * 核销时传入的唯一凭证(如券已被核销,将返回此字段) 示例值: MCHUSE202003101234
+   * 
+ */ + @SerializedName(value = "use_request_no") + private String useRequestNo; + + /** + *
* 字段名:券核销时间
+   * 变量名:use_time
+   * 是否必填:否
+   * 类型:string[1,32]
+   * 描述:
+   * 券被核销的时间(如券已被核销,将返回此字段);遵循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秒。 示例值:2015-05-20T13:29:35+08:00
+   * 
+ */ + @SerializedName(value = "use_time") + private String useTime; +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorQueryUserCouponsRequest.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorQueryUserCouponsRequest.java new file mode 100644 index 0000000000..600a48c8de --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorQueryUserCouponsRequest.java @@ -0,0 +1,129 @@ +package com.github.binarywang.wxpay.bean.marketing; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 根据过滤条件查询用户券请求对象 + *
+ *   文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_4.shtml
+ * 
+ * + * @author yujam + */ +@Data +@NoArgsConstructor +public class BusiFavorQueryUserCouponsRequest implements Serializable { + public static final float serialVersionUID = 1L; + + /** + *
* 字段名:用户标识
+   * 变量名:openid
+   * 是否必填:是
+   * 类型:string[1,128]
+   * 描述:
+   * path Openid信息,用户在appid下的唯一标识。 示例值:2323dfsdf342342
+   * 
+ */ + @SerializedName(value = "openid") + private String openid; + + /** + *
* 字段名:公众账号ID
+   * 变量名:appid
+   * 是否必填:是
+   * 类型:string[1,32]
+   * 描述:
+   * query 支持传入与当前调用接口商户号有绑定关系的appid。支持小程序appid与公众号appid。 示例值:wx233544546545989
+   * 
+ */ + @SerializedName(value = "appid") + private String appid; + + /** + *
* 字段名:批次号
+   * 变量名:stock_id
+   * 是否必填:否
+   * 类型:string[1,20]
+   * 描述:
+   * query 微信为每个商家券批次分配的唯一ID,是否指定批次号查询。 示例值:9865000
+   * 
+ */ + @SerializedName(value = "stock_id") + private String stockId; + + /** + *
* 字段名:券状态
+   * 变量名:coupon_state
+   * 是否必填:否
+   * 类型:string[1,16]
+   * 描述:
+   * query 券状态 枚举值: SENDED:可用 USED:已核销 EXPIRED:已过期 示例值:SENDED
+   * 
+ */ + @SerializedName(value = "coupon_state") + private String couponState; + + /** + *
* 字段名:创建批次的商户号
+   * 变量名:creator_merchant
+   * 是否必填:否
+   * 类型:string[1,32]
+   * 描述:
+   * query 批次创建方商户号 示例值:1000000001
+   * 
+ */ + @SerializedName(value = "creator_merchant") + private String creatorMerchant; + + /** + *
* 字段名:批次归属商户号
+   * 变量名:belong_merchant
+   * 是否必填:否
+   * 类型:string[8,15]
+   * 描述:
+   * query 批次归属商户号 示例值:1000000002
+   * 
+ */ + @SerializedName(value = "belong_merchant") + private String belongMerchant; + + /** + *
* 字段名:批次发放商户号
+   * 变量名:sender_merchant
+   * 是否必填:否
+   * 类型:string[1,32]
+   * 描述:
+   * query 批次发放商户号 示例值:1000000003
+   * 
+ */ + @SerializedName(value = "sender_merchant") + private String senderMerchant; + + /** + *
* 字段名:分页页码
+   * 变量名:offset
+   * 是否必填:否
+   * 类型:int
+   * 描述:
+   * query 分页页码 示例值:0
+   * 
+ */ + @SerializedName(value = "offset") + private Integer offset; + + /** + *
* 字段名:分页大小
+   * 变量名:limit
+   * 是否必填:否
+   * 类型:int
+   * 描述:
+   * query 分页大小 示例值:20
+   * 
+ */ + @SerializedName(value = "limit") + private Integer limit; +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorQueryUserCouponsResult.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorQueryUserCouponsResult.java new file mode 100644 index 0000000000..9b5f57b040 --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorQueryUserCouponsResult.java @@ -0,0 +1,71 @@ +package com.github.binarywang.wxpay.bean.marketing; + +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/apis/chapter9_2_4.shtml
+ * 
+ * + * @author yujam + */ +@Data +@NoArgsConstructor +public class BusiFavorQueryUserCouponsResult implements Serializable { + public static final float serialVersionUID = 1L; + + /** + *
* 字段名:+结果集
+   * 变量名:data
+   * 是否必填:是
+   * 类型:array
+   * 描述:
+   * 结果集
+   * 
+ */ + @SerializedName(value = "data") + private List data; + + /** + *
* 字段名:总数量
+   * 变量名:total_count
+   * 是否必填:是
+   * 类型:int
+   * 描述:
+   * 总数量 示例值: 100
+   * 
+ */ + @SerializedName(value = "total_count") + private Integer totalCount; + + /** + *
* 字段名:分页页码
+   * 变量名:offset
+   * 是否必填:是
+   * 类型:int
+   * 描述:
+   * 分页页码 示例值:1
+   * 
+ */ + @SerializedName(value = "offset") + private Integer offset; + + /** + *
* 字段名:分页大小
+   * 变量名:limit
+   * 是否必填:是
+   * 类型:int
+   * 描述:
+   * 分页大小 示例值:10
+   * 
+ */ + @SerializedName(value = "limit") + private Integer limit; + +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorStocksBudgetRequest.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorStocksBudgetRequest.java new file mode 100644 index 0000000000..bf8479142f --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorStocksBudgetRequest.java @@ -0,0 +1,92 @@ +package com.github.binarywang.wxpay.bean.marketing; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 修改批次预算请求对象 + * 文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_11.shtml + * + * @author yujam + */ +@Data +@NoArgsConstructor +public class BusiFavorStocksBudgetRequest implements Serializable { + private static final long serialVersionUID = 1L; + + /** + *
* 字段名:批次号
+   * 变量名:stock_id
+   * 是否必填:是
+   * 类型:string[1,20]
+   * 描述:
+   * path批次号 示例值:98065001
+   * 
+ */ + @SerializedName(value = "stock_id") + private String stockId; + + /** + *
* 字段名:目标批次最大发放个数
+   * 变量名:target_max_coupons
+   * 是否必填:二选一
+   * 类型:int
+   * 描述:
+   * body批次最大发放个数 示例值:3000
+   * 
+ */ + @SerializedName(value = "target_max_coupons") + private Integer targetMaxCoupons; + + /** + *
* 字段名:目标单天发放上限个数
+   * 变量名:target_max_coupons
+   * 是否必填:二选一
+   * 类型:int
+   * 描述:
+   * body 目标单天发放上限个数 示例值:3000
+   * 
+ */ + @SerializedName(value = "target_max_coupons_by_day") + private Integer targetMaxCouponsByDay; + + /** + *
* 字段名:当前批次最大发放个数
+   * 变量名:current_max_coupons
+   * 是否必填:否
+   * 类型:int
+   * 描述:
+   * body当前批次最大发放个数,当传入target_max_coupons大于0时,current_max_coupons必传 示例值:500
+   * 
+ */ + @SerializedName(value = "current_max_coupons") + private Integer currentMaxCoupons; + + /** + *
* 字段名:当前单天发放上限个数
+   * 变量名:current_max_coupons_by_day
+   * 是否必填:否
+   * 类型:int
+   * 描述:
+   * body当前单天发放上限个数 ,当传入target_max_coupons_by_day大于0时,current_max_coupons_by_day必填 示例值:300
+   * 
+ */ + @SerializedName(value = "current_max_coupons_by_day") + private Integer currentMaxCouponsByDay; + + /** + *
* 字段名:修改预算请求单据号
+   * 变量名:modify_budget_request_no
+   * 是否必填:是
+   * 类型:string[1,128]
+   * 描述:
+   * body修改预算请求单据号 示例值:1002600620019090123143254436
+   * 
+ */ + @SerializedName(value = "modify_budget_request_no") + private String modifyBudgetRequestNo; + +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorStocksBudgetResult.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorStocksBudgetResult.java new file mode 100644 index 0000000000..0d751f71f8 --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorStocksBudgetResult.java @@ -0,0 +1,43 @@ +package com.github.binarywang.wxpay.bean.marketing; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 修改批次预算返回对象 + * 文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_11.shtml + * + * @author yujam + */ +@Data +@NoArgsConstructor +public class BusiFavorStocksBudgetResult implements Serializable { + private static final long serialVersionUID = 1L; + + /** + *
* 字段名:批次当前最大发放个数
+   * 变量名:max_coupons
+   * 是否必填:是
+   * 类型:int
+   * 描述:
+   * 批次最大发放个数 示例值:300
+   * 
+ */ + @SerializedName(value = "max_coupons") + private Integer maxCoupons; + + /** + *
* 字段名:当前单天发放上限个数
+   * 变量名:max_coupons_by_day
+   * 是否必填:否
+   * 类型:int
+   * 描述:
+   * 当前单天发放上限个数 示例值:100
+   * 
+ */ + @SerializedName(value = "max_coupons_by_day") + private Integer maxCouponsByDay; +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorStocksCreateRequest.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorStocksCreateRequest.java new file mode 100644 index 0000000000..3b07d495eb --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorStocksCreateRequest.java @@ -0,0 +1,196 @@ +package com.github.binarywang.wxpay.bean.marketing; + +import com.github.binarywang.wxpay.bean.marketing.busifavor.*; +import com.github.binarywang.wxpay.bean.marketing.enums.StockTypeEnum; +import com.google.gson.annotations.SerializedName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 创建商家券批次 + *
+ *   文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_1.shtml
+ * 
+ * + * @author yujam + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class BusiFavorStocksCreateRequest implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + *
+   * 字段名:批次名称
+   * 变量名:stock_name
+   * 是否必填:是
+   * 类型:string[1,21]
+   * 描述:
+   *  批次名称
+   *  校验规则:
+   *  1、批次名称最多9个中文汉字
+   *  2、批次名称最多20个字母
+   *  3、批次名称中不能包含不当内容和特殊字符 _ , ; |
+   *  示例值:微信支付代金券批次
+   * 
+ */ + @SerializedName(value = "stock_name") + private String stockName; + + /** + *
+   * 字段名:归属商户号
+   * 变量名:belong_merchant
+   * 是否必填:是
+   * 类型:string[8,15]
+   * 描述:
+   *  批次归属商户号
+   *  该字段暂未开放
+   *  示例值:98568865
+   * 
+ */ + @SerializedName(value = "belong_merchant") + private String belongMerchant; + + /** + *
+   * 字段名:批次备注
+   * 变量名:comment
+   * 是否必填:否
+   * 类型:string[1,20]
+   * 描述:
+   *  仅制券商户可见,用于自定义信息。
+   *  校验规则:批次备注最多60个UTF8字符数
+   *  示例值:零售批次
+   * 
+ */ + @SerializedName(value = "comment") + private String comment; + + /** + *
+   * 字段名:适用商品范围
+   * 变量名:goods_name
+   * 是否必填:是
+   * 类型:string[1,15]
+   * 描述:
+   *  用来描述批次在哪些商品可用,会显示在微信卡包中。字数上限为15个,一个中文汉字/英文字母/数字均占用一个字数。
+   *  示例值:xxx商品使用
+   * 
+ */ + @SerializedName(value = "goods_name") + private String goodsName; + + /** + *
+   * 字段名:批次类型
+   * 变量名:stock_type
+   * 是否必填:是
+   * 类型:string[1,32]
+   * 描述:
+   *  批次类型
+   *  NORMAL:固定面额满减券批次
+   *  DISCOUNT:折扣券批次
+   *  EXCHANGE:换购券批次
+   *  示例值:NORMAL
+   * 
+ */ + @SerializedName(value = "stock_type") + private StockTypeEnum stockType; + + /** + *
+   * 字段名:核销规则
+   * 变量名:coupon_use_rule
+   * 是否必填:是
+   * 类型:object
+   * 描述:核销规则
+   * 
+ */ + @SerializedName(value = "coupon_use_rule") + private CouponUseRule couponUseRule; + + /** + *
+   *   字段名:券发放相关规则
+   *   变量名:stock_send_rule
+   *   是否必填:是
+   *   类型:object
+   *   描述:券发放相关规则
+   * 
+ */ + @SerializedName(value = "stock_send_rule") + private StockSendRule stockSendRule; + + /** + *
+   * 字段名:商户单据号
+   * 变量名:out_request_no
+   * 是否必填:是
+   * 类型:string[1,128]
+   * 描述:
+   *  商户创建批次凭据号(格式:商户id+日期+流水号),可包含英文字母,数字,|,_,*,-等内容,不允许出现其他不合法符号,商户侧需保持商户单据号全局唯一。
+   * 
+ */ + @SerializedName(value = "out_request_no") + private String outRequestNo; + + /** + *
+   *   字段名:自定义入口
+   *   变量名:custom_entrance
+   *   是否必填:否
+   *   类型:object
+   *   描述:卡详情页面,可选择多种入口引导用户。
+   * 
+ */ + @SerializedName(value = "custom_entrance") + private CustomEntrance customEntrance; + + /** + *
+   *   字段名:样式信息
+   *   变量名:display_pattern_info
+   *   是否必填:否
+   *   类型:object
+   *   描述:创建批次时的样式信息。
+   * 
+ */ + @SerializedName(value = "display_pattern_info") + private DisplayPatternInfo displayPatternInfo; + + /** + *
+   *   字段名:券code模式
+   *   变量名:coupon_code_mode
+   *   是否必填:是
+   *   类型:string[1,128]
+   *   描述:枚举值:
+   * WECHATPAY_MODE:系统分配券code。(固定22位纯数字)
+   * MERCHANT_API:商户发放时接口指定券code。
+   * MERCHANT_UPLOAD:商户上传自定义code,发券时系统随机选取上传的券code。
+   * 
+ */ + @SerializedName(value = "coupon_code_mode") + private String couponCodeMode; + + /** + *
+   *   字段名:事件通知配置
+   *   变量名:notify_config
+   *   是否必填:否
+   *   类型:object
+   *   描述:事件回调通知商户的配置
+   * 
+ */ + @SerializedName(value = "notify_config") + private NotifyConfig notifyConfig; + +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorStocksCreateResult.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorStocksCreateResult.java new file mode 100644 index 0000000000..361b320c44 --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorStocksCreateResult.java @@ -0,0 +1,48 @@ +package com.github.binarywang.wxpay.bean.marketing; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 创建商家券返回对象 + * 文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_1.shtml + * + * @author yujam + */ +@NoArgsConstructor +@Data +public class BusiFavorStocksCreateResult implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + *
+   * 字段名:批次号
+   * 变量名:stock_id
+   * 是否必填:是
+   * 类型:string[1,20]
+   * 描述:
+   * 微信为每个商家券批次分配的唯一ID
+   * 示例值: 98065001
+   * 
+ */ + @SerializedName("stock_id") + private String stockId; + + /** + *
+   * 字段名:创建时间
+   * 变量名:create_time
+   * 是否必填:是
+   * 类型:string[1,32]
+   * 描述:
+   *  遵循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秒。
+   *  示例值:2015-05-20T13:29:35+08:00
+   * 
+ */ + @SerializedName("create_time") + private String createTime; +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorStocksGetResult.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorStocksGetResult.java new file mode 100644 index 0000000000..e47345001b --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorStocksGetResult.java @@ -0,0 +1,265 @@ +package com.github.binarywang.wxpay.bean.marketing; + +import com.github.binarywang.wxpay.bean.marketing.busifavor.*; +import com.github.binarywang.wxpay.bean.marketing.enums.StockTypeEnum; +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 商家券详情返回对象 + *
+ *   文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_2.shtml
+ * 
+ * + * @author yujam + */ +@Data +@NoArgsConstructor +public class BusiFavorStocksGetResult { + + private static final long serialVersionUID = 1L; + + /** + *
+   * 字段名:批次名称
+   * 变量名:stock_name
+   * 是否必填:是
+   * 类型:string[1,21]
+   * 描述:
+   *  批次名称
+   *  校验规则:
+   *  1、批次名称最多9个中文汉字
+   *  2、批次名称最多20个字母
+   *  3、批次名称中不能包含不当内容和特殊字符 _ , ; |
+   *  示例值:微信支付代金券批次
+   * 
+ */ + @SerializedName(value = "stock_name") + private String stockName; + + /** + *
+   * 字段名:归属商户号
+   * 变量名:belong_merchant
+   * 是否必填:是
+   * 类型:string[8,15]
+   * 描述:
+   *  批次归属商户号
+   *  该字段暂未开放
+   *  示例值:98568865
+   * 
+ */ + @SerializedName(value = "belong_merchant") + private String belongMerchant; + + /** + *
+   * 字段名:批次备注
+   * 变量名:comment
+   * 是否必填:否
+   * 类型:string[1,20]
+   * 描述:
+   *  仅制券商户可见,用于自定义信息。
+   *  校验规则:批次备注最多60个UTF8字符数
+   *  示例值:零售批次
+   * 
+ */ + @SerializedName(value = "comment") + private String comment; + + /** + *
+   * 字段名:适用商品范围
+   * 变量名:goods_name
+   * 是否必填:是
+   * 类型:string[1,15]
+   * 描述:
+   *  用来描述批次在哪些商品可用,会显示在微信卡包中。字数上限为15个,一个中文汉字/英文字母/数字均占用一个字数。
+   *  示例值:xxx商品使用
+   * 
+ */ + @SerializedName(value = "goods_name") + private String goodsName; + + /** + *
+   * 字段名:批次类型
+   * 变量名:stock_type
+   * 是否必填:是
+   * 类型:string[1,32]
+   * 描述:
+   *  批次类型
+   *  NORMAL:固定面额满减券批次
+   *  DISCOUNT:折扣券批次
+   *  EXCHANGE:换购券批次
+   *  示例值:NORMAL
+   * 
+ */ + @SerializedName(value = "stock_type") + private StockTypeEnum stockType; + + /** + *
+   * 字段名:核销规则
+   * 变量名:coupon_use_rule
+   * 是否必填:是
+   * 类型:object
+   * 描述:核销规则
+   * 
+ */ + @SerializedName(value = "coupon_use_rule") + private CouponUseRule couponUseRule; + + /** + *
+   *   字段名:券发放相关规则
+   *   变量名:stock_send_rule
+   *   是否必填:是
+   *   类型:object
+   *   描述:券发放相关规则
+   * 
+ */ + @SerializedName(value = "stock_send_rule") + private StockSendRule stockSendRule; + + /** + *
+   * 字段名:商户单据号
+   * 变量名:out_request_no
+   * 是否必填:是
+   * 类型:string[1,128]
+   * 描述:
+   *  商户创建批次凭据号(格式:商户id+日期+流水号),可包含英文字母,数字,|,_,*,-等内容,不允许出现其他不合法符号,商户侧需保持商户单据号全局唯一。
+   * 
+ */ + @SerializedName(value = "out_request_no") + private String outRequestNo; + + /** + *
+   *   字段名:自定义入口
+   *   变量名:custom_entrance
+   *   是否必填:否
+   *   类型:object
+   *   描述:卡详情页面,可选择多种入口引导用户。
+   * 
+ */ + @SerializedName(value = "custom_entrance") + private CustomEntrance customEntrance; + + /** + *
+   *   字段名:样式信息
+   *   变量名:display_pattern_info
+   *   是否必填:否
+   *   类型:object
+   *   描述:创建批次时的样式信息。
+   * 
+ */ + @SerializedName(value = "display_pattern_info") + private DisplayPatternInfo displayPatternInfo; + + /** + *
+   *   字段名:券code模式
+   *   变量名:coupon_code_mode
+   *   是否必填:是
+   *   类型:string[1,128]
+   *   描述:枚举值:
+   * WECHATPAY_MODE:系统分配券code。(固定22位纯数字)
+   * MERCHANT_API:商户发放时接口指定券code。
+   * MERCHANT_UPLOAD:商户上传自定义code,发券时系统随机选取上传的券code。
+   * 
+ */ + @SerializedName(value = "coupon_code_mode") + private String couponCodeMode; + + /** + *
+   *   字段名:事件通知配置
+   *   变量名:notify_config
+   *   是否必填:否
+   *   类型:object
+   *   描述:事件回调通知商户的配置
+   * 
+ */ + @SerializedName(value = "notify_config") + private NotifyConfig notifyConfig; + + /** + *
+   *   字段名:批次发放情况
+   *   变量名:send_count_information
+   *   是否必填:否
+   *   类型:object
+   *   描述:批次发放情况
+   * 
+ */ + @SerializedName(value = "send_count_information") + private SendCountInformation sendCountInformation; + + @Data + @NoArgsConstructor + public static class SendCountInformation implements Serializable { + private static final long serialVersionUID = 1L; + + /** + *
+     * 字段名:已发放券张数
+     * 变量名:total_send_num
+     * 是否必填:否
+     * 类型:uint64
+     * 描述:
+     *  批次已发放的券数量,满减、折扣、换购类型会返回该字段
+     *  示例值:1
+     * 
+ */ + @SerializedName(value = "total_send_num") + private Integer totalSendNum; + + /** + *
+     * 字段名:已发放券金额
+     * 变量名:total_send_amount
+     * 是否必填:否
+     * 类型:uint64
+     * 描述:
+     *  批次已发放的预算金额,满减券类型会返回该字段
+     *  示例值:34
+     * 
+ */ + @SerializedName(value = "total_send_amount") + private Integer totalSendAmount; + + /** + *
+     * 字段名:单天已发放券张数
+     * 变量名:today_send_num
+     * 是否必填:否
+     * 类型:uint64
+     * 描述:
+     *  批次当天已发放的券数量,设置了单天发放上限的满减、折扣、换购类型返回该字段
+     *  示例值:1
+     * 
+ */ + @SerializedName(value = "today_send_num") + private String todaySendNum; + + /** + *
+     * 字段名:单天已发放券金额
+     * 变量名:today_send_amount
+     * 是否必填:否
+     * 类型:uint64
+     * 描述:
+     *  批次当天已发放的预算金额,设置了当天发放上限的满减券类型返回该字段
+     *  示例值:34
+     * 
+ */ + @SerializedName(value = "today_send_amount") + private String todaySendAmount; + } +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorStocksUserGetResult.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorStocksUserGetResult.java new file mode 100644 index 0000000000..a9a135ef20 --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorStocksUserGetResult.java @@ -0,0 +1,266 @@ +package com.github.binarywang.wxpay.bean.marketing; + +import com.github.binarywang.wxpay.bean.marketing.busifavor.*; +import com.github.binarywang.wxpay.bean.marketing.enums.StockTypeEnum; +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 用户单张券详情返回对象 + *
+ *   文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_5.shtml
+ * 
+ * TODO: + * + * @author yujam + */ +@Data +@NoArgsConstructor +public class BusiFavorStocksUserGetResult { + + private static final long serialVersionUID = 1L; + + /** + *
+   * 字段名:批次名称
+   * 变量名:stock_name
+   * 是否必填:是
+   * 类型:string[1,21]
+   * 描述:
+   *  批次名称
+   *  校验规则:
+   *  1、批次名称最多9个中文汉字
+   *  2、批次名称最多20个字母
+   *  3、批次名称中不能包含不当内容和特殊字符 _ , ; |
+   *  示例值:微信支付代金券批次
+   * 
+ */ + @SerializedName(value = "stock_name") + private String stockName; + + /** + *
+   * 字段名:归属商户号
+   * 变量名:belong_merchant
+   * 是否必填:是
+   * 类型:string[8,15]
+   * 描述:
+   *  批次归属商户号
+   *  该字段暂未开放
+   *  示例值:98568865
+   * 
+ */ + @SerializedName(value = "belong_merchant") + private String belongMerchant; + + /** + *
+   * 字段名:批次备注
+   * 变量名:comment
+   * 是否必填:否
+   * 类型:string[1,20]
+   * 描述:
+   *  仅制券商户可见,用于自定义信息。
+   *  校验规则:批次备注最多60个UTF8字符数
+   *  示例值:零售批次
+   * 
+ */ + @SerializedName(value = "comment") + private String comment; + + /** + *
+   * 字段名:适用商品范围
+   * 变量名:goods_name
+   * 是否必填:是
+   * 类型:string[1,15]
+   * 描述:
+   *  用来描述批次在哪些商品可用,会显示在微信卡包中。字数上限为15个,一个中文汉字/英文字母/数字均占用一个字数。
+   *  示例值:xxx商品使用
+   * 
+ */ + @SerializedName(value = "goods_name") + private String goodsName; + + /** + *
+   * 字段名:批次类型
+   * 变量名:stock_type
+   * 是否必填:是
+   * 类型:string[1,32]
+   * 描述:
+   *  批次类型
+   *  NORMAL:固定面额满减券批次
+   *  DISCOUNT:折扣券批次
+   *  EXCHANGE:换购券批次
+   *  示例值:NORMAL
+   * 
+ */ + @SerializedName(value = "stock_type") + private StockTypeEnum stockType; + + /** + *
+   * 字段名:核销规则
+   * 变量名:coupon_use_rule
+   * 是否必填:是
+   * 类型:object
+   * 描述:核销规则
+   * 
+ */ + @SerializedName(value = "coupon_use_rule") + private CouponUseRule couponUseRule; + + /** + *
+   *   字段名:券发放相关规则
+   *   变量名:stock_send_rule
+   *   是否必填:是
+   *   类型:object
+   *   描述:券发放相关规则
+   * 
+ */ + @SerializedName(value = "stock_send_rule") + private StockSendRule stockSendRule; + + /** + *
+   * 字段名:商户单据号
+   * 变量名:out_request_no
+   * 是否必填:是
+   * 类型:string[1,128]
+   * 描述:
+   *  商户创建批次凭据号(格式:商户id+日期+流水号),可包含英文字母,数字,|,_,*,-等内容,不允许出现其他不合法符号,商户侧需保持商户单据号全局唯一。
+   * 
+ */ + @SerializedName(value = "out_request_no") + private String outRequestNo; + + /** + *
+   *   字段名:自定义入口
+   *   变量名:custom_entrance
+   *   是否必填:否
+   *   类型:object
+   *   描述:卡详情页面,可选择多种入口引导用户。
+   * 
+ */ + @SerializedName(value = "custom_entrance") + private CustomEntrance customEntrance; + + /** + *
+   *   字段名:样式信息
+   *   变量名:display_pattern_info
+   *   是否必填:否
+   *   类型:object
+   *   描述:创建批次时的样式信息。
+   * 
+ */ + @SerializedName(value = "display_pattern_info") + private DisplayPatternInfo displayPatternInfo; + + /** + *
+   *   字段名:券code模式
+   *   变量名:coupon_code_mode
+   *   是否必填:是
+   *   类型:string[1,128]
+   *   描述:枚举值:
+   * WECHATPAY_MODE:系统分配券code。(固定22位纯数字)
+   * MERCHANT_API:商户发放时接口指定券code。
+   * MERCHANT_UPLOAD:商户上传自定义code,发券时系统随机选取上传的券code。
+   * 
+ */ + @SerializedName(value = "coupon_code_mode") + private String couponCodeMode; + + /** + *
+   *   字段名:事件通知配置
+   *   变量名:notify_config
+   *   是否必填:否
+   *   类型:object
+   *   描述:事件回调通知商户的配置
+   * 
+ */ + @SerializedName(value = "notify_config") + private NotifyConfig notifyConfig; + + /** + *
+   *   字段名:批次发放情况
+   *   变量名:send_count_information
+   *   是否必填:否
+   *   类型:object
+   *   描述:批次发放情况
+   * 
+ */ + @SerializedName(value = "send_count_information") + private SendCountInformation sendCountInformation; + + @Data + @NoArgsConstructor + public static class SendCountInformation implements Serializable { + private static final long serialVersionUID = 1L; + + /** + *
+     * 字段名:已发放券张数
+     * 变量名:total_send_num
+     * 是否必填:否
+     * 类型:uint64
+     * 描述:
+     *  批次已发放的券数量,满减、折扣、换购类型会返回该字段
+     *  示例值:1
+     * 
+ */ + @SerializedName(value = "total_send_num") + private Integer totalSendNum; + + /** + *
+     * 字段名:已发放券金额
+     * 变量名:total_send_amount
+     * 是否必填:否
+     * 类型:uint64
+     * 描述:
+     *  批次已发放的预算金额,满减券类型会返回该字段
+     *  示例值:34
+     * 
+ */ + @SerializedName(value = "total_send_amount") + private Integer totalSendAmount; + + /** + *
+     * 字段名:单天已发放券张数
+     * 变量名:today_send_num
+     * 是否必填:否
+     * 类型:uint64
+     * 描述:
+     *  批次当天已发放的券数量,设置了单天发放上限的满减、折扣、换购类型返回该字段
+     *  示例值:1
+     * 
+ */ + @SerializedName(value = "today_send_num") + private String todaySendNum; + + /** + *
+     * 字段名:单天已发放券金额
+     * 变量名:today_send_amount
+     * 是否必填:否
+     * 类型:uint64
+     * 描述:
+     *  批次当天已发放的预算金额,设置了当天发放上限的满减券类型返回该字段
+     *  示例值:34
+     * 
+ */ + @SerializedName(value = "today_send_amount") + private String todaySendAmount; + } +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorSubsidyRequest.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorSubsidyRequest.java new file mode 100644 index 0000000000..4924cb9416 --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorSubsidyRequest.java @@ -0,0 +1,118 @@ +package com.github.binarywang.wxpay.bean.marketing; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 营销补差付款请求对象 + *
+ *   文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_16.shtml
+ * 
+ * + * @author yujam + */ +@Data +@NoArgsConstructor +public class BusiFavorSubsidyRequest implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + *
* 字段名:商家券批次号
+   * 变量名:stock_id
+   * 是否必填:是
+   * 类型:string[1, 20]
+   * 描述:
+   * body由微信支付生成,调用创建商家券API成功时返回的唯一批次ID 仅支持“满减券”和“折扣券”的批次,“换购券”批次不支持 示例值:128888000000001
+   * 
+ */ + @SerializedName(value = "stock_id") + private String stockId; + + /** + *
* 字段名:商家券Code
+   * 变量名:coupon_code
+   * 是否必填:是
+   * 类型:string[1, 128]
+   * 描述:
+   * body券的唯一标识。 在WECHATPAY_MODE的券Code模式下,商家券Code是由微信支付生成的唯一ID; 在MERCHANT_UPLOAD、MERCHANT_API的券Code模式下,商家券Code是由商户上传或指定,在批次下保证唯一; 示例值:ABCD12345678
+   * 
+ */ + @SerializedName(value = "coupon_code") + private String couponCode; + + /** + *
* 字段名:微信支付订单号
+   * 变量名:transaction_id
+   * 是否必填:是
+   * 类型:string[28, 32]
+   * 描述:
+   * body微信支付下单支付成功返回的订单号 示例值:4200000913202101152566792388
+   * 
+ */ + @SerializedName(value = "transaction_id") + private String transactionId; + + /** + *
* 字段名:营销补差扣款商户号
+   * 变量名:payer_merchant
+   * 是否必填:是
+   * 类型:string[1, 32]
+   * 描述:
+   * body营销补差扣款商户号 示例值:1900000001
+   * 
+ */ + @SerializedName(value = "payer_merchant") + private String payerMerchant; + + /** + *
* 字段名:营销补差入账商户号
+   * 变量名:payee_merchant
+   * 是否必填:是
+   * 类型:string[1, 32]
+   * 描述:
+   * body营销补差入账商户号 示例值:1900000002
+   * 
+ */ + @SerializedName(value = "payee_merchant") + private String payeeMerchant; + + /** + *
* 字段名:补差付款金额
+   * 变量名:amount
+   * 是否必填:是
+   * 类型:int
+   * 描述:
+   * body单位为分,单笔订单补差金额不得超过券的优惠金额,最高补差金额为5000元 > 券的优惠金额定义: 满减券:满减金额即为优惠金额 折扣券:优惠金额 = 微信支付订单金额 ÷ 折扣比例 × (1 - 折扣比例) 换购券:不支持 示例值:100
+   * 
+ */ + @SerializedName(value = "amount") + private Integer amount; + + /** + *
* 字段名:补差付款描述
+   * 变量名:description
+   * 是否必填:是
+   * 类型:string[1, 1024]
+   * 描述:
+   * body付款备注描述,查询的时候原样带回 示例值:20210115DESCRIPTION
+   * 
+ */ + @SerializedName(value = "description") + private String description; + + /** + *
* 字段名:业务请求唯一单号
+   * 变量名:out_subsidy_no
+   * 是否必填:是
+   * 类型:string[1, 128]
+   * 描述:
+   * body商户侧需保证唯一性。可包含英文字母,数字,|,_,*,-等内容,不允许出现其他不合法符号 示例值:subsidy-abcd-12345678
+   * 
+ */ + @SerializedName(value = "out_subsidy_no") + private String outSubsidyNo; +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorSubsidyResult.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorSubsidyResult.java new file mode 100644 index 0000000000..044dc0ab8e --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/BusiFavorSubsidyResult.java @@ -0,0 +1,177 @@ +package com.github.binarywang.wxpay.bean.marketing; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 营销补差付款返回对象 + *
+ *   文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_16.shtml
+ * 
+ * + * @author yujam + */ +@Data +@NoArgsConstructor +public class BusiFavorSubsidyResult implements Serializable { + private static final long serialVersionUID = 1L; + + /** + *
* 字段名:补差付款单号
+   * 变量名:subsidy_receipt_id
+   * 是否必填:是
+   * 类型:string[28, 32]
+   * 描述:
+   * 补差付款唯一单号,由微信支付生成,仅在补差付款成功后有返回 示例值:1120200119165100000000000001
+   * 
+ */ + @SerializedName(value = "subsidy_receipt_id") + private String subsidyReceiptId; + + /** + *
* 字段名:商家券批次号
+   * 变量名:stock_id
+   * 是否必填:是
+   * 类型:string[1, 20]
+   * 描述:
+   * 由微信支付生成,调用创建商家券API成功时返回的唯一批次ID 示例值:128888000000001
+   * 
+ */ + @SerializedName(value = "stock_id") + private String stockId; + + /** + *
* 字段名:商家券Code
+   * 变量名:coupon_code
+   * 是否必填:是
+   * 类型:string[1, 128]
+   * 描述:
+   * 券的唯一标识 示例值:ABCD12345678
+   * 
+ */ + @SerializedName(value = "coupon_code") + private String couponCode; + + /** + *
* 字段名:微信支付订单号
+   * 变量名:transaction_id
+   * 是否必填:是
+   * 类型:string[28, 32]
+   * 描述:
+   * 微信支付下单支付成功返回的订单号 示例值:4200000913202101152566792388
+   * 
+ */ + @SerializedName(value = "transaction_id") + private String transactionId; + + /** + *
* 字段名:营销补差扣款商户号
+   * 变量名:payer_merchant
+   * 是否必填:是
+   * 类型:string[1, 32]
+   * 描述:
+   * 营销补差扣款商户号 示例值:1900000001
+   * 
+ */ + @SerializedName(value = "payer_merchant") + private String payerMerchant; + + /** + *
* 字段名:营销补差入账商户号
+   * 变量名:payee_merchant
+   * 是否必填:是
+   * 类型:string[1, 32]
+   * 描述:
+   * 营销补差入账商户号 示例值:1900000002
+   * 
+ */ + @SerializedName(value = "payee_merchant") + private String payeeMerchant; + + /** + *
* 字段名:补差付款金额
+   * 变量名:amount
+   * 是否必填:是
+   * 类型:int
+   * 描述:
+   * 单位为分,单笔订单补差金额不得超过券的优惠金额,最高补差金额为5000元 > 券的优惠金额定义: 满减券:满减金额即为优惠金额 折扣券:优惠金额 = 微信支付订单金额 ÷ 折扣比例 × (1 - 折扣比例) 换购券:不支持 示例值:100
+   * 
+ */ + @SerializedName(value = "amount") + private Integer amount; + + /** + *
* 字段名:补差付款描述
+   * 变量名:description
+   * 是否必填:是
+   * 类型:string[1, 1024]
+   * 描述:
+   * 付款备注描述,查询的时候原样带回 示例值:20210115DESCRIPTION
+   * 
+ */ + @SerializedName(value = "description") + private String description; + + /** + *
* 字段名:补差付款单据状态
+   * 变量名:status
+   * 是否必填:是
+   * 类型:string[1, 32]
+   * 描述:
+   * 补差付款单据状态 ACCEPTED:受理成功 SUCCESS:补差补款成功 FAIL:补差付款失败 RETURNING:补差回退中 PARTIAL_RETURN:补差部分回退 FULL_RETURN:补差全额回退 示例值:SUCCESS
+   * 
+ */ + @SerializedName(value = "status") + private String status; + + /** + *
* 字段名:补差付款失败原因
+   * 变量名:fail_reason
+   * 是否必填:否
+   * 类型:string[1, 1024]
+   * 描述:
+   * 仅在补差付款失败时,返回告知对应失败的原因 INSUFFICIENT_BALANCE:扣款商户余额不足 NOT_INCOMESPLIT_ORDER:非分账订单 EXCEED_SUBSIDY_AMOUNT_QUOTA:超出订单补差总额限制 EXCEED_SUBSIDY_COUNT_QUOTA:超出订单补差总数限制 OTHER:其他原因 示例值:INSUFFICIENT_BALANCE
+   * 
+ */ + @SerializedName(value = "fail_reason") + private String failReason; + + /** + *
* 字段名:补差付款完成时间
+   * 变量名:success_time
+   * 是否必填:否
+   * 类型:string[28, 32]
+   * 描述:
+   * 仅在补差付款成功时,返回完成时间。遵循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秒。 示例值:2021-01-20T10:29:35+08:00
+   * 
+ */ + @SerializedName(value = "success_time") + private String successTime; + + /** + *
* 字段名:业务请求唯一单号
+   * 变量名:out_subsidy_no
+   * 是否必填:是
+   * 类型:string[1, 128]
+   * 描述:
+   * 商户侧需保证唯一性。可包含英文字母,数字,|,_,*,-等内容,不允许出现其他不合法符号 示例值:subsidy-abcd-12345678
+   * 
+ */ + @SerializedName(value = "out_subsidy_no") + private String outSubsidyNo; + + /** + *
* 字段名:补差付款发起时间
+   * 变量名:create_time
+   * 是否必填:否
+   * 类型:string[28, 32]
+   * 描述:
+   * 补差付款单据创建时间。遵循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秒。 示例值:2021-01-20T10:29:35+08:00
+   * 
+ */ + @SerializedName(value = "create_time") + private String createTime; +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/busifavor/AvailableWeek.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/busifavor/AvailableWeek.java new file mode 100644 index 0000000000..2718b32770 --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/busifavor/AvailableWeek.java @@ -0,0 +1,84 @@ +package com.github.binarywang.wxpay.bean.marketing.busifavor; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 固定周期有效时间段 + *
+ *   文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_1.shtml
+ * 
+ * + * @author yujam + */ +@Data +@NoArgsConstructor +public class AvailableWeek implements Serializable { + public static final float serialVersionUID = 1L; + + /** + *
+   * 字段名:可用星期数
+   * 变量名:week_day
+   * 是否必填:否
+   * 类型:array[int]
+   * 描述:
+   *  0代表周日,1代表周一,以此类推
+   *  当填写available_day_time时,week_day必填
+   *  示例值:1, 2
+   * 
+ */ + @SerializedName(value = "week_day") + private Integer[] weekDay; + + + /** + *
+   * 字段名:当天可用时间段
+   * 变量名:available_day_time
+   * 是否必填:否
+   * 类型:array
+   * 描述:
+   *  可以填写多个时间段,最多不超过2个。
+   * 
+ */ + @SerializedName(value = "available_day_time") + private AvailableDayTime availableDayTime; + + @Data + @NoArgsConstructor + public static class AvailableDayTime implements Serializable { + public static final float serialVersionUID = 1L; + + /** + *
+     * 字段名:当天可用开始时间
+     * 变量名:begin_time
+     * 是否必填:否
+     * 类型:int
+     * 描述:
+     *  当天可用开始时间,单位:秒,1代表当天0点0分1秒。
+     *  示例值:3600
+     * 
+ */ + @SerializedName(value = "begin_time") + private Integer beginTime; + + /** + *
+     * 字段名:当天可用结束时间
+     * 变量名:available_day_time
+     * 是否必填:否
+     * 类型:int
+     * 描述:
+     *  当天可用结束时间,单位:秒,86399代表当天23点59分59秒。
+     *  示例值:86399
+     * 
+ */ + @SerializedName(value = "end_time") + private Integer endTime; + } +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/busifavor/CouponAvailableTime.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/busifavor/CouponAvailableTime.java new file mode 100644 index 0000000000..31833c1188 --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/busifavor/CouponAvailableTime.java @@ -0,0 +1,108 @@ +package com.github.binarywang.wxpay.bean.marketing.busifavor; + +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/apis/chapter9_2_1.shtml
+ * 
+ * + * @author yujam + */ +@Data +@NoArgsConstructor +public class CouponAvailableTime implements Serializable { + public static final float serialVersionUID = 1L; + + /** + *
+   * 字段名:开始时间
+   * 变量名:available_begin_time
+   * 是否必填:是
+   * 类型:string[1,32]
+   * 描述:
+   *  批次开始时间,遵循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秒。
+   *  注意:开始时间设置有效期最长为1年。
+   *  示例值:2015-05-20T13:29:35+08:00
+   * 
+ */ + @SerializedName(value = "available_begin_time") + private String availableBeginTime; + + /** + *
+   * 字段名:结束时间
+   * 变量名:available_end_time
+   * 是否必填:是
+   * 类型:string[1,32]
+   * 描述:
+   *  批次结束时间,遵循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秒。
+   *  注意:结束时间设置有效期最长为1年。
+   *  示例值:2015-05-20T13:29:35+08:00
+   * 
+ */ + @SerializedName(value = "available_end_time") + private String availableEndTime; + + /** + *
+   * 字段名:生效后N天内有效
+   * 变量名:available_day_after_receive
+   * 是否必填:否
+   * 类型:int
+   * 描述:
+   *  日期区间内,券生效后x天内有效。例如生效当天内有效填1,生效后2天内有效填2,以此类推……注意,用户在有效期开始前领取商家券,则从有效期第1天开始计算天数,用户在有效期内领取商家券,则从领取当天开始计算天数,无论用户何时领取商家券,商家券在活动有效期结束后均不可用。可配合wait_days_after_receive一同填写,也可单独填写。单独填写时,有效期内领券后立即生效,生效后x天内有效。
+   *  示例值:3
+   * 
+ */ + @SerializedName(value = "available_day_after_receive") + private Integer availableDayAfterReceive; + + /** + *
+   * 字段名:固定周期有效时间段
+   * 变量名:available_week
+   * 是否必填:否
+   * 类型:object
+   * 描述:
+   *  可以设置多个星期下的多个可用时间段,比如每周二10点到18点,用户自定义字段。
+   * 
+ */ + @SerializedName(value = "available_week") + private AvailableWeek availableWeek; + + /** + *
+   * 字段名:无规律的有效时间段
+   * 变量名:irregulary_avaliable_time
+   * 是否必填:否
+   * 类型:array
+   * 描述:
+   *  无规律的有效时间,多个无规律时间段,用户自定义字段。
+   * 
+ */ + @SerializedName(value = "irregulary_avaliable_time") + private List irregularyAvaliableTime; + + /** + *
+   * 字段名:领取后N天开始生效
+   * 变量名:wait_days_after_receive
+   * 是否必填:否
+   * 类型:int
+   * 描述:
+   *  日期区间内,用户领券后需等待x天开始生效。例如领券后当天开始生效则无需填写,领券后第2天开始生效填1,以此类推……用户在有效期开始前领取商家券,则从有效期第1天开始计算天数,用户在有效期内领取商家券,则从领取当天开始计算天数。无论用户何时领取商家券,商家券在活动有效期结束后均不可用。需配合available_day_after_receive一同填写,不可单独填写。
+   *  示例值:7
+   * 
+ */ + @SerializedName(value = "wait_days_after_receive") + private Integer waitDaysAfterReceive; + + +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/busifavor/CouponUseRule.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/busifavor/CouponUseRule.java new file mode 100644 index 0000000000..948abec613 --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/busifavor/CouponUseRule.java @@ -0,0 +1,121 @@ +package com.github.binarywang.wxpay.bean.marketing.busifavor; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 核销规则 + *
+ *   文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_1.shtml
+ * 
+ * + * @author yujam + */ +@Data +@NoArgsConstructor +public class CouponUseRule implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + *
+   * 字段名:券生效时间
+   * 变量名:coupon_available_time
+   * 是否必填:是
+   * 类型:object
+   * 描述:
+   *  允许指定券的特殊生效时间规则。
+   *  该字段暂未开放
+   * 
+ */ + @SerializedName(value = "coupon_available_time") + private CouponAvailableTime couponAvailableTime; + + /** + *
+   * 字段名:固定面额满减券使用规则
+   * 变量名:fixed_normal_coupon
+   * 是否必填:否
+   * 类型:object
+   * 描述:
+   *  stock_type为NORMAL时必填。
+   * 
+ */ + @SerializedName(value = "fixed_normal_coupon") + private FixedNormalCoupon fixedNormalCoupon; + /** + *
+   * 字段名:折扣券使用规则
+   * 变量名:discount_coupon
+   * 是否必填:否
+   * 类型:object
+   * 描述:
+   *  stock_type为DISCOUNT时必填。
+   * 
+ */ + @SerializedName(value = "discount_coupon") + private DiscountCoupon discountCoupon; + + /** + *
+   * 字段名:换购券使用规则
+   * 变量名:exchange_coupon
+   * 是否必填:否
+   * 类型:object
+   * 描述:
+   *  stock_type为EXCHANG时必填。
+   * 
+ */ + @SerializedName(value = "exchange_coupon") + private ExchangeCoupon exchangeCoupon; + + /** + *
+   * 字段名:核销方式
+   * 变量名:use_method
+   * 是否必填:是
+   * 类型:string[1,128]
+   * 描述:
+   * 枚举值:
+   *  OFF_LINE:线下滴码核销,点击券“立即使用”跳转展示券二维码详情。
+   *  MINI_PROGRAMS:线上小程序核销,点击券“立即使用”跳转至配置的商家小程序(需要添加小程序appid和path)。
+   *  PAYMENT_CODE:微信支付付款码核销,点击券“立即使用”跳转至微信支付钱包付款码。
+   *  SELF_CONSUME:用户自助核销,点击券“立即使用”跳转至用户自助操作核销界面(当前暂不支持用户自助核销)。
+   *  示例值:OFF_LINE
+   * 
+ */ + @SerializedName(value = "use_method") + private String useMethod; + + /** + *
+   * 字段名:小程序appid
+   * 变量名:mini_programs_appid
+   * 是否必填:否
+   * 类型:string[1,32]
+   * 描述:
+   *  核销方式为线上小程序核销才有效。
+   *  示例值:wx23232232323
+   * 
+ */ + @SerializedName(value = "mini_programs_appid") + private String miniProgramsAppid; + + /** + *
+   * 字段名:小程序path
+   * 变量名:mini_programs_path
+   * 是否必填:否
+   * 类型:string[1,128]
+   * 描述:
+   *  核销方式为线上小程序核销才有效。
+   *  示例值:/path/index/index
+   * 
+ */ + @SerializedName(value = "mini_programs_path") + private String miniProgramsPath; + +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/busifavor/CustomEntrance.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/busifavor/CustomEntrance.java new file mode 100644 index 0000000000..316d9c3bde --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/busifavor/CustomEntrance.java @@ -0,0 +1,156 @@ +package com.github.binarywang.wxpay.bean.marketing.busifavor; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 自定义入口 + *
+ *   文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_1.shtml
+ * 
+ * + * @author yujam + */ +@Data +@NoArgsConstructor +public class CustomEntrance implements Serializable { + private static final long serialVersionUID = 1L; + + /** + *
+   * 字段名:小程序入口
+   * 变量名:mini_programs_info
+   * 是否必填:否
+   * 类型:object
+   * 描述:
+   *  需要小程序APPID、path、入口文案、引导文案。如果需要跳转小程序,APPID、path、入口文案为必填,引导文案非必填。
+   *  appid要与归属商户号有M-A or M-m-suba关系
+   * 
+ */ + @SerializedName(value = "mini_programs_info") + private MiniProgramsInfo miniProgramsInfo; + + /** + *
+   * 字段名:商户公众号appid
+   * 变量名:appid
+   * 是否必填:否
+   * 类型:string[1,32]
+   * 描述:
+   *  可配置商户公众号,从券详情可跳转至公众号,用户自定义字段。
+   *  示例值:wx324345hgfhfghfg
+   * 
+ */ + @SerializedName(value = "appid") + private String appId; + + /** + *
+   * 字段名:营销馆id
+   * 变量名:hall_id
+   * 是否必填:否
+   * 类型:string[1,64]
+   * 描述:
+   *  填写微信支付营销馆的馆id,用户自定义字段。 营销馆需在商户平台 创建。
+   *  示例值:233455656
+   * 
+ */ + @SerializedName(value = "hall_id") + private String hallId; + + /** + *
+   * 字段名:可用门店id
+   * 变量名:store_id
+   * 是否必填:否
+   * 类型:string[1,64]
+   * 描述:
+   *  填写代金券可用门店id,用户自定义字段。
+   *  示例值:233554655
+   * 
+ */ + @SerializedName(value = "store_id") + private String storeId; + + /** + *
+   * 字段名:code展示模式
+   * 变量名:code_display_mode
+   * 是否必填:否
+   * 类型:string[1,8]
+   * 描述:
+   *  枚举值:
+   *   NOT_SHOW:不展示code
+   *   BARCODE:一维码
+   *   QRCODE:二维码
+   *  示例值:BARCODE
+   * 
+ */ + @SerializedName(value = "code_display_mode") + private String codeDisplayMode; + + @Data + @NoArgsConstructor + public static class MiniProgramsInfo implements Serializable { + private static final long serialVersionUID = 1L; + + /** + *
+     * 字段名:商家小程序appid
+     * 变量名:mini_programs_appid
+     * 是否必填:是
+     * 类型:string[1,32]
+     * 描述:
+     *  商家小程序appid要与归属商户号有M-A or M-m-suba关系。
+     *  示例值:wx234545656765876
+     * 
+ */ + @SerializedName(value = "mini_programs_appid") + private String miniProgramsAppid; + + /** + *
+     * 字段名:商家小程序path
+     * 变量名:mini_programs_path
+     * 是否必填:是
+     * 类型:string[1,128]
+     * 描述:
+     *  商家小程序path
+     *  示例值:/path/index/index
+     * 
+ */ + @SerializedName(value = "mini_programs_path") + private String miniProgramsPath; + + /** + *
+     * 字段名:入口文案
+     * 变量名:entrance_words
+     * 是否必填:是
+     * 类型:string[1,5]
+     * 描述:
+     *  入口文案,字数上限为5个,一个中文汉字/英文字母/数字均占用一个字数。
+     *  示例值:欢迎选购
+     * 
+ */ + @SerializedName(value = "entrance_words") + private String entranceWords; + + /** + *
+     * 字段名:引导文案
+     * 变量名:guiding_words
+     * 是否必填:否
+     * 类型:string[1,6]
+     * 描述:
+     *  小程序入口引导文案,用户自定义字段。字数上限为6个,一个中文汉字/英文字母/数字均占用一个字数。
+     *  示例值:获取更多优惠
+     * 
+ */ + @SerializedName(value = "guiding_words") + private String guidingWords; + } +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/busifavor/DiscountCoupon.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/busifavor/DiscountCoupon.java new file mode 100644 index 0000000000..51004d6d96 --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/busifavor/DiscountCoupon.java @@ -0,0 +1,50 @@ +package com.github.binarywang.wxpay.bean.marketing.busifavor; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 折扣券 + *
+ *   文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_1.shtml
+ * 
+ * + * @author yujam + */ +@Data +@NoArgsConstructor +public class DiscountCoupon implements Serializable { + private static final long serialVersionUID = 1L; + + /** + *
+   * 字段名:折扣比例
+   * 变量名:discount_percent
+   * 是否必填:是
+   * 类型:int
+   * 描述:
+   *  折扣百分比,例如:88为八八折。
+   *  示例值:88
+   * 
+ */ + @SerializedName(value = "discount_percent") + private Integer discountPercent; + + /** + *
+   * 字段名:消费门槛
+   * 变量名:transaction_minimum
+   * 是否必填:是
+   * 类型:int
+   * 描述:
+   *  消费门槛,单位:分。
+   *  特殊规则:取值范围 1 ≤ value ≤ 10000000
+   *  示例值:100
+   * 
+ */ + @SerializedName(value = "transaction_minimum") + private Integer transactionMinimum; +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/busifavor/DisplayPatternInfo.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/busifavor/DisplayPatternInfo.java new file mode 100644 index 0000000000..d0d046b572 --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/busifavor/DisplayPatternInfo.java @@ -0,0 +1,92 @@ +package com.github.binarywang.wxpay.bean.marketing.busifavor; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 样式信息 + *
+ *   文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_1.shtml
+ * 
+ * + * @author yujam + */ +@Data +@NoArgsConstructor +public class DisplayPatternInfo implements Serializable { + private static final long serialVersionUID = 1L; + /** + *
+   * 字段名:使用须知
+   * 变量名:description
+   * 是否必填:否
+   * 类型:string[1,1000]
+   * 描述:
+   *  用于说明详细的活动规则,会展示在代金券详情页。
+   *  示例值:xxx门店可用
+   * 
+ */ + @SerializedName(value = "description") + private String description; + + /** + *
+   * 字段名:商户logo
+   * 变量名:merchant_logo_url
+   * 是否必填:否
+   * 类型:string[1,128]
+   * 描述:
+   *  商户logo的URL地址,仅支持通过《图片上传API》接口获取的图片URL地址。
+   *  1、商户logo大小需为120像素*120像素。
+   *  2、支持JPG/JPEG/PNG格式,且图片小于1M。
+   *  示例值:https://qpic.cn/xxx
+   * 
+ */ + @SerializedName(value = "merchant_logo_url") + private String merchantLogoUrl; + + /** + *
+   * 字段名:商户名称
+   * 变量名:merchant_name
+   * 是否必填:否
+   * 类型:string[1,16]
+   * 描述:
+   *  商户名称,字数上限为16个,一个中文汉字/英文字母/数字均占用一个字数。
+   *  示例值:微信支付
+   * 
+ */ + @SerializedName(value = "merchant_name") + private String merchantName; + + /** + *
+   * 字段名:背景颜色
+   * 变量名:background_color
+   * 是否必填:否
+   * 类型:string[1,16]
+   * 描述:
+   *  券的背景颜色,可设置10种颜色,色值请参考卡券背景颜色图。颜色取值为颜色图中的颜色名称。
+   *  示例值:Color020
+   * 
+ */ + @SerializedName(value = "background_color") + private String backgroundColor; + + /** + *
+   * 字段名:券详情图片
+   * 变量名:coupon_image_url
+   * 是否必填:否
+   * 类型:string[1,128]
+   * 描述:
+   *  券详情图片,850像素*350像素,且图片大小不超过2M,支持JPG/PNG格式,仅支持通过《图片上传API》接口获取的图片URL地址。
+   *  示例值:https://qpic.cn/xxx
+   * 
+ */ + @SerializedName(value = "coupon_image_url") + private String couponImageUrl; +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/busifavor/ExchangeCoupon.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/busifavor/ExchangeCoupon.java new file mode 100644 index 0000000000..ae701e1699 --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/busifavor/ExchangeCoupon.java @@ -0,0 +1,51 @@ +package com.github.binarywang.wxpay.bean.marketing.busifavor; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 换购券 + *
+ *   文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_1.shtml
+ * 
+ * + * @author yujam + */ +@Data +@NoArgsConstructor +public class ExchangeCoupon implements Serializable { + private static final long serialVersionUID = 1L; + + /** + *
+   * 字段名:单品换购价
+   * 变量名:exchange_price
+   * 是否必填:是
+   * 类型:int
+   * 描述:
+   *  单品换购价,单位:分。
+   *  特殊规则:取值范围 1 ≤ value ≤ 10000000
+   *  示例值:100
+   * 
+ */ + @SerializedName(value = "exchange_price") + private Integer exchangePrice; + + /** + *
+   * 字段名:消费门槛
+   * 变量名:transaction_minimum
+   * 是否必填:是
+   * 类型:int
+   * 描述:
+   *  消费门槛,单位:分。
+   *  特殊规则:取值范围 1 ≤ value ≤ 10000000
+   *  示例值:100
+   * 
+ */ + @SerializedName(value = "transaction_minimum") + private Integer transactionMinimum; +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/busifavor/FixedNormalCoupon.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/busifavor/FixedNormalCoupon.java new file mode 100644 index 0000000000..689a5bf550 --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/busifavor/FixedNormalCoupon.java @@ -0,0 +1,51 @@ +package com.github.binarywang.wxpay.bean.marketing.busifavor; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 满减券 + *
+ *   文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_1.shtml
+ * 
+ * + * @author yujam + */ +@Data +@NoArgsConstructor +public class FixedNormalCoupon implements Serializable { + private static final long serialVersionUID = 1L; + + /** + *
+   * 字段名:优惠金额
+   * 变量名:discount_amount
+   * 是否必填:是
+   * 类型:int
+   * 描述:
+   *  优惠金额,单位:分。
+   *  特殊规则:取值范围 1 ≤ value ≤ 10000000
+   *  示例值:5
+   * 
+ */ + @SerializedName(value = "discount_amount") + private Integer discountAmount; + + /** + *
+   * 字段名:消费门槛
+   * 变量名:transaction_minimum
+   * 是否必填:是
+   * 类型:int
+   * 描述:
+   *  消费门槛,单位:分。
+   *  特殊规则:取值范围 1 ≤ value ≤ 10000000
+   *  示例值:100
+   * 
+ */ + @SerializedName(value = "transaction_minimum") + private Integer transactionMinimum; +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/busifavor/IrregularyAvaliableTime.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/busifavor/IrregularyAvaliableTime.java new file mode 100644 index 0000000000..4ddd196e56 --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/busifavor/IrregularyAvaliableTime.java @@ -0,0 +1,50 @@ +package com.github.binarywang.wxpay.bean.marketing.busifavor; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 无规律的有效时间段 + *
+ *   文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_1.shtml
+ * 
+ * + * @author yujam + */ +@Data +@NoArgsConstructor +public class IrregularyAvaliableTime implements Serializable { + + public static final float serialVersionUID = 1L; + + /** + *
+   * 字段名:开始时间
+   * 变量名:begin_time
+   * 是否必填:否
+   * 类型:string[1,32]
+   * 描述:
+   *  开始时间,遵循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秒。
+   *  示例值:2015-05-20T13:29:35+08:00
+   * 
+ */ + @SerializedName(value = "begin_time") + private String beginTime; + + /** + *
+   * 字段名:结束时间
+   * 变量名:end_time
+   * 是否必填:否
+   * 类型:string[1,32]
+   * 描述:
+   *  结束时间,遵循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秒。
+   *  示例值:2015-05-20T13:29:35+08:00
+   * 
+ */ + @SerializedName(value = "end_time") + private String endTime; +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/busifavor/NotifyConfig.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/busifavor/NotifyConfig.java new file mode 100644 index 0000000000..ad59bf365d --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/busifavor/NotifyConfig.java @@ -0,0 +1,36 @@ +package com.github.binarywang.wxpay.bean.marketing.busifavor; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 事件通知配置 + *
+ *   文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_1.shtml
+ * 
+ * + * @author yujam + */ +@Data +@NoArgsConstructor +public class NotifyConfig implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + *
+   * 字段名:事件通知appid
+   * 变量名:coupon_image_url
+   * 是否必填:否
+   * 类型:string[1,64]
+   * 描述:
+   *  用于回调通知时,计算返回操作用户的openid(诸如领券用户),支持小程序or公众号的APPID;如该字段不填写,则回调通知中涉及到用户身份信息的openid与unionid都将为空。
+   *  示例值:wx23232232323
+   * 
+ */ + @SerializedName(value = "notify_appid") + private String notifyAppId; +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/busifavor/StockSendRule.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/busifavor/StockSendRule.java new file mode 100644 index 0000000000..42a36b8776 --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/busifavor/StockSendRule.java @@ -0,0 +1,131 @@ +package com.github.binarywang.wxpay.bean.marketing.busifavor; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 券发放相关规则 + *
+ *   文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_1.shtml
+ * 
+ * + * @author yujam + */ +@Data +@NoArgsConstructor +public class StockSendRule implements Serializable { + private static final long serialVersionUID = 1L; + + /** + *
+   * 字段名:批次最大发放个数
+   * 变量名:max_coupons
+   * 是否必填:是
+   * 类型:int
+   * 描述:
+   *  批次最大可发放个数限制
+   *  特殊规则:取值范围 1 ≤ value ≤ 1000000000
+   *  示例值:100
+   * 
+ */ + @SerializedName(value = "max_coupons") + private Integer maxCoupons; + + /** + *
+   * 字段名:用户最大可领个数
+   * 变量名:max_coupons_per_user
+   * 是否必填:是
+   * 类型:int
+   * 描述:
+   *  用户可领个数,每个用户最多100张券 。
+   *  示例值:5
+   * 
+ */ + @SerializedName(value = "max_coupons_per_user") + private Integer maxCouponsPerUser; + + /** + *
+   * 字段名:单天发放上限个数
+   * 变量名:max_coupons_by_day
+   * 是否必填:否
+   * 类型:bool
+   * 描述:
+   *  单天发放上限个数(stock_type为DISCOUNT或EXCHANGE时可传入此字段控制单天发放上限)。
+   *  特殊规则:取值范围 1 ≤ value ≤ 1000000000
+   *  示例值:100
+   * 
+ */ + @SerializedName(value = "max_coupons_by_day") + private Integer maxCouponsByDay; + + /** + *
+   * 字段名:是否开启自然人限制
+   * 变量名:natural_person_limit
+   * 是否必填:否
+   * 类型:bool
+   * 描述:
+   *  不填默认否,枚举值:
+   *  true:是
+   *  false:否
+   *  示例值:false
+   * 
+ */ + @SerializedName(value = "natural_person_limit") + private Boolean naturalPersonLimit; + + /** + *
+   * 字段名:可疑账号拦截
+   * 变量名:prevent_api_abuse
+   * 是否必填:否
+   * 类型:bool
+   * 描述:
+   *  不填默认否,枚举值:
+   *  true:是
+   *  false:否
+   *  示例值:false
+   * 
+ */ + @SerializedName(value = "prevent_api_abuse") + private Boolean preventApiAbuse; + + /** + *
+   * 字段名:是否允许转赠
+   * 变量名:transferable
+   * 是否必填:否
+   * 类型:bool
+   * 描述:
+   *  不填默认否,枚举值:
+   *  true:是
+   *  false:否
+   *  该字段暂未开放
+   *  示例值:false
+   * 
+ */ + @SerializedName(value = "transferable") + private Boolean transferable; + + /** + *
+   * 字段名:是否允许分享链接
+   * 变量名:shareable
+   * 是否必填:否
+   * 类型:bool
+   * 描述:
+   *  不填默认否,枚举值:
+   *  true:是
+   *  false:否
+   *  该字段暂未开放
+   *  示例值:false
+   * 
+ */ + @SerializedName(value = "shareable") + private Boolean shareable; +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/enums/StockTypeEnum.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/enums/StockTypeEnum.java index a53c5c982b..2461c00943 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/enums/StockTypeEnum.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/marketing/enums/StockTypeEnum.java @@ -6,7 +6,7 @@ /** * 批次类型 * - * @author thinsstar + * @author yujam */ @Getter @AllArgsConstructor @@ -16,7 +16,16 @@ public enum StockTypeEnum { * NORMAL:固定面额满减券批次 */ NORMAL("NORMAL"), - ; + + /** + * DISCOUNT:折扣券批次 + */ + DISCOUNT("DISCOUNT"), + + /** + * EXCHANGE:换购券批次 + */ + EXCHANGE("EXCHANGE"); /** * 批次类型 diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/MarketingBusiFavorService.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/MarketingBusiFavorService.java new file mode 100644 index 0000000000..0c32a05895 --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/MarketingBusiFavorService.java @@ -0,0 +1,250 @@ +package com.github.binarywang.wxpay.service; + +import com.github.binarywang.wxpay.bean.marketing.*; +import com.github.binarywang.wxpay.exception.WxPayException; + +/** + *
+ * 微信支付营销商家券接口
+ * 
+ * + * @author yujam + */ +public interface MarketingBusiFavorService { + /** + *
+   * 商家券接口-创建商家券API
+   * 文档详见: https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_1.shtml
+   * 接口链接:https://api.mch.weixin.qq.com/v3/marketing/busifavor/stocks
+   * 
+ * + * @param request 请求对象 {@link BusiFavorStocksCreateRequest} + * @return FavorStocksResult 微信返回的批次号信息。 + * @throws WxPayException the wx pay exception + */ + BusiFavorStocksCreateResult createBusiFavorStocksV3(BusiFavorStocksCreateRequest request) throws WxPayException; + + /** + *
+   * 商家券接口-查询商家券详情API
+   * 文档详见: https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_2.shtml
+   * 接口链接:https://api.mch.weixin.qq.com/v3/marketing/busifavor/stocks/{stock_id}
+   * 
+ * + * @param stockId 微信为每个商家券批次分配的唯一ID + * @return BusiFavorStocksGetResult 微信返回的批次号信息。 {@link BusiFavorStocksGetResult} + * @throws WxPayException the wx pay exception + */ + BusiFavorStocksGetResult getBusiFavorStocksV3(String stockId) throws WxPayException; + + /** + *
+   * 商家券接口-核销用户券API
+   * 文档详见: https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_3.shtml
+   * 接口链接:https://api.mch.weixin.qq.com/v3/marketing/busifavor/coupons/use
+   * 
+ * + * @param request 请求对象 {@link BusiFavorCouponsUseRequest} + * @return BusiFavorCouponsUseResult 微信返回的信息。 + * @throws WxPayException the wx pay exception + */ + BusiFavorCouponsUseResult verifyBusiFavorCouponsUseV3(BusiFavorCouponsUseRequest request) throws WxPayException; + + /** + *
+   * 商家券接口-H5发券API
+   * 文档详见: https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_4_1.shtml
+   * 接口链接:https://action.weixin.qq.com/busifavor/getcouponinfo
+   * 
+ * + * @param request 请求对象 {@link BusiFavorCouponsUrlRequest} + * @return String H5领券地址 + * @throws WxPayException the wx pay exception + */ + String buildBusiFavorCouponinfoUrl(BusiFavorCouponsUrlRequest request) throws WxPayException; + + /** + *
+   * 商家券接口-根据过滤条件查询用户券API
+   * 文档详见: https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_4.shtml
+   * 接口链接:https://api.mch.weixin.qq.com/v3/marketing/busifavor/users/{openid}/coupons
+   * 
+ * + * @param request 请求对象 {@link BusiFavorQueryUserCouponsRequest} + * @return BusiFavorQueryUserCouponsResult + * @throws WxPayException the wx pay exception + */ + BusiFavorQueryUserCouponsResult queryBusiFavorUsersCoupons(BusiFavorQueryUserCouponsRequest request) throws WxPayException; + + /** + *
+   * 商家券接口-查询用户单张券详情API
+   * 文档详见: https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_5.shtml
+   * 接口链接:https://api.mch.weixin.qq.com/v3/marketing/busifavor/users/{openid}/coupons/{coupon_code}/appids/{appid}
+   * 
+ * + * @param request 请求对象 {@link BusiFavorQueryOneUserCouponsResult} + * @return BusiFavorQueryOneUserCouponsRequest + * @throws WxPayException the wx pay exception + */ + BusiFavorQueryOneUserCouponsResult queryOneBusiFavorUsersCoupons(BusiFavorQueryOneUserCouponsRequest request) throws WxPayException; + + /** + *
+   * 商家券接口-上传预存code API
+   * 文档详见: https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_6.shtml
+   * 接口链接:https://api.mch.weixin.qq.com/v3/marketing/busifavor/stocks/{stock_id}/couponcodes
+   * 
+ * + * @param stockId 批次号 + * @param request 请求对象 {@link BusiFavorCouponCodeRequest} + * @return BusiFavorCouponCodeResult + * @throws WxPayException the wx pay exception + */ + BusiFavorCouponCodeResult uploadBusiFavorCouponCodes(String stockId, BusiFavorCouponCodeRequest request) throws WxPayException; + + /** + *
+   * 商家券接口-设置商家券事件通知地址 API
+   * 文档详见: https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_7.shtml
+   * 接口链接:https://api.mch.weixin.qq.com/v3/marketing/busifavor/callbacks
+   * 
+ * + * @param request 请求对象 {@link BusiFavorCallbacksRequest} + * @return BusiFavorCallbacksResult + * @throws WxPayException the wx pay exception + */ + BusiFavorCallbacksResult createBusiFavorCallbacks(BusiFavorCallbacksRequest request) throws WxPayException; + + /** + *
+   * 商家券接口-查询商家券事件通知地址 API
+   * 文档详见: https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_8.shtml
+   * 接口链接:https://api.mch.weixin.qq.com/v3/marketing/busifavor/callbacks
+   * 
+ * + * @param request 请求对象 {@link BusiFavorCallbacksRequest} + * @return BusiFavorCallbacksResult + * @throws WxPayException the wx pay exception + */ + BusiFavorCallbacksResult queryBusiFavorCallbacks(BusiFavorCallbacksRequest request) throws WxPayException; + + /** + *
+   * 商家券接口-关联订单信息 API
+   * 文档详见: https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_9.shtml
+   * 接口链接:https://api.mch.weixin.qq.com/v3/marketing/busifavor/coupons/associate
+   * 
+ * + * @param request 请求对象 {@link BusiFavorCouponsAssociateRequest} + * @return BusiFavorCouponsAssociateResult + * @throws WxPayException the wx pay exception + */ + BusiFavorCouponsAssociateResult queryBusiFavorCouponsAssociate(BusiFavorCouponsAssociateRequest request) throws WxPayException; + + /** + *
+   * 商家券接口-取消关联订单信息 API
+   * 文档详见: https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_10.shtml
+   * 接口链接:https://api.mch.weixin.qq.com/v3/marketing/busifavor/coupons/disassociate
+   * 
+ * + * @param request 请求对象 {@link BusiFavorCouponsAssociateRequest} + * @return BusiFavorCouponsAssociateResult + * @throws WxPayException the wx pay exception + */ + BusiFavorCouponsAssociateResult queryBusiFavorCouponsDisAssociate(BusiFavorCouponsAssociateRequest request) throws WxPayException; + + /** + *
+   * 商家券接口-修改批次预算 API
+   * 文档详见: https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_11.shtml
+   * 接口链接:https://api.mch.weixin.qq.com/v3/marketing/busifavor/stocks/{stock_id}/budget
+   * 
+ * + * @param stockId 批次号 + * @param request 请求对象 {@link BusiFavorStocksBudgetRequest} + * @return BusiFavorStocksBudgetResult + * @throws WxPayException the wx pay exception + */ + BusiFavorStocksBudgetResult updateBusiFavorStocksBudget(String stockId, BusiFavorStocksBudgetRequest request) throws WxPayException; + + /** + *
+   * 商家券接口-创建商家券API
+   * 文档详见: https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_12.shtml
+   * 接口链接:https://api.mch.weixin.qq.com/v3/marketing/busifavor/stocks/{stock_id}
+   * 
+ * + * @param stockId 批次号 + * @param request 请求对象 {@link BusiFavorStocksCreateRequest} + * @return String 处理成功 应答无内容。 + * @throws WxPayException the wx pay exception + */ + String updateBusiFavorStocksV3(String stockId, BusiFavorStocksCreateRequest request) throws WxPayException; + + /** + *
+   * 商家券接口-申请退款API
+   * 文档详见: https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_13.shtml
+   * 接口链接:https://api.mch.weixin.qq.com/v3/marketing/busifavor/coupons/return
+   * 
+ * + * @param request 请求对象 {@link BusiFavorCouponsReturnRequest} + * @return BusiFavorCouponsReturnResult + * @throws WxPayException the wx pay exception + */ + BusiFavorCouponsReturnResult returnBusiFavorCoupons(BusiFavorCouponsReturnRequest request) throws WxPayException; + + /** + *
+   * 商家券接口-使券失效API
+   * 文档详见: https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_15.shtml
+   * 接口链接:https://api.mch.weixin.qq.com/v3/marketing/busifavor/coupons/deactivate
+   * 
+ * + * @param request 请求对象 {@link BusiFavorCouponsDeactivateRequest} + * @return BusiFavorCouponsDeactivateResult + * @throws WxPayException the wx pay exception + */ + BusiFavorCouponsDeactivateResult deactiveBusiFavorCoupons(BusiFavorCouponsDeactivateRequest request) throws WxPayException; + + /** + *
+   * 商家券接口-营销补差付款API
+   * 文档详见: https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_16.shtml
+   * 接口链接:https://api.mch.weixin.qq.com/v3/marketing/busifavor/subsidy/pay-receipts
+   * 
+ * + * @param request 请求对象 {@link BusiFavorSubsidyResult} + * @return BusiFavorSubsidyRequest + * @throws WxPayException the wx pay exception + */ + BusiFavorSubsidyResult subsidyBusiFavorPayReceipts(BusiFavorSubsidyRequest request) throws WxPayException; + + /** + *
+   * 商家券接口-查询营销补差付款单详情API
+   * 文档详见: https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_17.shtml
+   * 接口链接:https://api.mch.weixin.qq.com/v3/marketing/busifavor/subsidy/pay-receipts/{subsidy_receipt_id}
+   * 
+ * + * @param subsidyReceiptId 补差付款唯一单号 + * @return BusiFavorSubsidyRequest + * @throws WxPayException the wx pay exception + */ + BusiFavorSubsidyResult queryBusiFavorSubsidyPayReceipts(String subsidyReceiptId) throws WxPayException; + + /** + *
+   * 商家券接口-领券事件回调通知API
+   * 文档详见: https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_15.shtml
+   * 
+ * + * @param url 回调地址 + * @param request 领券事件回调通知请求对象 + * @return BusiFavorNotifyResult + * @throws WxPayException the wx pay exception + */ + BusiFavorNotifyResult notifyBusiFavor(String url, BusiFavorNotifyRequest request) throws WxPayException; +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/WxPayService.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/WxPayService.java index 586db1cc2a..3f5f5973ab 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/WxPayService.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/WxPayService.java @@ -38,7 +38,7 @@ public interface WxPayService { /** * Map里 加入新的 {@link WxPayConfig},适用于动态添加新的微信公众号配置. * - * @param mchId 商户号id + * @param mchId 商户号id * @param wxPayConfig 新的微信配置 */ void addConfig(String mchId, WxPayConfig wxPayConfig); @@ -62,7 +62,7 @@ public interface WxPayService { * 注入多个 {@link WxPayConfig} 的实现. 并为每个 {@link WxPayConfig} 赋予不同的 {@link String label} 值 * * @param wxPayConfigs WxPayConfig map - * @param defaultMchId 设置一个{@link WxPayConfig} 所对应的{@link String mchId}进行Http初始化 + * @param defaultMchId 设置一个{@link WxPayConfig} 所对应的{@link String mchId}进行Http初始化 */ void setMultiConfig(Map wxPayConfigs, String defaultMchId); @@ -114,6 +114,16 @@ public interface WxPayService { */ String postV3(String url, String requestStr) throws WxPayException; + /** + * 发送patch请求,得到响应字符串. + * + * @param url 请求地址 + * @param requestStr 请求信息 + * @return 返回请求结果字符串 string + * @throws WxPayException the wx pay exception + */ + String patchV3(String url, String requestStr) throws WxPayException; + /** * 发送post请求,得到响应字符串. *

@@ -139,7 +149,7 @@ public interface WxPayService { /** * 发送http请求,得到响应字符串. * - * @param url 请求地址 + * @param url 请求地址 * @param httpRequest 请求信息,可以是put,post,get,delete等请求 * @return 返回请求结果字符串 string * @throws WxPayException the wx pay exception @@ -228,6 +238,13 @@ public interface WxPayService { */ MarketingFavorService getMarketingFavorService(); + /** + * 获取微信支付营销商家券服务类 + * + * @return the marketing favor service + */ + MarketingBusiFavorService getMarketingBusiFavorService(); + /** * 设置企业付款服务类,允许开发者自定义实现类. * @@ -350,7 +367,7 @@ public interface WxPayService { * @param request 请求对象,注意一些参数如appid、mchid等不用设置,方法内会自动从配置对象中获取到(前提是对应配置中已经设置) * @return the pay info * @throws WxPayException the wx pay exception - * @deprecated 建议使用 {@link com.github.binarywang.wxpay.service.WxPayService#createOrder(WxPayUnifiedOrderRequest)} + * @deprecated 建议使用 {@link WxPayService#createOrder(WxPayUnifiedOrderRequest)} */ @Deprecated Map getPayInfo(WxPayUnifiedOrderRequest request) throws WxPayException; diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImpl.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImpl.java index cf1a62c697..d5b066036a 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImpl.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImpl.java @@ -66,6 +66,7 @@ public abstract class BaseWxPayServiceImpl implements WxPayService { private final MerchantMediaService merchantMediaService = new MerchantMediaServiceImpl(this); private final MarketingMediaService marketingMediaService = new MarketingMediaServiceImpl(this); private final MarketingFavorService marketingFavorService = new MarketingFavorServiceImpl(this); + private final MarketingBusiFavorService marketingBusiFavorService = new MarketingBusiFavorServiceImpl(this); protected Map configMap; @@ -114,6 +115,11 @@ public MarketingFavorService getMarketingFavorService() { return this.marketingFavorService; } + @Override + public MarketingBusiFavorService getMarketingBusiFavorService() { + return this.marketingBusiFavorService; + } + @Override public void setEntPayService(EntPayService entPayService) { this.entPayService = entPayService; diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/MarketingBusiFavorServiceImpl.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/MarketingBusiFavorServiceImpl.java new file mode 100644 index 0000000000..bf1c12ee4f --- /dev/null +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/MarketingBusiFavorServiceImpl.java @@ -0,0 +1,190 @@ +package com.github.binarywang.wxpay.service.impl; + +import com.github.binarywang.wxpay.bean.marketing.*; +import com.github.binarywang.wxpay.constant.WxPayConstants; +import com.github.binarywang.wxpay.exception.WxPayException; +import com.github.binarywang.wxpay.service.MarketingBusiFavorService; +import com.github.binarywang.wxpay.service.WxPayService; +import com.github.binarywang.wxpay.util.SignUtils; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; + +import java.util.HashMap; +import java.util.Map; + +/** + * 微信支付-营销商家券接口 + * + * @author yujam + */ +@Slf4j +@RequiredArgsConstructor +public class MarketingBusiFavorServiceImpl implements MarketingBusiFavorService { + + private static final Gson GSON = new GsonBuilder().create(); + private final WxPayService payService; + + @Override + public BusiFavorStocksCreateResult createBusiFavorStocksV3(BusiFavorStocksCreateRequest request) throws WxPayException { + String url = String.format("%s/v3/marketing/busifavor/stocks", this.payService.getPayBaseUrl()); + String result = this.payService.postV3WithWechatpaySerial(url, GSON.toJson(request)); + return GSON.fromJson(result, BusiFavorStocksCreateResult.class); + } + + @Override + public BusiFavorStocksGetResult getBusiFavorStocksV3(String stockId) throws WxPayException { + String url = String.format("%s/v3/marketing/busifavor/stocks/%s", this.payService.getPayBaseUrl(), stockId); + String result = this.payService.getV3(url); + return GSON.fromJson(result, BusiFavorStocksGetResult.class); + } + + @Override + public BusiFavorCouponsUseResult verifyBusiFavorCouponsUseV3(BusiFavorCouponsUseRequest request) throws WxPayException { + String url = String.format("%s/v3/marketing/busifavor/coupons/use", this.payService.getPayBaseUrl()); + String result = this.payService.postV3WithWechatpaySerial(url, GSON.toJson(request)); + return GSON.fromJson(result, BusiFavorCouponsUseResult.class); + } + + @Override + public String buildBusiFavorCouponinfoUrl(BusiFavorCouponsUrlRequest request) throws WxPayException { + Map signMap = new HashMap<>(8); + signMap.put("out_request_no", request.getOutRequestNo()); + signMap.put("stock_id", request.getStockId()); + signMap.put("send_coupon_merchant", request.getSendCouponMerchant()); + signMap.put("open_id", request.getOpenid()); + + String sign = SignUtils.createSign(signMap, WxPayConstants.SignType.HMAC_SHA256, this.payService.getConfig().getMchKey(), null); + String actionBaseUrl = "https://action.weixin.qq.com"; + return String.format("%s/busifavor/getcouponinfo?stock_id=%s&out_request_no=%s&sign=%s&send_coupon_merchant=%s&open_id=%s#wechat_redirect", + actionBaseUrl, request.getStockId(), request.getOutRequestNo(), sign, request.getSendCouponMerchant(), request.getOpenid()); + } + + @Override + public BusiFavorQueryUserCouponsResult queryBusiFavorUsersCoupons(BusiFavorQueryUserCouponsRequest request) throws WxPayException { + String url = String.format("%s/v3/marketing/busifavor/users/%s/coupons", this.payService.getPayBaseUrl(), request.getOpenid()); + + if (request.getOffset() == null) { + request.setOffset(0); + } + + if (request.getLimit() == null || request.getLimit() <= 0) { + request.setLimit(20); + } + + String query = String.format("?appid=%s&offset=%s&limit=%s", request.getAppid(), request.getOffset(), request.getLimit()); + + if (StringUtils.isNotBlank(request.getStockId())) { + query += "&stock_id=" + request.getStockId(); + } + if (StringUtils.isNotBlank(request.getCouponState())) { + query += "&coupon_state=" + request.getCouponState(); + } + if (StringUtils.isNotBlank(request.getCreatorMerchant())) { + query += "&creator_merchant=" + request.getCreatorMerchant(); + } + if (StringUtils.isNotBlank(request.getBelongMerchant())) { + query += "&belong_merchant=" + request.getBelongMerchant(); + } + if (StringUtils.isNotBlank(request.getSenderMerchant())) { + query += "&sender_merchant=" + request.getSenderMerchant(); + } + + String result = this.payService.getV3(url + query); + return GSON.fromJson(result, BusiFavorQueryUserCouponsResult.class); + } + + @Override + public BusiFavorQueryOneUserCouponsResult queryOneBusiFavorUsersCoupons(BusiFavorQueryOneUserCouponsRequest request) throws WxPayException { + String url = String.format("%s/v3/marketing/busifavor/users/%s/coupons/%s/appids/%s", this.payService.getPayBaseUrl(), request.getOpenid(), request.getCouponCode(), request.getAppid()); + String result = this.payService.getV3(url); + return GSON.fromJson(result, BusiFavorQueryOneUserCouponsResult.class); + } + + @Override + public BusiFavorCouponCodeResult uploadBusiFavorCouponCodes(String stockId, BusiFavorCouponCodeRequest request) throws WxPayException { + String url = String.format("%s/v3/marketing/busifavor/stocks/%s/couponcodes", this.payService.getPayBaseUrl(), stockId); + String result = this.payService.postV3WithWechatpaySerial(url, GSON.toJson(request)); + return GSON.fromJson(result, BusiFavorCouponCodeResult.class); + } + + @Override + public BusiFavorCallbacksResult createBusiFavorCallbacks(BusiFavorCallbacksRequest request) throws WxPayException { + String url = String.format("%s/v3/marketing/busifavor/callbacks", this.payService.getPayBaseUrl()); + String result = this.payService.postV3WithWechatpaySerial(url, GSON.toJson(request)); + return GSON.fromJson(result, BusiFavorCallbacksResult.class); + } + + @Override + public BusiFavorCallbacksResult queryBusiFavorCallbacks(BusiFavorCallbacksRequest request) throws WxPayException { + String url = String.format("%s/v3/marketing/busifavor/callbacks", this.payService.getPayBaseUrl()); + if (StringUtils.isNotBlank(request.getMchid())) { + url += "?mchid=" + request.getMchid(); + } + String result = this.payService.getV3(url); + return GSON.fromJson(result, BusiFavorCallbacksResult.class); + } + + @Override + public BusiFavorCouponsAssociateResult queryBusiFavorCouponsAssociate(BusiFavorCouponsAssociateRequest request) throws WxPayException { + String url = String.format("%s/v3/marketing/busifavor/coupons/associate", this.payService.getPayBaseUrl()); + String result = this.payService.postV3WithWechatpaySerial(url, GSON.toJson(request)); + return GSON.fromJson(result, BusiFavorCouponsAssociateResult.class); + } + + @Override + public BusiFavorCouponsAssociateResult queryBusiFavorCouponsDisAssociate(BusiFavorCouponsAssociateRequest request) throws WxPayException { + String url = String.format("%s/v3/marketing/busifavor/coupons/disassociate", this.payService.getPayBaseUrl()); + String result = this.payService.postV3WithWechatpaySerial(url, GSON.toJson(request)); + return GSON.fromJson(result, BusiFavorCouponsAssociateResult.class); + } + + @Override + public BusiFavorStocksBudgetResult updateBusiFavorStocksBudget(String stockId, BusiFavorStocksBudgetRequest request) throws WxPayException { + String url = String.format("%s/v3/marketing/busifavor/stocks/%s/budget", this.payService.getPayBaseUrl(), stockId); + String result = payService.patchV3(url, GSON.toJson(request)); + return GSON.fromJson(result, BusiFavorStocksBudgetResult.class); + } + + @Override + public String updateBusiFavorStocksV3(String stockId, BusiFavorStocksCreateRequest request) throws WxPayException { + String url = String.format("%s/v3/marketing/busifavor/stocks/%s", this.payService.getPayBaseUrl(), stockId); + return this.payService.patchV3(url, GSON.toJson(request)); + } + + @Override + public BusiFavorCouponsReturnResult returnBusiFavorCoupons(BusiFavorCouponsReturnRequest request) throws WxPayException { + String url = String.format("%s/v3/marketing/busifavor/coupons/return", this.payService.getPayBaseUrl()); + String result = this.payService.postV3WithWechatpaySerial(url, GSON.toJson(request)); + return GSON.fromJson(result, BusiFavorCouponsReturnResult.class); + } + + @Override + public BusiFavorCouponsDeactivateResult deactiveBusiFavorCoupons(BusiFavorCouponsDeactivateRequest request) throws WxPayException { + String url = String.format("%s/v3/marketing/busifavor/coupons/deactivate", this.payService.getPayBaseUrl()); + String result = this.payService.postV3WithWechatpaySerial(url, GSON.toJson(request)); + return GSON.fromJson(result, BusiFavorCouponsDeactivateResult.class); + } + + @Override + public BusiFavorSubsidyResult subsidyBusiFavorPayReceipts(BusiFavorSubsidyRequest request) throws WxPayException { + String url = String.format("%s/v3/marketing/busifavor/subsidy/pay-receipts", this.payService.getPayBaseUrl()); + String result = this.payService.postV3WithWechatpaySerial(url, GSON.toJson(request)); + return GSON.fromJson(result, BusiFavorSubsidyResult.class); + } + + @Override + public BusiFavorSubsidyResult queryBusiFavorSubsidyPayReceipts(String subsidyReceiptId) throws WxPayException { + String url = String.format("%s/v3/marketing/busifavor/subsidy/pay-receipts/%s", this.payService.getPayBaseUrl(), subsidyReceiptId); + String result = this.payService.getV3(url); + return GSON.fromJson(result, BusiFavorSubsidyResult.class); + } + + @Override + public BusiFavorNotifyResult notifyBusiFavor(String url, BusiFavorNotifyRequest request) throws WxPayException { + String result = this.payService.postV3WithWechatpaySerial(url, GSON.toJson(request)); + return GSON.fromJson(result, BusiFavorNotifyResult.class); + } +} diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/WxPayServiceApacheHttpImpl.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/WxPayServiceApacheHttpImpl.java index f9b3254fd3..87d5014acf 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/WxPayServiceApacheHttpImpl.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/WxPayServiceApacheHttpImpl.java @@ -13,10 +13,7 @@ import org.apache.http.auth.UsernamePasswordCredentials; import org.apache.http.client.CredentialsProvider; import org.apache.http.client.config.RequestConfig; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.client.methods.HttpRequestBase; +import org.apache.http.client.methods.*; import org.apache.http.conn.ssl.DefaultHostnameVerifier; import org.apache.http.conn.ssl.SSLConnectionSocketFactory; import org.apache.http.entity.ContentType; @@ -125,6 +122,46 @@ public String postV3(String url, String requestStr) throws WxPayException { } + @Override + public String patchV3(String url, String requestStr) throws WxPayException { + CloseableHttpClient httpClient = this.createApiV3HttpClient(); + HttpPatch httpPatch = new HttpPatch(url); + httpPatch.setEntity(this.createEntry(requestStr)); + + httpPatch.setConfig(RequestConfig.custom() + .setConnectionRequestTimeout(this.getConfig().getHttpConnectionTimeout()) + .setConnectTimeout(this.getConfig().getHttpConnectionTimeout()) + .setSocketTimeout(this.getConfig().getHttpTimeout()) + .build()); + + httpPatch.addHeader("Accept", "application/json"); + httpPatch.addHeader("Content-Type", "application/json"); + try (CloseableHttpResponse response = httpClient.execute(httpPatch)) { + //v3已经改为通过状态码判断200 204 成功 + int statusCode = response.getStatusLine().getStatusCode(); + //post方法有可能会没有返回值的情况 + String responseString; + if (response.getEntity() == null) { + responseString = null; + } else { + responseString = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8); + } + if (HttpStatus.SC_OK == statusCode || HttpStatus.SC_NO_CONTENT == statusCode) { + this.log.info("\n【请求地址】:{}\n【请求数据】:{}\n【响应数据】:{}", url, requestStr, responseString); + return responseString; + } else { + //有错误提示信息返回 + JsonObject jsonObject = GsonParser.parse(responseString); + throw convertException(jsonObject); + } + } catch (Exception e) { + this.log.error("\n【请求地址】:{}\n【请求数据】:{}\n【异常信息】:{}", url, requestStr, e.getMessage()); + throw (e instanceof WxPayException) ? (WxPayException) e : new WxPayException(e.getMessage(), e); + } finally { + httpPatch.releaseConnection(); + } + } + @Override public String postV3WithWechatpaySerial(String url, String requestStr) throws WxPayException { CloseableHttpClient httpClient = this.createApiV3HttpClient(); diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/WxPayServiceJoddHttpImpl.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/WxPayServiceJoddHttpImpl.java index 5aafc3902b..3745284544 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/WxPayServiceJoddHttpImpl.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/WxPayServiceJoddHttpImpl.java @@ -66,6 +66,11 @@ public String postV3(String url, String requestStr) throws WxPayException { return null; } + @Override + public String patchV3(String url, String requestStr) throws WxPayException { + return null; + } + @Override public String postV3WithWechatpaySerial(String url, String requestStr) throws WxPayException { return null; diff --git a/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/impl/MarketingBusiFavorServiceImplTest.java b/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/impl/MarketingBusiFavorServiceImplTest.java new file mode 100644 index 0000000000..5c267011fc --- /dev/null +++ b/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/impl/MarketingBusiFavorServiceImplTest.java @@ -0,0 +1,292 @@ +package com.github.binarywang.wxpay.service.impl; + +import com.github.binarywang.wxpay.bean.marketing.*; +import com.github.binarywang.wxpay.bean.marketing.busifavor.CouponAvailableTime; +import com.github.binarywang.wxpay.bean.marketing.busifavor.CouponUseRule; +import com.github.binarywang.wxpay.bean.marketing.busifavor.FixedNormalCoupon; +import com.github.binarywang.wxpay.bean.marketing.busifavor.StockSendRule; +import com.github.binarywang.wxpay.bean.marketing.enums.StockTypeEnum; +import com.github.binarywang.wxpay.exception.WxPayException; +import com.github.binarywang.wxpay.service.WxPayService; +import com.github.binarywang.wxpay.testbase.ApiTestModule; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.inject.Inject; +import lombok.extern.slf4j.Slf4j; +import org.assertj.core.util.Lists; +import org.testng.annotations.Guice; +import org.testng.annotations.Test; + +/** + *

+ *  营销工具代金券测试类
+ * 
+ * + * @author thinsstar + */ +@Slf4j +@Test +@Guice(modules = ApiTestModule.class) +public class MarketingBusiFavorServiceImplTest { + + @Inject + private WxPayService wxPayService; + + private static final Gson GSON = new GsonBuilder().create(); + + private final String stockId = "1252430000000013"; + + private final String appId = "wxb3d189e6a9160863"; + private final String openId = "o3zqj1XFQBg4ju-cMs0AOqVYG0ow"; + + @Test + public void testCreateFavorStocksV3() throws WxPayException { + BusiFavorStocksCreateRequest request = new BusiFavorStocksCreateRequest(); + request.setStockName("买价值984元3大罐送价值316元2小罐"); + request.setBelongMerchant(wxPayService.getConfig().getMchId()); + request.setComment("买价值984元3大罐送价值316元2小罐"); + request.setGoodsName("仅供安满品牌商品使用"); + request.setCouponCodeMode("WECHATPAY_MODE"); + request.setOutRequestNo(wxPayService.getConfig().getMchId() + "20210204" + "1234567891"); + + //核销规则 + CouponUseRule couponUseRule = new CouponUseRule(); + + //线下核销 + couponUseRule.setUseMethod("OFF_LINE"); + + //券可核销时间 + CouponAvailableTime couponAvailableTime = new CouponAvailableTime(); + couponAvailableTime.setAvailableBeginTime("2021-05-20T13:29:35+08:00"); + couponAvailableTime.setAvailableEndTime("2021-05-21T13:29:35+08:00"); + couponUseRule.setCouponAvailableTime(couponAvailableTime); + + //固定面额满减券 + request.setStockType(StockTypeEnum.NORMAL); + FixedNormalCoupon fixedNormalCoupon = new FixedNormalCoupon(); + fixedNormalCoupon.setDiscountAmount(31600); + fixedNormalCoupon.setTransactionMinimum(98400); + couponUseRule.setFixedNormalCoupon(fixedNormalCoupon); + request.setCouponUseRule(couponUseRule); + + //发放规则 + StockSendRule stockSendRule = new StockSendRule(); + stockSendRule.setMaxCoupons(100); + stockSendRule.setMaxCouponsPerUser(5); + request.setStockSendRule(stockSendRule); + + BusiFavorStocksCreateResult result = wxPayService.getMarketingBusiFavorService().createBusiFavorStocksV3(request); + String stockId = result.getStockId(); + + log.info("stockId: [{}]", stockId); + } + + @Test + public void testGetBusiFavorStocksV3() throws WxPayException { + BusiFavorStocksGetResult result = wxPayService.getMarketingBusiFavorService().getBusiFavorStocksV3("1252430000000012"); + + log.info("result: {}", GSON.toJson(result)); + } + + @Test + public void testVerifyBusiFavorCouponsUseV3() throws WxPayException { + BusiFavorCouponsUseRequest request = new BusiFavorCouponsUseRequest(); + request.setCouponCode("sxxe34343434"); + request.setAppId("wx1234567889999"); + request.setUseTime("2015-05-20T13:29:35+08:00"); + request.setUseRequestNo("1002600620019090123143254435"); + + BusiFavorCouponsUseResult result = wxPayService.getMarketingBusiFavorService().verifyBusiFavorCouponsUseV3(request); + log.info("result: {}", GSON.toJson(result)); + } + + @Test + public void testBuildBusiFavorCouponinfoUrl() throws WxPayException { + BusiFavorCouponsUrlRequest request = new BusiFavorCouponsUrlRequest(); + request.setOpenid(openId); + request.setOutRequestNo("100002322019090134242"); + request.setSendCouponMerchant("1466573302"); + request.setStockId(stockId); + + String result = wxPayService.getMarketingBusiFavorService().buildBusiFavorCouponinfoUrl(request); + log.info("result: {}", result); + } + + @Test + public void testQueryBusiFavorUsersCoupons() throws WxPayException { + BusiFavorQueryUserCouponsRequest request = new BusiFavorQueryUserCouponsRequest(); + + request.setOpenid(openId); + request.setAppid(appId); + request.setStockId("9865000"); + request.setCouponState("USED"); + request.setCreatorMerchant("1466573302"); + BusiFavorQueryUserCouponsResult result = wxPayService.getMarketingBusiFavorService().queryBusiFavorUsersCoupons(request); + log.info("result: {}", result); + } + + @Test + public void testQueryOneBusiFavorUsersCoupons() throws WxPayException { + BusiFavorQueryOneUserCouponsRequest request = new BusiFavorQueryOneUserCouponsRequest(); + + request.setOpenid(openId); + request.setAppid(appId); + request.setCouponCode("123446565767"); + BusiFavorQueryOneUserCouponsResult result = wxPayService.getMarketingBusiFavorService().queryOneBusiFavorUsersCoupons(request); + log.info("result: {}", result); + } + + @Test + public void testUploadBusiFavorCouponCodes() throws WxPayException { + BusiFavorCouponCodeRequest request = new BusiFavorCouponCodeRequest(); + request.setCouponCodeList(Lists.newArrayList("123")); + request.setUploadRequestNo("upload_request_no"); + BusiFavorCouponCodeResult result = wxPayService.getMarketingBusiFavorService().uploadBusiFavorCouponCodes("98065001", request); + log.info("result: {}", result); + } + + @Test + public void testCreateBusiFavorCallbacks() throws WxPayException { + BusiFavorCallbacksRequest request = new BusiFavorCallbacksRequest(); + request.setMchid(wxPayService.getConfig().getMchId()); + request.setNotifyUrl("https://ww.sd"); + BusiFavorCallbacksResult result = wxPayService.getMarketingBusiFavorService().createBusiFavorCallbacks(request); + log.info("result: {}", result); + } + + @Test + public void testQueryBusiFavorCallbacks() throws WxPayException { + BusiFavorCallbacksRequest request = new BusiFavorCallbacksRequest(); + request.setMchid(wxPayService.getConfig().getMchId()); + BusiFavorCallbacksResult result = wxPayService.getMarketingBusiFavorService().queryBusiFavorCallbacks(request); + log.info("result: {}", result); + } + + @Test + public void testQueryBusiFavorCouponsAssociate() throws WxPayException { + BusiFavorCouponsAssociateRequest request = new BusiFavorCouponsAssociateRequest(); + request.setStockId("100088"); + request.setCouponCode("sxxe34343434"); + request.setOutTradeNo("MCH_102233445"); + request.setOutRequestNo("1002600620019090123143254435"); + BusiFavorCouponsAssociateResult result = wxPayService.getMarketingBusiFavorService().queryBusiFavorCouponsAssociate(request); + log.info("result: {}", result); + } + + @Test + public void testQueryBusiFavorCouponsDisassociate() throws WxPayException { + BusiFavorCouponsAssociateRequest request = new BusiFavorCouponsAssociateRequest(); + request.setStockId("100088"); + request.setCouponCode("sxxe34343434"); + request.setOutTradeNo("MCH_102233445"); + request.setOutRequestNo("1002600620019090123143254435"); + BusiFavorCouponsAssociateResult result = wxPayService.getMarketingBusiFavorService().queryBusiFavorCouponsDisAssociate(request); + log.info("result: {}", result); + } + + @Test + public void testUpdateBusiFavorStocksBudget() throws WxPayException { + BusiFavorStocksBudgetRequest request = new BusiFavorStocksBudgetRequest(); + request.setTargetMaxCoupons(10); + request.setCurrentMaxCoupons(4); + request.setModifyBudgetRequestNo("1002600620019090123143254436"); + BusiFavorStocksBudgetResult result = wxPayService.getMarketingBusiFavorService().updateBusiFavorStocksBudget("98065001", request); + log.info("result: {}", result); + } + + @Test + public void testUpdateFavorStocksV3() throws WxPayException { + BusiFavorStocksCreateRequest request = new BusiFavorStocksCreateRequest(); + request.setStockName("买价值984元3大罐送价值316元2小罐1"); + request.setComment("买价值984元3大罐送价值316元2小罐"); + request.setGoodsName("仅供安满品牌商品使用"); + request.setOutRequestNo(wxPayService.getConfig().getMchId() + "20210204" + "1234567890"); + + +// //核销规则 +// CouponUseRule couponUseRule = new CouponUseRule(); + +// //线下核销 +// couponUseRule.setUseMethod("OFF_LINE"); +// +// //券可核销时间 +// CouponAvailableTime couponAvailableTime = new CouponAvailableTime(); +// couponAvailableTime.setAvailableBeginTime("2021-05-20T13:29:35+08:00"); +// couponAvailableTime.setAvailableEndTime("2021-05-21T13:29:35+08:00"); +// couponUseRule.setCouponAvailableTime(couponAvailableTime); +// +// //固定面额满减券 +// request.setStockType(StockTypeEnum.NORMAL); +// FixedNormalCoupon fixedNormalCoupon = new FixedNormalCoupon(); +// fixedNormalCoupon.setDiscountAmount(31600); +// fixedNormalCoupon.setTransactionMinimum(98400); +// couponUseRule.setFixedNormalCoupon(fixedNormalCoupon); +// request.setCouponUseRule(couponUseRule); +// +// //发放规则 +// StockSendRule stockSendRule = new StockSendRule(); +// stockSendRule.setMaxCoupons(100); +// stockSendRule.setMaxCouponsPerUser(5); +// request.setStockSendRule(stockSendRule); + + String result = wxPayService.getMarketingBusiFavorService().updateBusiFavorStocksV3("1252430000000012", request); + + log.info("result: [{}]", result); + } + + @Test + public void testReturnBusiFavorCoupons() throws WxPayException { + BusiFavorCouponsReturnRequest request = new BusiFavorCouponsReturnRequest(); + request.setReturnRequestNo("1002600620019090123143254436"); + request.setStockId("1234567891"); + request.setCouponCode("sxxe34343434"); + BusiFavorCouponsReturnResult result = wxPayService.getMarketingBusiFavorService().returnBusiFavorCoupons(request); + log.info("result: {}", result); + } + + @Test + public void testDeactivateBusiFavorCoupons() throws WxPayException { + BusiFavorCouponsDeactivateRequest request = new BusiFavorCouponsDeactivateRequest(); + request.setDeactivateRequestNo("1002600620019090123143254436"); + request.setDeactivateReason("此券使用时间设置错误"); + request.setStockId("1234567891"); + request.setCouponCode("sxxe34343434"); + BusiFavorCouponsDeactivateResult result = wxPayService.getMarketingBusiFavorService().deactiveBusiFavorCoupons(request); + log.info("result: {}", result); + } + + @Test + public void testSubsidyBusiFavorPayReceipts() throws WxPayException { + BusiFavorSubsidyRequest request = new BusiFavorSubsidyRequest(); + request.setStockId("128888000000001"); + request.setCouponCode("ABCD12345678"); + request.setTransactionId("4200000913202101152566792388"); + request.setPayeeMerchant("1466573302"); + request.setPayerMerchant("1466573302"); + request.setAmount(100); + request.setDescription("20210115DESCRIPTION"); + request.setOutSubsidyNo("subsidy-abcd-12345678"); + BusiFavorSubsidyResult result = wxPayService.getMarketingBusiFavorService().subsidyBusiFavorPayReceipts(request); + + log.info("result: {}", result); + } + + @Test + public void testQueryBusiFavorSubsidyPayReceipts() throws WxPayException { + BusiFavorSubsidyResult result = wxPayService.getMarketingBusiFavorService().queryBusiFavorSubsidyPayReceipts("1120200119165100000000000001"); + log.info("result: {}", result); + } + + @Test + public void testNotifyBusiFavor() throws WxPayException { + BusiFavorNotifyRequest request = new BusiFavorNotifyRequest(); + request.setId("8b33f79f-8869-5ae5-b41b-3c0b59f957d0"); + request.setCreateTime("2019-12-12T16:54:38+08:00"); + request.setEventType("COUPON.SEND"); + request.setResourceType("encrypt-resource"); + + BusiFavorNotifyResult result = wxPayService.getMarketingBusiFavorService().notifyBusiFavor("https://www.yujam.com", request); + + log.info("result: {}", result); + } +}