diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/enumeration/BusiFavorCodeDisplayMode.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/enumeration/BusiFavorCodeDisplayMode.java new file mode 100644 index 0000000..afd503c --- /dev/null +++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/enumeration/BusiFavorCodeDisplayMode.java @@ -0,0 +1,38 @@ +/* + * Copyright 2019-2021 felord.cn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * Website: + * https://felord.cn + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package cn.felord.payment.wechat.enumeration; + +/** + * code展示模式 + * + * @author felord.cn + * @since 1.0.4.RELEASE + */ +public enum BusiFavorCodeDisplayMode { + /** + * 不展示code + */ + NOT_SHOW, + /** + * 一维码(条形码) + */ + BARCODE, + /** + * 二维码 + */ + QRCODE +} diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/enumeration/BusiFavorUseMethod.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/enumeration/BusiFavorUseMethod.java new file mode 100644 index 0000000..90323a2 --- /dev/null +++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/enumeration/BusiFavorUseMethod.java @@ -0,0 +1,51 @@ +/* + * Copyright 2019-2021 felord.cn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * Website: + * https://felord.cn + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package cn.felord.payment.wechat.enumeration; + +/** + * 商家券核销方式 + * + * @author felord.cn + * @since 1.0.4.RELEASE + */ +public enum BusiFavorUseMethod { + + /** + * 线下滴码核销,点击券“立即使用”跳转展示券二维码详情。 + * + * @since 1.0.4.RELEASE + */ + OFF_LINE, + /** + * 线上小程序核销,点击券“立即使用”跳转至配置的商家小程序(需要添加小程序appid和path)。 + * + * @since 1.0.4.RELEASE + */ + MINI_PROGRAMS, + /** + * 微信支付付款码核销,点击券“立即使用”跳转至微信支付钱包付款码。 + * + * @since 1.0.4.RELEASE + */ + PAYMENT_CODE, + /** + * 用户自助核销,点击券“立即使用”跳转至用户自助操作核销界面(当前暂不支持用户自助核销)。 + * + * @since 1.0.4.RELEASE + */ + SELF_CONSUME; +} diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/enumeration/CouponStatus.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/enumeration/CouponStatus.java index 0c534c0..a52976c 100644 --- a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/enumeration/CouponStatus.java +++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/enumeration/CouponStatus.java @@ -19,7 +19,7 @@ package cn.felord.payment.wechat.enumeration; /** - * 代金券状态. + * 代金券、商家券状态. * * @author felord.cn * @since 1.0.0.RELEASE diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/enumeration/FundFlowAccountType.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/enumeration/FundFlowAccountType.java index effbbf8..6e94b9c 100644 --- a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/enumeration/FundFlowAccountType.java +++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/enumeration/FundFlowAccountType.java @@ -20,6 +20,7 @@ package cn.felord.payment.wechat.enumeration; /** * 申请资金账单账户类型. * + * @author felord.cn * @since 1.0.3.RELEASE */ public enum FundFlowAccountType { diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/enumeration/StockType.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/enumeration/StockType.java index 9f9c78f..2eb4804 100644 --- a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/enumeration/StockType.java +++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/enumeration/StockType.java @@ -40,5 +40,5 @@ public enum StockType { * * @since 1.0.4.RELEASE */ - EXCHANGE; + EXCHANGE } diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/enumeration/WechatPayV3Type.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/enumeration/WechatPayV3Type.java index 59bb9d1..cefb47c 100644 --- a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/enumeration/WechatPayV3Type.java +++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/enumeration/WechatPayV3Type.java @@ -341,8 +341,93 @@ public enum WechatPayV3Type { * * @since 1.0.0.RELEASE */ - MARKETING_FAVOR_CALLBACKS(HttpMethod.POST, "%s/v3/marketing/favor/callbacks"); + MARKETING_FAVOR_CALLBACKS(HttpMethod.POST, "%s/v3/marketing/favor/callbacks"), + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + /** + * 创建商家券API. + * + * @since 1.0.4.RELEASE + */ + MARKETING_BUSI_FAVOR_CREATE_STOCKS(HttpMethod.POST, "%s/v3/marketing/busifavor/stocks"), + /** + * 查询商家券详情API. + * + * @since 1.0.4.RELEASE + */ + MARKETING_BUSI_FAVOR_STOCKS_DETAIL(HttpMethod.GET, "%s/v3/marketing/busifavor/stocks/{stock_id}"), + /** + * 核销用户券API. + * + * @since 1.0.4.RELEASE + */ + MARKETING_BUSI_FAVOR_COUPON_USE(HttpMethod.POST, "%s/v3/marketing/busifavor/coupons/use"), + /** + * 根据过滤条件查询用户券API. + * + * @since 1.0.4.RELEASES + */ + MARKETING_BUSI_FAVOR_USER_COUPONS(HttpMethod.GET, "%s/v3/marketing/busifavor/users/{openid}/coupons"), + /** + * 查询用户单张券详情API. + * + * @since 1.0.4.RELEASES + */ + MARKETING_BUSI_FAVOR_USER_COUPON(HttpMethod.GET, "%s/v3/marketing/busifavor/users/{openid}/coupons/{coupon_code}/appids/{appid}"), + /** + * 商家券上传预存Code API. + * + * @since 1.0.4.RELEASES + */ + MARKETING_BUSI_FAVOR_UPLOAD_COUPON_CODES(HttpMethod.POST, "%s/v3/marketing/busifavor/stocks/{stock_id}/couponcodes"), + /** + * 设置商家券事件通知地址API. + * + * @since 1.0.4.RELEASES + */ + MARKETING_BUSI_FAVOR_SETTING_CALLBACKS(HttpMethod.POST, "%s/v3/marketing/busifavor/callbacks"), + /** + * 查询商家券事件通知地址API. + * + * @since 1.0.4.RELEASES + */ + MARKETING_BUSI_FAVOR_GET_CALLBACKS(HttpMethod.GET, "%s/v3/marketing/busifavor/callbacks"), + /** + * 关联订单信息API. + * + * @since 1.0.4.RELEASES + */ + MARKETING_BUSI_FAVOR_ASSOCIATE(HttpMethod.POST, "%s/v3/marketing/busifavor/coupons/associate"), + /** + * 取消关联订单信息API. + * + * @since 1.0.4.RELEASES + */ + MARKETING_BUSI_FAVOR_DISASSOCIATE(HttpMethod.POST, "%s/v3/marketing/busifavor/coupons/disassociate"), + /** + * 取消关联订单信息API. + * + * @since 1.0.4.RELEASES + */ + MARKETING_BUSI_FAVOR_BUDGET(HttpMethod.POST, "%s/v3/marketing/busifavor/stocks/{stock_id}/budget"), + /** + * 修改商家券基本信息API. + * + * @since 1.0.4.RELEASES + */ + MARKETING_BUSI_FAVOR_UPDATE(HttpMethod.POST, "%s/v3/marketing/busifavor/stocks/{stock_id}"), + /** + * 申请退券API. + * + * @since 1.0.4.RELEASES + */ + MARKETING_BUSI_FAVOR_RETURN(HttpMethod.POST, "%s/v3/marketing/busifavor/coupons/return"), + /** + * 使券失效API. + * + * @since 1.0.4.RELEASES + */ + MARKETING_BUSI_FAVOR_DEACTIVATE(HttpMethod.POST, "%s/v3/marketing/busifavor/coupons/deactivate"); /** * The Pattern. diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/ExtensionFormHttpMessageConverter.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/ExtensionFormHttpMessageConverter.java index 930d435..74413b1 100644 --- a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/ExtensionFormHttpMessageConverter.java +++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/ExtensionFormHttpMessageConverter.java @@ -55,36 +55,35 @@ final class ExtensionFormHttpMessageConverter extends FormHttpMessageConverter { */ private static final String BOUNDARY = "boundary"; - /** * The constant jaxb2Present. */ - private static final boolean jaxb2Present; + private static final boolean JAXB_2_PRESENT; /** * The constant jackson2Present. */ - private static final boolean jackson2Present; + private static final boolean JACKSON_2_PRESENT; /** * The constant jackson2XmlPresent. */ - private static final boolean jackson2XmlPresent; + private static final boolean JACKSON_2_XML_PRESENT; /** * The constant jackson2SmilePresent. */ - private static final boolean jackson2SmilePresent; + private static final boolean JACKSON_2_SMILE_PRESENT; /** * The constant gsonPresent. */ - private static final boolean gsonPresent; + private static final boolean GSON_PRESENT; /** * The constant jsonbPresent. */ - private static final boolean jsonbPresent; + private static final boolean JSONB_PRESENT; /** * The Part converters. @@ -93,13 +92,13 @@ final class ExtensionFormHttpMessageConverter extends FormHttpMessageConverter { static { ClassLoader classLoader = AllEncompassingFormHttpMessageConverter.class.getClassLoader(); - jaxb2Present = ClassUtils.isPresent("javax.xml.bind.Binder", classLoader); - jackson2Present = ClassUtils.isPresent("com.fasterxml.jackson.databind.ObjectMapper", classLoader) && + JAXB_2_PRESENT = ClassUtils.isPresent("javax.xml.bind.Binder", classLoader); + JACKSON_2_PRESENT = ClassUtils.isPresent("com.fasterxml.jackson.databind.ObjectMapper", classLoader) && ClassUtils.isPresent("com.fasterxml.jackson.core.JsonGenerator", classLoader); - jackson2XmlPresent = ClassUtils.isPresent("com.fasterxml.jackson.dataformat.xml.XmlMapper", classLoader); - jackson2SmilePresent = ClassUtils.isPresent("com.fasterxml.jackson.dataformat.smile.SmileFactory", classLoader); - gsonPresent = ClassUtils.isPresent("com.google.gson.Gson", classLoader); - jsonbPresent = ClassUtils.isPresent("javax.json.bind.Jsonb", classLoader); + JACKSON_2_XML_PRESENT = ClassUtils.isPresent("com.fasterxml.jackson.dataformat.xml.XmlMapper", classLoader); + JACKSON_2_SMILE_PRESENT = ClassUtils.isPresent("com.fasterxml.jackson.dataformat.smile.SmileFactory", classLoader); + GSON_PRESENT = ClassUtils.isPresent("com.google.gson.Gson", classLoader); + JSONB_PRESENT = ClassUtils.isPresent("javax.json.bind.Jsonb", classLoader); } /** @@ -107,7 +106,8 @@ final class ExtensionFormHttpMessageConverter extends FormHttpMessageConverter { */ public ExtensionFormHttpMessageConverter() { StringHttpMessageConverter stringHttpMessageConverter = new StringHttpMessageConverter(); - stringHttpMessageConverter.setWriteAcceptCharset(false); // see SPR-7316 + // see SPR-7316 + stringHttpMessageConverter.setWriteAcceptCharset(false); this.partConverters.add(new ByteArrayHttpMessageConverter()); this.partConverters.add(stringHttpMessageConverter); @@ -118,23 +118,23 @@ final class ExtensionFormHttpMessageConverter extends FormHttpMessageConverter { // Ignore when no TransformerFactory implementation is available } - if (jaxb2Present && !jackson2XmlPresent) { + if (JAXB_2_PRESENT && !JACKSON_2_XML_PRESENT) { this.partConverters.add(new Jaxb2RootElementHttpMessageConverter()); } - if (jackson2Present) { + if (JACKSON_2_PRESENT) { this.partConverters.add(new MappingJackson2HttpMessageConverter()); - } else if (gsonPresent) { + } else if (GSON_PRESENT) { this.partConverters.add(new GsonHttpMessageConverter()); - } else if (jsonbPresent) { + } else if (JSONB_PRESENT) { this.partConverters.add(new JsonbHttpMessageConverter()); } - if (jackson2XmlPresent) { + if (JACKSON_2_XML_PRESENT) { this.partConverters.add(new MappingJackson2XmlHttpMessageConverter()); } - if (jackson2SmilePresent) { + if (JACKSON_2_SMILE_PRESENT) { this.partConverters.add(new MappingJackson2SmileHttpMessageConverter()); } this.setPartConverters(this.partConverters); @@ -205,7 +205,8 @@ final class ExtensionFormHttpMessageConverter extends FormHttpMessageConverter { outputMessage.getHeaders().setContentType(contentType); Charset charset = contentType.getCharset(); - Assert.notNull(charset, "No charset"); // should never occur + // should never occur + Assert.notNull(charset, "No charset"); final byte[] bytes = serializeForm(formData, charset).getBytes(charset); outputMessage.getHeaders().setContentLength(bytes.length); diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/WechatApiProvider.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/WechatApiProvider.java index b245a96..0d3073b 100644 --- a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/WechatApiProvider.java +++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/WechatApiProvider.java @@ -94,6 +94,17 @@ public class WechatApiProvider { return new WechatDiscountCardApi(wechatPayClient, tenantId); } + /** + * 微信支付商家券. + * + * @param tenantId the tenant id + * @return the wechat discount card api + * @since 1.0.4.RELEASE + */ + public WechatMarketingBusiFavorApi busiFavorApi(String tenantId) { + return new WechatMarketingBusiFavorApi(wechatPayClient, tenantId); + } + /** * 回调. *
diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/WechatMarketingBusiFavorApi.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/WechatMarketingBusiFavorApi.java new file mode 100644 index 0000000..239ffa1 --- /dev/null +++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/WechatMarketingBusiFavorApi.java @@ -0,0 +1,438 @@ +/* + * Copyright 2019-2021 felord.cn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * Website: + * https://felord.cn + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +package cn.felord.payment.wechat.v3; + +import cn.felord.payment.wechat.WechatPayProperties; +import cn.felord.payment.wechat.enumeration.CouponStatus; +import cn.felord.payment.wechat.enumeration.WeChatServer; +import cn.felord.payment.wechat.enumeration.WechatPayV3Type; +import cn.felord.payment.wechat.v3.model.busifavor.*; +import com.fasterxml.jackson.databind.node.ObjectNode; +import org.springframework.http.RequestEntity; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.util.StringUtils; +import org.springframework.web.util.UriComponentsBuilder; + +import java.net.URI; + +/** + * 微信支付商家券. + * + * @author felord.cn + * @since 1.0.4.RELEASE + */ +public class WechatMarketingBusiFavorApi extends AbstractApi { + /** + * Instantiates a new Abstract api. + * + * @param wechatPayClient the wechat pay client + * @param tenantId the tenant id + */ + public WechatMarketingBusiFavorApi(WechatPayClient wechatPayClient, String tenantId) { + super(wechatPayClient, tenantId); + } + + /** + * 创建商家券券批次API + *
+ * 商家券介绍详见 微信支付商家券
+ *
+ * @param params the params
+ * @return the wechat response entity
+ */
+ public WechatResponseEntity
+ * 商户可通过该接口查询已创建的商家券批次详情信息。
+ *
+ * @param stockId the stock id
+ * @return the wechat response entity
+ */
+ public WechatResponseEntity
+ * 在用户满足优惠门槛后,服务商可通过该接口核销用户微信卡包中具体某一张商家券。
+ *
+ * @param params the params
+ * @return the wechat response entity
+ */
+ public WechatResponseEntity
+ * 商户自定义筛选条件(如创建商户号、归属商户号、发放商户号等),查询指定微信用户卡包中满足对应条件的所有商家券信息。
+ *
+ * @param params the params
+ * @return the wechat response entity
+ */
+ public WechatResponseEntity
+ * 服务商可通过该接口查询微信用户卡包中某一张商家券的详情信息。
+ *
+ * @param params the params
+ * @return the wechat response entity
+ */
+ public WechatResponseEntity
+ * 商家券的Code码可由微信后台随机分配,同时支持商户自定义。
+ * 如商家已有自己的优惠券系统,可直接使用自定义模式。
+ * 即商家预先向微信支付上传券Code,当券在发放时,微信支付自动从已导入的Code中随机取值(不能指定),派发给用户。
+ *
+ * @param params the params
+ * @return wechat response entity
+ */
+ public WechatResponseEntity
+ * 用于设置接收商家券相关事件通知的URL,可接收商家券相关的事件通知、包括发放通知等。
+ * 需要设置接收通知的URL,并在商户平台开通 营销事件推送 的能力,即可接收到相关通知。
+ *
+ * 营销事件推送:点击开通产品权限。由商家券批次创建方登录Pay平台,操作开通
+ *
+ * 注意:
+ *
+ * 通过调用此接口可查询设置的通知URL。
+ *
+ * 注意:
+ *
+ * 将有效态(未核销)的商家券与订单信息关联,用于后续参与摇奖&返佣激励等操作的统计。
+ *
+ * 注意:
+ * 仅对有关联订单需求的券进行该操作
+ *
+ * @param associateInfo the associate info
+ * @return wechat response entity
+ */
+ public WechatResponseEntity
+ * 取消商家券与订单信息的关联关系。
+ *
+ * 注意:
+ * 建议取消前调用查询接口,查到当前关联的商户单号并确认后,再进行取消操作
+ *
+ * @param associateInfo the associate info
+ * @return wechat response entity
+ */
+ public WechatResponseEntity
+ * 商户可以通过该接口修改批次单天发放上限数量或者批次最大发放数量
+ *
+ * @param params the params
+ * @return wechat response entity
+ */
+ public WechatResponseEntity
+ * 商户可以通过该接口修改商家券基本信息
+ *
+ * @param params the params
+ * @return wechat response entity
+ */
+ public WechatResponseEntity
+ * 商户可以通过该接口为已核销的券申请退券
+ *
+ * @param params the params
+ * @return wechat response entity
+ */
+ public WechatResponseEntity
+ * 前置条件:券的状态为{@link CouponStatus#SENDED}
+ *
+ * 商户可以通过该接口将可用券进行失效处理,券被失效后无法再被核销
+ *
+ * @param params the params
+ * @return wechat response entity
+ */
+ public WechatResponseEntity
+ * 领券完成后,微信会把相关支付结果和用户信息发送给商户,商户需要接收处理,并按照文档规范返回应答。出于安全的考虑,我们对支付结果数据进行了加密,商户需要先对通知数据进行解密,才能得到支付结果数据。
+ *
+ * 该链接是通过商户设置商家券事件通知地址API中提交notify_url参数,必须为https协议。如果链接无法访问,商户将无法接收到微信通知。 通知url必须为直接可访问的url,不能携带参数。示例: “https://pay.weixin.qq.com/wxpay/pay.action”
+ *
+ * @param params the params
+ * @param consumeDataConsumer the consume data consumer
+ * @return the map
+ */
+ @SneakyThrows
+ public Map
+ * 代金券
*
* @since 1.0.0.RELEASE
*/
- COUPON("COUPON.USE"),
+ COUPON_USE("COUPON.USE"),
+
+ /**
+ * 优惠券领券事件.
+ *
+ * 商家券
+ *
+ * @since 1.0.0.RELEASE
+ */
+ COUPON_SEND("COUPON.SEND"),
+
/**
* 支付成功事件.
*
diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/StocksCreateParams.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/StocksCreateParams.java
index 6ae6dee..2774e93 100644
--- a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/StocksCreateParams.java
+++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/StocksCreateParams.java
@@ -44,12 +44,12 @@ public class StocksCreateParams {
*/
private String belongMerchant;
/**
- * 批次开始时间 rfc 3339 yyyy-mm-ddthh:mm:ss.sss+timezone
+ * 批次开始时间 rfc 3339 yyyy-MM-ddTHH:mm:ss+TIMEZONE
*/
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX", timezone = "GMT+8")
private OffsetDateTime availableBeginTime;
/**
- * 批次结束时间 rfc 3339 YYYY-MM-DDTHH:mm:ss.sss+TIMEZONE
+ * 批次结束时间 rfc 3339 yyyy-MM-ddTHH:mm:ss+TIMEZONE
*/
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX", timezone = "GMT+8")
private OffsetDateTime availableEndTime;
diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/AvailableDayTimeItem.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/AvailableDayTimeItem.java
new file mode 100644
index 0000000..de5e0c8
--- /dev/null
+++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/AvailableDayTimeItem.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2019-2021 felord.cn
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ * Website:
+ * https://felord.cn
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.felord.payment.wechat.v3.model.busifavor;
+
+import lombok.Data;
+
+/**
+ * 商家券当天可用时间段
+ *
+ * @author felord.cn
+ * @since 1.0.4.RELEASE
+ */
+@Data
+public class AvailableDayTimeItem {
+
+ /**
+ * 当天可用开始时间,单位:秒,1代表当天0点0分1秒。
+ */
+ private Integer endTime;
+ /**
+ * 当天可用结束时间,单位:秒,86399代表当天23点59分59秒。
+ */
+ private Integer beginTime;
+}
\ No newline at end of file
diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/AvailableWeek.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/AvailableWeek.java
new file mode 100644
index 0000000..62ce136
--- /dev/null
+++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/AvailableWeek.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2019-2021 felord.cn
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ * Website:
+ * https://felord.cn
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.felord.payment.wechat.v3.model.busifavor;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 固定周期有效时间段
+ *
+ * 可以设置多个星期下的多个可用时间段,比如每周二10点到18点,用户自定义字段。
+ *
+ * @author felord.cn
+ * @since 1.0.4.RELEASE
+ */
+@Data
+public class AvailableWeek {
+
+ /**
+ * 当天可用时间段
+ *
+ * 可以填写多个时间段,最多不超过2个。
+ */
+ private List
+ * 0代表周日,1代表周一,以此类推
+ *
+ * 当填写{@link #availableDayTime}时,{@code weekDay}必填
+ */
+ private List
+ * 特殊规则:单个券code长度为【1,32】,条目个数限制为【1,200】。
+ */
+ private Set
+ * 用来描述批次在哪些商品可用,会显示在微信卡包中。字数上限为15个,一个中文汉字/英文字母/数字均占用一个字数。
+ */
+ private String goodsName;
+ /**
+ * 批次类型
+ */
+ private StockType stockType;
+ /**
+ * 核销规则
+ */
+ private CouponUseRule couponUseRule;
+ /**
+ * 自定义入口
+ */
+ private CustomEntrance customEntrance;
+ /**
+ * 商家券code模式枚举
+ */
+ private CouponCodeMode couponCodeMode;
+ /**
+ * 样式信息
+ */
+ private DisplayPatternInfo displayPatternInfo;
+ /**
+ * 券发放规则
+ */
+ private StockSendRule stockSendRule;
+ /**
+ * 商户请求单号
+ *
+ * 商户创建批次凭据号(格式:商户id+日期+流水号),商户侧需保持唯一性。
+ */
+ private String outRequestNo;
+ /**
+ * 事件通知配置
+ */
+ private BusiFavorNotifyConfig notifyConfig;
+
+
+ /**
+ * 商家券code模式枚举
+ *
+ * @author felord.cn
+ * @since 1.0.4.RELEASE
+ */
+ public enum CouponCodeMode {
+
+ /**
+ * 系统分配券code。(固定22位纯数字)
+ *
+ * @since 1.0.4.RELEASE
+ */
+ WECHATPAY_MODE,
+ /**
+ * 商户发放时接口指定券code。
+ *
+ * @since 1.0.4.RELEASE
+ */
+ MERCHANT_API,
+ /**
+ * 商户上传自定义code,发券时系统随机选取上传的券code。
+ *
+ * @since 1.0.4.RELEASE
+ */
+ MERCHANT_UPLOAD
+ }
+}
\ No newline at end of file
diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/BusiFavorDeactivateParams.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/BusiFavorDeactivateParams.java
new file mode 100644
index 0000000..4d4b96a
--- /dev/null
+++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/BusiFavorDeactivateParams.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2019-2021 felord.cn
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ * Website:
+ * https://felord.cn
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.felord.payment.wechat.v3.model.busifavor;
+
+import lombok.Data;
+
+/**
+ * 使券失效API请求参数
+ *
+ * @author felord.cn
+ * @since 1.0.4.RELEASE
+ */
+@Data
+public class BusiFavorDeactivateParams {
+
+ /**
+ * 券code
+ */
+ private String couponCode;
+ /**
+ * 批次号
+ */
+ private String stockId;
+ /**
+ * 失效请求单据号
+ */
+ private String deactivateRequestNo;
+ /**
+ * 失效原因
+ */
+ private String deactivateReason;
+}
diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/BusiFavorNotifyConfig.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/BusiFavorNotifyConfig.java
new file mode 100644
index 0000000..f156629
--- /dev/null
+++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/BusiFavorNotifyConfig.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2019-2021 felord.cn
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ * Website:
+ * https://felord.cn
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.felord.payment.wechat.v3.model.busifavor;
+
+import lombok.Data;
+
+/**
+ * 事件通知配置
+ *
+ * @author felord.cn
+ * @since 1.0.4.RELEASE
+ */
+@Data
+public class BusiFavorNotifyConfig {
+
+ /**
+ * 事件通知appid
+ *
+ * 用于回调通知时,计算返回操作用户的openid(诸如领券用户),支持小程序or公众号的APPID;
+ * 如该字段不填写,则回调通知中涉及到用户身份信息的openid与unionid都将为空。
+ */
+ private String notifyAppid;
+}
diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/BusiFavorReceiveConsumeData.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/BusiFavorReceiveConsumeData.java
new file mode 100644
index 0000000..2560165
--- /dev/null
+++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/BusiFavorReceiveConsumeData.java
@@ -0,0 +1,162 @@
+/*
+ * Copyright 2019-2021 felord.cn
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ * Website:
+ * https://felord.cn
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.felord.payment.wechat.v3.model.busifavor;
+
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.time.OffsetDateTime;
+
+/**
+ * 商家券领券事件回调通知解密
+ *
+ * @author felord.cn
+ * @since 1.0.4.RELEASE
+ */
+@Data
+public class BusiFavorReceiveConsumeData {
+
+ /**
+ * 业务细分事件类型
+ *
+ * 枚举值:
+ * EVENT_TYPE_BUSICOUPON_SEND:商家券用户领券通知
+ */
+ private String eventType;
+ /**
+ * 券code
+ */
+ private String couponCode;
+ /**
+ * 批次号
+ */
+ private String stockId;
+ /**
+ * 发放时间 rfc 3339 yyyy-MM-ddTHH:mm:ss+TIMEZONE
+ */
+ @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ssXXX", timezone = "GMT+8")
+ private OffsetDateTime sendTime;
+ /**
+ * 微信用户在appid下的唯一标识。
+ */
+ private String openid;
+ /**
+ * 微信用户在同一个微信开放平台账号下的唯一用户标识,
+ * unionid获取方式请参见 《UnionID机制说明》 文档。
+ */
+ private String unionid;
+ /**
+ * 发券商户号
+ */
+ private String sendMerchant;
+ /**
+ * 发放渠道
+ */
+ private SendChannel sendChannel;
+ /**
+ * 发券附加信息,仅在支付有礼、扫码领券(营销馆)、会员有礼发放渠道,才有该信息
+ */
+ private AttachInfo attachInfo;
+
+
+ /**
+ * 发放渠道
+ *
+ * @author felord.cn
+ * @since 1.0.4.RELEASE
+ */
+ public enum SendChannel {
+
+ /**
+ * 小程序
+ */
+ BUSICOUPON_SEND_CHANNEL_MINIAPP,
+ /**
+ * API
+ */
+ BUSICOUPON_SEND_CHANNEL_API,
+ /**
+ * 支付有礼
+ */
+ BUSICOUPON_SEND_CHANNEL_PAYGIFT,
+ /**
+ * H5
+ */
+ BUSICOUPON_SEND_CHANNEL_H5,
+
+ /**
+ * 面对面
+ */
+ BUSICOUPON_SEND_CHANNEL_FTOF,
+ /**
+ * 会员卡活动
+ */
+ BUSICOUPON_SEND_CHANNEL_MEMBER_CARD_ACT,
+ /**
+ * 扫码领券(营销馆)
+ */
+ BUSICOUPON_SEND_CHANNEL_HALL
+ }
+
+ /**
+ * 商家券领券事件回调通知解密-发券附加信息
+ *
+ * 仅在支付有礼、扫码领券(营销馆)、会员有礼发放渠道,才有该信息
+ *
+ * @author felord.cn
+ * @since 1.0.4.RELEASE
+ */
+ @Data
+ public static class AttachInfo {
+
+ /**
+ * 交易订单编号
+ *
+ * 仅在支付有礼渠道,才有该信息,对应支付有礼曝光支付订单编号信息
+ */
+ private String transactionId;
+ /**
+ * 支付有礼活动编号对应{@link SendChannel#BUSICOUPON_SEND_CHANNEL_PAYGIFT}
+ *
+ * 营销馆活动ID对应{@link SendChannel#BUSICOUPON_SEND_CHANNEL_HALL}
+ *
+ * 二选一,且只在对应场景下出现
+ */
+ private String actCode;
+ /**
+ * 仅在扫码领券(营销馆)渠道,才有该信息,对应领券的营销馆 馆ID信息
+ */
+ private String hallCode;
+ /**
+ * 仅在扫码领券(营销馆)渠道,才有该信息,对应领券的营销馆所属商户号信息
+ */
+ private Integer hallBelongMchId;
+ /**
+ * 仅在会员卡活动渠道,才有该信息,对应会员卡Card_ID信息
+ */
+ private String cardId;
+ /**
+ * 仅在会员卡活动渠道,才有该信息,对应用户卡包会员卡卡Code信息
+ */
+ private String code;
+ /**
+ * 仅在会员卡活动渠道,才有该信息,对应会员有礼活动ID信息
+ */
+ private String activityId;
+ }
+}
diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/BusiFavorRefundParams.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/BusiFavorRefundParams.java
new file mode 100644
index 0000000..8e6b5aa
--- /dev/null
+++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/BusiFavorRefundParams.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2019-2021 felord.cn
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ * Website:
+ * https://felord.cn
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.felord.payment.wechat.v3.model.busifavor;
+
+import lombok.Data;
+
+/**
+ * 修改商家券基本信息API请求参数
+ *
+ * @author felord.cn
+ * @since 1.0.4.RELEASE
+ */
+@Data
+public class BusiFavorRefundParams {
+
+ /**
+ * 券code
+ */
+ private String couponCode;
+ /**
+ * 批次号
+ */
+ private String stockId;
+ /**
+ * 退券请求单据号
+ */
+ private String returnRequestNo;
+}
diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/BusiFavorUpdateParams.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/BusiFavorUpdateParams.java
new file mode 100644
index 0000000..db0432e
--- /dev/null
+++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/BusiFavorUpdateParams.java
@@ -0,0 +1,159 @@
+/*
+ * Copyright 2019-2021 felord.cn
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ * Website:
+ * https://felord.cn
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.felord.payment.wechat.v3.model.busifavor;
+
+import cn.felord.payment.wechat.enumeration.BusiFavorCodeDisplayMode;
+import cn.felord.payment.wechat.enumeration.BusiFavorUseMethod;
+import lombok.Data;
+
+/**
+ * 修改商家券基本信息API请求参数.
+ *
+ * @author felord.cn
+ * @since 1.0.4.RELEASE
+ */
+@Data
+public class BusiFavorUpdateParams {
+
+ /**
+ * 商家券批次号,必传
+ */
+ private String stockId;
+ /**
+ * 自定义入口
+ */
+ private UpdateCustomEntrance customEntrance;
+ /**
+ * 商家券批次名称,[1,21]
+ */
+ private String stockName;
+ /**
+ * 批次备注,[1,20]
+ */
+ private String comment;
+ /**
+ * 适用商品范围
+ *
+ * 用来描述批次在哪些商品可用,会显示在微信卡包中。字数上限为15个,一个中文汉字/英文字母/数字均占用一个字数。
+ */
+ private String goodsName;
+ /**
+ * 商户请求单号
+ *
+ * 商户创建批次凭据号(格式:商户id+日期+流水号),商户侧需保持唯一性。
+ */
+ private String outRequestNo;
+ /**
+ * 样式信息
+ */
+ private DisplayPatternInfo displayPatternInfo;
+ /**
+ * 核销规则
+ */
+ private UpdateCouponUseRule couponUseRule;
+ /**
+ * 券发放规则
+ */
+ private UpdateStockSendRule stockSendRule;
+ /**
+ * 事件通知配置
+ */
+ private BusiFavorNotifyConfig notifyConfig;
+
+
+ /**
+ * 商家券核销规则-自定义入口修改参数
+ *
+ * 卡详情页面,可选择多种入口引导用户。
+ *
+ * @author felord.cn
+ * @see CustomEntrance
+ * @since 1.0.4.RELEASE
+ */
+ @Data
+ public static class UpdateCustomEntrance {
+
+ /**
+ * 营销馆id
+ */
+ private String hallId;
+ /**
+ * 小程序入口
+ */
+ private MiniProgramsInfo miniProgramsInfo;
+ /**
+ * 商户公众号appid
+ *
+ * 从券详情可跳转至公众号
+ */
+ private String appid;
+ /**
+ * code展示模式
+ */
+ private BusiFavorCodeDisplayMode codeDisplayMode;
+
+ }
+
+ /**
+ * 商家券核销规则修改参数
+ *
+ * @author felord.cn
+ * @see CouponUseRule
+ * @since 1.0.4.RELEASE
+ */
+ @Data
+ public static class UpdateCouponUseRule {
+
+ /**
+ * 核销方式
+ */
+ private BusiFavorUseMethod useMethod;
+ /**
+ * 核销小程序appid
+ *
+ * @see BusiFavorUseMethod#MINI_PROGRAMS
+ */
+ private String miniProgramsAppid;
+ /**
+ * 核销小程序path
+ *
+ * @see #miniProgramsAppid
+ */
+ private String miniProgramsPath;
+ }
+
+
+ /**
+ * 商家券发放规则修改参数
+ *
+ * @author felord.cn
+ * @see StockSendRule
+ * @since 1.0.4.RELEASE
+ */
+ @Data
+ public static class UpdateStockSendRule {
+
+ /**
+ * 是否开启自然人限制
+ */
+ private Boolean naturalPersonLimit;
+ /**
+ * 可疑账号拦截
+ */
+ private Boolean preventApiAbuse;
+ }
+}
\ No newline at end of file
diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/BusiFavorUseParams.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/BusiFavorUseParams.java
new file mode 100644
index 0000000..b3e24d1
--- /dev/null
+++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/BusiFavorUseParams.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2019-2021 felord.cn
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ * Website:
+ * https://felord.cn
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.felord.payment.wechat.v3.model.busifavor;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.time.OffsetDateTime;
+
+/**
+ * 核销用户券请求参数
+ *
+ * @author felord.cn
+ * @since 1.0.4.RELEASE
+ */
+@Data
+public class BusiFavorUseParams {
+ /**
+ * 券code
+ */
+ private String couponCode;
+ /**
+ * 批次号
+ */
+ private String stockId;
+ /**
+ * 公众账号ID
+ */
+ private String appid;
+ /**
+ * 请求核销时间
+ */
+ @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ssXXX", timezone = "GMT+8")
+ private OffsetDateTime useTime;
+ /**
+ * 核销请求单据号,商户侧保证唯一
+ */
+ private String useRequestNo;
+ /**
+ * 用户标识,用户的唯一标识,做安全校验使用
+ */
+ private String openid;
+
+}
diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/CouponAvailableTime.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/CouponAvailableTime.java
new file mode 100644
index 0000000..ac5b7ae
--- /dev/null
+++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/CouponAvailableTime.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2019-2021 felord.cn
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ * Website:
+ * https://felord.cn
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.felord.payment.wechat.v3.model.busifavor;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.time.OffsetDateTime;
+import java.util.List;
+
+/**
+ * 商家券核销规则-券可核销时间
+ *
+ * @author felord.cn
+ * @since 1.0.4.RELEASE
+ */
+@Data
+public class CouponAvailableTime {
+
+ /**
+ * 领取后N天开始生效
+ *
+ * 日期区间内,用户领券后需等待x天开始生效。例如领券后当天开始生效则无需填写,领券后第2天开始生效填1,以此类推……
+ *
+ * 用户在有效期开始前领取商家券,则从有效期第1天开始计算天数,用户在有效期内领取商家券,则从领取当天开始计算天数。无论用户何时领取商家券,商家券在活动有效期结束后均不可用。
+ *
+ * 需配合{@link #availableDayAfterReceive} 一同填写,不可单独填写。
+ */
+ private int waitDaysAfterReceive;
+ /**
+ * 生效后N天内有效
+ *
+ * 日期区间内,券生效后x天内有效。例如生效当天内有效填1,生效后2天内有效填2,以此类推……
+ *
+ * 注意,用户在有效期开始前领取商家券,则从有效期第1天开始计算天数,用户在有效期内领取商家券,则从领取当天开始计算天数,无论用户何时领取商家券,商家券在活动有效期结束后均不可用。
+ *
+ * 可配合{@link #waitDaysAfterReceive}一同填写,也可单独填写。单独填写时,有效期内领券后立即生效,生效后x天内有效。
+ */
+ private int availableDayAfterReceive;
+ /**
+ * 批次开始时间 rfc 3339 yyyy-MM-ddTHH:mm:ss+TIMEZONE
+ */
+ @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ssXXX", timezone = "GMT+8")
+ private OffsetDateTime availableBeginTime;
+ /**
+ * 批次结束时间 rfc 3339 yyyy-MM-ddTHH:mm:ss+TIMEZONE
+ */
+ @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ssXXX", timezone = "GMT+8")
+ private OffsetDateTime availableEndTime;
+ /**
+ * 固定周期有效时间段
+ */
+ private AvailableWeek availableWeek;
+ /**
+ * 无规律的有效时间段
+ */
+ private List
+ * 卡详情页面,可选择多种入口引导用户。
+ *
+ * @author felord.cn
+ * @since 1.0.4.RELEASE
+ */
+@Data
+public class CustomEntrance {
+
+ /**
+ * 可用门店id
+ *
+ * 不可修改项
+ */
+ private String storeId;
+ /**
+ * 营销馆id
+ */
+ private String hallId;
+ /**
+ * 小程序入口
+ */
+ private MiniProgramsInfo miniProgramsInfo;
+ /**
+ * 商户公众号appid
+ *
+ * 从券详情可跳转至公众号
+ */
+ private String appid;
+ /**
+ * code展示模式
+ */
+ private BusiFavorCodeDisplayMode codeDisplayMode;
+
+}
\ No newline at end of file
diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/DiscountCoupon.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/DiscountCoupon.java
new file mode 100644
index 0000000..d17901d
--- /dev/null
+++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/DiscountCoupon.java
@@ -0,0 +1,25 @@
+package cn.felord.payment.wechat.v3.model.busifavor;
+
+import lombok.Data;
+
+/**
+ * 商家券核销规则-折扣券使用规则
+ *
+ * @author felord.cn
+ * @since 1.0.4.RELEASE
+ */
+@Data
+public class DiscountCoupon {
+
+ /**
+ * 折扣百分比,例如:88为八八折
+ */
+ private Integer discountPercent;
+ /**
+ * 消费门槛,单位:分。
+ *
+ * 特殊规则:取值范围 1 ≤ transactionMinimum ≤ 10000000
+ */
+ private Integer transactionMinimum;
+
+}
\ No newline at end of file
diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/DisplayPatternInfo.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/DisplayPatternInfo.java
new file mode 100644
index 0000000..a61759e
--- /dev/null
+++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/DisplayPatternInfo.java
@@ -0,0 +1,60 @@
+package cn.felord.payment.wechat.v3.model.busifavor;
+
+import cn.felord.payment.wechat.enumeration.CouponBgColor;
+import cn.felord.payment.wechat.v3.WechatMarketingFavorApi;
+import lombok.Data;
+import org.springframework.web.multipart.MultipartFile;
+
+/**
+ * 商家券样式信息.
+ *
+ * @author felord.cn
+ * @since 1.0.4.RELEASE
+ */
+@Data
+public class DisplayPatternInfo {
+
+ /**
+ * 背景颜色
+ */
+ private CouponBgColor backgroundColor;
+ /**
+ * 商户logo
+ *
+ *
+ * 仅支持通过 图片上传API 接口获取的图片URL地址。
+ *
+ * @see WechatMarketingFavorApi#marketingImageUpload(MultipartFile)
+ */
+ private String merchantLogoUrl;
+ /**
+ * 券详情图片
+ *
+ *
+ * 仅支持通过 图片上传API 接口获取的图片URL地址。
+ *
+ * @see WechatMarketingFavorApi#marketingImageUpload(MultipartFile)
+ */
+ private String couponImageUrl;
+ /**
+ * 使用须知
+ *
+ * 用于说明详细的活动规则,会展示在代金券详情页。
+ *
+ * 示例值:xxx门店可用
+ */
+ private String description;
+ /**
+ * 商户名称,字数上限为16个
+ */
+ private String merchantName;
+}
\ No newline at end of file
diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/ExchangeCoupon.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/ExchangeCoupon.java
new file mode 100644
index 0000000..390a6a6
--- /dev/null
+++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/ExchangeCoupon.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2019-2021 felord.cn
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ * Website:
+ * https://felord.cn
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.felord.payment.wechat.v3.model.busifavor;
+
+import lombok.Data;
+
+/**
+ * 商家券核销规则-换购券使用规则
+ *
+ * @author felord.cn
+ * @since 1.0.4.RELEASE
+ */
+@Data
+public class ExchangeCoupon {
+
+ /**
+ * 单品换购价,单位:分。
+ *
+ * 特殊规则:取值范围 1 ≤ exchangePrice ≤ 10000000
+ */
+ private Integer exchangePrice;
+ /**
+ * 消费门槛,单位:分。
+ *
+ * 特殊规则:取值范围 1 ≤ transactionMinimum ≤ 10000000
+ */
+ private Integer transactionMinimum;
+}
\ No newline at end of file
diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/FixedNormalCoupon.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/FixedNormalCoupon.java
new file mode 100644
index 0000000..c4e1643
--- /dev/null
+++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/FixedNormalCoupon.java
@@ -0,0 +1,26 @@
+package cn.felord.payment.wechat.v3.model.busifavor;
+
+import lombok.Data;
+
+/**
+ * 商家券核销规则-固定面额满减券使用规则
+ *
+ * @author felord.cn
+ * @since 1.0.4.RELEASE
+ */
+@Data
+public class FixedNormalCoupon {
+
+ /**
+ * 优惠金额,单位:分。
+ *
+ * 特殊规则:取值范围 1 ≤ transactionMinimum ≤ 10000000
+ */
+ private Integer discountAmount;
+ /**
+ * 消费门槛,单位:分。
+ *
+ * 特殊规则:取值范围 1 ≤ transactionMinimum ≤ 10000000
+ */
+ private Integer transactionMinimum;
+}
\ No newline at end of file
diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/IrregularyAvaliableTimeItem.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/IrregularyAvaliableTimeItem.java
new file mode 100644
index 0000000..2fe24f7
--- /dev/null
+++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/IrregularyAvaliableTimeItem.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2019-2021 felord.cn
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ * Website:
+ * https://felord.cn
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.felord.payment.wechat.v3.model.busifavor;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.time.OffsetDateTime;
+/**
+ * 商家券核销规则-券可核销时间-无规律的有效时间段
+ *
+ * @author felord.cn
+ * @since 1.0.4.RELEASE
+ */
+@Data
+public class IrregularyAvaliableTimeItem{
+
+ /**
+ * 开始时间
+ */
+ @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ssXXX", timezone = "GMT+8")
+ private OffsetDateTime beginTime;
+ /**
+ * 结束时间
+ */
+ @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ssXXX", timezone = "GMT+8")
+ private OffsetDateTime endTime;
+}
\ No newline at end of file
diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/MiniProgramsInfo.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/MiniProgramsInfo.java
new file mode 100644
index 0000000..0af2758
--- /dev/null
+++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/MiniProgramsInfo.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2019-2021 felord.cn
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ * Website:
+ * https://felord.cn
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.felord.payment.wechat.v3.model.busifavor;
+
+import lombok.Data;
+
+/**
+ * 商家券核销规则-自定义入口-小程序入口
+ *
+ * @author felord.cn
+ * @since 1.0.4.RELEASE
+ */
+@Data
+public class MiniProgramsInfo{
+
+ /**
+ * 商家小程序appid
+ *
+ * 商家小程序appid要与归属商户号有M-A or M-m-suba关系。
+ */
+ private String miniProgramsAppid;
+ /**
+ * 商家小程序path
+ */
+ private String miniProgramsPath;
+ /**
+ * 入口文案,字数上限为5个,一个中文汉字/英文字母/数字均占用一个字数。
+ */
+ private String guidingWords;
+ /**
+ * 小程序入口引导文案,用户自定义字段。字数上限为6个,一个中文汉字/英文字母/数字均占用一个字数。
+ */
+ private String entranceWords;
+}
\ No newline at end of file
diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/StockSendRule.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/StockSendRule.java
new file mode 100644
index 0000000..4fe3c76
--- /dev/null
+++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/StockSendRule.java
@@ -0,0 +1,51 @@
+package cn.felord.payment.wechat.v3.model.busifavor;
+
+import cn.felord.payment.wechat.enumeration.StockType;
+import lombok.Data;
+
+/**
+ * 商家券发放规则.
+ *
+ * @author felord.cn
+ * @since 1.0.4.RELEASE
+ */
+@Data
+public class StockSendRule {
+
+ /**
+ * 批次最大发放个数
+ *
+ * 特殊规则:取值范围 1 ≤ maxCoupons ≤ 1000000000
+ */
+ private Integer maxCoupons;
+ /**
+ * 用户最大可领个数
+ *
+ * 每个用户最多100张券 。
+ */
+ private Integer maxCouponsPerUser;
+ /**
+ * 单天发放上限个数
+ *
+ * {@link StockType#DISCOUNT}或者{@link StockType#DISCOUNT}时可传入此字段控制单天发放上限
+ *
+ * 特殊规则:取值范围 1 ≤ maxCouponsByDay ≤ 1000000000
+ */
+ private Integer maxCouponsByDay;
+ /**
+ * 是否开启自然人限制
+ */
+ private Boolean naturalPersonLimit;
+ /**
+ * 可疑账号拦截
+ */
+ private Boolean preventApiAbuse;
+ /**
+ * 是否允许转赠
+ */
+ private Boolean transferable;
+ /**
+ * 是否允许分享链接
+ */
+ private Boolean shareable;
+}
\ No newline at end of file
diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/UserBusiCouponQueryParams.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/UserBusiCouponQueryParams.java
new file mode 100644
index 0000000..50afdcb
--- /dev/null
+++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/UserBusiCouponQueryParams.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2019-2021 felord.cn
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ * Website:
+ * https://felord.cn
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.felord.payment.wechat.v3.model.busifavor;
+
+import lombok.Data;
+
+/**
+ * 查询用户单张券详情请求参数
+ *
+ * @author felord.cn
+ * @since 1.0.4.RELEASE
+ */
+@Data
+public class UserBusiCouponQueryParams {
+
+ /**
+ * 券code
+ */
+ private String couponCode;
+ /**
+ * 与当前调用接口商户号有绑定关系的appid。支持小程序appid与公众号appid。
+ */
+ private String appid;
+ /**
+ * Openid信息,用户在appid下的唯一标识。
+ */
+ private String openid;
+}
diff --git a/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/UserBusiFavorQueryParams.java b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/UserBusiFavorQueryParams.java
new file mode 100644
index 0000000..15cd15c
--- /dev/null
+++ b/payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/busifavor/UserBusiFavorQueryParams.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2019-2021 felord.cn
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ * Website:
+ * https://felord.cn
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.felord.payment.wechat.v3.model.busifavor;
+
+import cn.felord.payment.wechat.enumeration.CouponStatus;
+import lombok.Data;
+
+/**
+ * 根据过滤条件查询用户券API查询参数
+ *
+ * @author felord.cn
+ * @since 1.0.4.RELEASE
+ */
+@Data
+public class UserBusiFavorQueryParams {
+
+ /**
+ * 用户标识,用户在appid下的唯一标识。
+ */
+ private String openid;
+ /**
+ * 与当前调用接口商户号有绑定关系的appid。支持小程序appid与公众号appid。
+ */
+ private String appid;
+ /**
+ * 商户券批次号
+ */
+ private String stockId;
+ /**
+ * 券状态
+ */
+ private CouponStatus couponState;
+ /**
+ * 创建批次的商户号
+ */
+ private String creatorMerchant;
+ /**
+ * 批次归属商户号
+ */
+ private String belongMerchant;
+ /**
+ * 批次发放商户号
+ */
+ private String senderMerchant;
+ /**
+ * 分页页码
+ */
+ private String offset;
+ /**
+ * 分页大小
+ */
+ private String limit;
+}
+ *
+ *
+ * @param params the params
+ * @return callbacks callbacks
+ */
+ public WechatResponseEntity
+ *
+ *
+ * @param mchId the mch id
+ * @return callbacks callbacks
+ */
+ public WechatResponseEntity
+ *
+ *
+ *
+ *