This commit is contained in:
felord.cn
2020-12-13 11:06:53 +08:00
parent eab68846af
commit 721c895716
241 changed files with 2067 additions and 666 deletions

View File

@@ -1,8 +1,9 @@
package cn.felord.payment;
/**
* @author Dax
* @since 14:18
*
* @author felord.cn
* @since 1.0.0.RELEASE
*/
public class PayException extends RuntimeException {

View File

@@ -20,8 +20,9 @@ import java.io.FileReader;
import java.io.IOException;
/**
* @author Dax
* @since 14:35
*
* @author felord.cn
* @since 1.0.0.RELEASE
*/
@Slf4j
@Configuration

View File

@@ -7,8 +7,8 @@ import org.springframework.boot.context.properties.NestedConfigurationProperty;
/**
* The type Ali pay properties.
*
* @author Dax
* @since 14 :13
* @author felord.cn
* @since 1.0.0.RELEASE
*/
@Data
@ConfigurationProperties("ali.pay")
@@ -22,6 +22,9 @@ public class AliPayProperties {
/**
* The type V 1.
*
* @author felord.cn
* @since 1.0.0.RELEASE
*/
@Data
public static class V1{

View File

@@ -5,8 +5,9 @@ import org.springframework.context.annotation.Import;
import java.lang.annotation.*;
/**
* @author Dax
* @since 9:49
*
* @author felord.cn
* @since 1.0.0.RELEASE
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)

View File

@@ -6,8 +6,9 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
/**
* @author Dax
* @since 14:47
*
* @author felord.cn
* @since 1.0.0.RELEASE
*/
@Configuration
@Import({WechatPayConfiguration.class, AliPayConfiguration.class})

View File

@@ -11,10 +11,16 @@ import java.util.Map;
/**
* The type Wechat pay configuration.
*
* @author felord.cn
* @since 1.0.0.RELEASE
*/
@Configuration
@EnableConfigurationProperties(WechatPayProperties.class)
public class WechatPayConfiguration {
/**
* The constant CERT_ALIAS.
*/
private static final String CERT_ALIAS = "Tenpay Certificate";
/**

View File

@@ -2,13 +2,15 @@ package cn.felord.payment.wechat;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.NestedConfigurationProperty;
import java.util.HashMap;
import java.util.Map;
/**
* The type Wechat pay properties.
*
* @author felord.cn
* @since 1.0.0.RELEASE
*/
@Data
@ConfigurationProperties("wechat.pay")
@@ -20,6 +22,9 @@ public class WechatPayProperties {
/**
* wechat pay v3 properties.
*
* @author felord.cn
* @since 1.0.0.RELEASE
*/
@Data
public static class V3 {

View File

@@ -6,8 +6,9 @@ import org.springframework.web.client.DefaultResponseErrorHandler;
import java.io.IOException;
/**
* @author Dax
* @since 12:57
*
* @author felord.cn
* @since 1.0.0.RELEASE
*/
public class WechatPayResponseErrorHandler extends DefaultResponseErrorHandler {

View File

@@ -3,6 +3,9 @@ package cn.felord.payment.wechat.enumeration;
/**
* The enum Bank code.
*
* @author felord.cn
* @since 1.0.0.RELEASE
*/
public enum BankCode {
/**

View File

@@ -5,8 +5,8 @@ package cn.felord.payment.wechat.enumeration;
* <p>
* https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/marketing/convention/chapter3_1.shtml#menu1
*
* @author Dax
* @since 14:50
* @author felord.cn
* @since 1.0.0.RELEASE
*/
public enum CouponBgColor {
COLOR010("#63B359"),

View File

@@ -3,8 +3,8 @@ package cn.felord.payment.wechat.enumeration;
/**
* The enum Coupon status.
*
* @author Dax
* @since 10 :57
* @author felord.cn
* @since 1.0.0.RELEASE
*/
public enum CouponStatus {
/**

View File

@@ -3,8 +3,8 @@ package cn.felord.payment.wechat.enumeration;
/**
* The enum Stock status.
*
* @author Dax
* @since 15 :17
* @author felord.cn
* @since 1.0.0.RELEASE
*/
public enum StockStatus {
/**

View File

@@ -3,8 +3,8 @@ package cn.felord.payment.wechat.enumeration;
/**
* 微信侧返回交易状态
*
* @author Dax
* @since 11:37
* @author felord.cn
* @since 1.0.0.RELEASE
*/
public enum TradeState {
/**

View File

@@ -3,8 +3,8 @@ package cn.felord.payment.wechat.enumeration;
/**
* 微信侧返回交易类型
*
* @author Dax
* @since 11:34
* @author felord.cn
* @since 1.0.0.RELEASE
*/
public enum TradeType {
/**

View File

@@ -3,6 +3,9 @@ package cn.felord.payment.wechat.enumeration;
/**
* The enum We chat server domain.
*
* @author felord.cn
* @since 1.0.0.RELEASE
*/
public enum WeChatServer {
/**

View File

@@ -5,8 +5,8 @@ import org.springframework.http.HttpMethod;
/**
* The Wechat Pay V3 type.
*
* @author Dax
* @since 14 :25
* @author felord.cn
* @since 1.0.0.RELEASE
*/
public enum WechatPayV3Type {
/**

View File

@@ -15,12 +15,21 @@ import java.net.URI;
/**
* The type Abstract api.
*
* @author Dax
* @since 18 :23
* @author felord.cn
* @since 1.0.0.RELEASE
*/
public abstract class AbstractApi {
/**
* The Mapper.
*/
private final ObjectMapper mapper;
/**
* The Wechat pay client.
*/
private final WechatPayClient wechatPayClient;
/**
* The Tenant id.
*/
private final String tenantId;
@@ -41,6 +50,11 @@ public abstract class AbstractApi {
this.tenantId = tenantId;
}
/**
* Apply object mapper.
*
* @param mapper the mapper
*/
private void applyObjectMapper(ObjectMapper mapper) {
mapper.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE);
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);

View File

@@ -27,7 +27,9 @@ import java.util.Map;
/**
* 用于微信支付处理上传的自定义消息转换器.
*
* @author felord.cn
* @see AllEncompassingFormHttpMessageConverter
* @since 1.0.0.RELEASE
*/
final class ExtensionFormHttpMessageConverter extends FormHttpMessageConverter {
/**

View File

@@ -13,8 +13,8 @@ import java.security.cert.X509Certificate;
/**
* 证书工具
*
* @author dax
* @since 13:41
* @author felord.cn
* @since 1.0.0.RELEASE
**/
public class KeyPairFactory {

View File

@@ -44,8 +44,8 @@ import java.util.stream.Collectors;
* <p>
* 其中【微信平台证书】定期会进行更新,不受我方管控,我方需要适当的时候获取最新的证书列表。
*
* @author Dax
* @since 16 :48
* @author felord.cn
* @since 1.0.0.RELEASE
*/
public class SignatureProvider {

View File

@@ -3,8 +3,8 @@ package cn.felord.payment.wechat.v3;
/**
* 微信支付工具.
*
* @author Dax
* @since 17 :32
* @author felord.cn
* @since 1.0.0.RELEASE
*/
public class WechatApiProvider {
private final WechatPayClient wechatPayClient;

View File

@@ -16,8 +16,8 @@ import java.net.URI;
/**
* 普通支付-直连模式.
*
* @author Dax
* @since 16 :15
* @author felord.cn
* @since 1.0.0.RELEASE
*/
public class WechatDirectPayApi extends AbstractApi {

View File

@@ -30,12 +30,18 @@ import java.util.function.Consumer;
/**
* 微信支付营销代金券API
*
* @author Dax
* @since 18 :22
* @author felord.cn
* @since 1.0.0.RELEASE
*/
public class WechatMarketingFavorApi extends AbstractApi {
/**
* Instantiates a new Wechat marketing favor api.
*
* @param wechatPayClient the wechat pay client
* @param tenantId the tenant id
*/
public WechatMarketingFavorApi(WechatPayClient wechatPayClient, String tenantId) {
super(wechatPayClient, tenantId);
}
@@ -43,6 +49,8 @@ public class WechatMarketingFavorApi extends AbstractApi {
/**
* 创建代金券批次API
* <p>
* 通过调用此接口可创建代金券批次,包括 <strong>预充值</strong> 和 <strong>免充值</strong> 类型。
*
* @param params the params
* @return the wechat response entity
@@ -56,6 +64,13 @@ public class WechatMarketingFavorApi extends AbstractApi {
return wechatResponseEntity;
}
/**
* Create stocks function request entity.
*
* @param type the type
* @param params the params
* @return the request entity
*/
private RequestEntity<?> createStocksFunction(WechatPayV3Type type, StocksCreateParams params) {
WechatPayProperties.V3 v3 = this.wechatMetaBean().getV3();
@@ -69,6 +84,8 @@ public class WechatMarketingFavorApi extends AbstractApi {
/**
* 激活代金券批次API
* <p>
* 制券成功后,通过调用此接口激活批次,如果是预充值代金券,激活时会从商户账户余额中锁定本批次的营销资金。
*
* @param stockId the stock id
* @return the wechat response entity
@@ -85,6 +102,11 @@ public class WechatMarketingFavorApi extends AbstractApi {
/**
* 发放代金券API
* <p>
* 商户平台/API完成制券后可使用发放代金券接口发券。通过调用此接口可发放指定批次给指定用户发券场景可以是小程序、H5、APP等。
* <p>
* 注意:
* • 商户可在H5活动页面、商户小程序、商户APP等自有场景内调用该接口完成发券商户默认只允许发放本商户号调用发券接口的商户号创建的代金券如需发放其他商户商户创建的代金券请参考常见问题Q1。
*
* @param params the params
* @return the wechat response entity
@@ -99,6 +121,13 @@ public class WechatMarketingFavorApi extends AbstractApi {
}
/**
* Send stocks function request entity.
*
* @param type the type
* @param params the params
* @return the request entity
*/
private RequestEntity<?> sendStocksFunction(WechatPayV3Type type, StocksSendParams params) {
WechatPayProperties.V3 v3 = this.wechatMetaBean().getV3();
@@ -114,6 +143,8 @@ public class WechatMarketingFavorApi extends AbstractApi {
/**
* 暂停代金券批次API
* <p>
* 通过此接口可暂停指定代金券批次。暂停后,该代金券批次暂停发放,用户无法通过任何渠道再领取该批次的券。
*
* @param stockId the stock id
* @return the wechat response entity
@@ -129,6 +160,8 @@ public class WechatMarketingFavorApi extends AbstractApi {
/**
* 重启代金券批次API
* <p>
* 通过此接口可重启指定代金券批次。重启后,该代金券批次可以再次发放。
*
* @param stockId the stock id
* @return the wechat response entity
@@ -142,6 +175,13 @@ public class WechatMarketingFavorApi extends AbstractApi {
return wechatResponseEntity;
}
/**
* Start and restart and pause stock function request entity.
*
* @param type the type
* @param stockId the stock id
* @return the request entity
*/
private RequestEntity<?> startAndRestartAndPauseStockFunction(WechatPayV3Type type, String stockId) {
WechatPayProperties.V3 v3 = this.wechatMetaBean().getV3();
String mchId = v3.getMchId();
@@ -157,6 +197,8 @@ public class WechatMarketingFavorApi extends AbstractApi {
/**
* 条件查询批次列表API
* <p>
* 通过此接口可查询多个批次的信息,包括批次的配置信息以及批次概况数据。
*
* @param params the params
* @return the wechat response entity
@@ -172,6 +214,13 @@ public class WechatMarketingFavorApi extends AbstractApi {
}
/**
* Query stocks function request entity.
*
* @param type the type
* @param params the params
* @return the request entity
*/
private RequestEntity<?> queryStocksFunction(WechatPayV3Type type, StocksQueryParams params) {
MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>();
@@ -213,6 +262,8 @@ public class WechatMarketingFavorApi extends AbstractApi {
/**
* 查询批次详情API
* <p>
* 通过此接口可查询批次信息,包括批次的配置信息以及批次概况数据。
*
* @param stockId the stock id
* @return the wechat response entity
@@ -227,6 +278,13 @@ public class WechatMarketingFavorApi extends AbstractApi {
}
/**
* Stock detail function request entity.
*
* @param type the type
* @param stockId the stock id
* @return the request entity
*/
private RequestEntity<?> stockDetailFunction(WechatPayV3Type type, String stockId) {
WechatPayProperties.V3 v3 = this.wechatMetaBean().getV3();
@@ -244,6 +302,8 @@ public class WechatMarketingFavorApi extends AbstractApi {
/**
* 查询代金券详情API
* <p>
* 通过此接口可查询代金券信息,包括代金券的基础信息、状态。如代金券已核销,会包括代金券核销的订单信息(订单号、单品信息等)。
*
* @param params the params
* @return the wechat response entity
@@ -258,6 +318,13 @@ public class WechatMarketingFavorApi extends AbstractApi {
}
/**
* Coupon detail function request entity.
*
* @param type the type
* @param params the params
* @return the request entity
*/
private RequestEntity<?> couponDetailFunction(WechatPayV3Type type, CouponDetailsQueryParams params) {
WechatPayProperties.V3 v3 = this.wechatMetaBean().getV3();
@@ -279,6 +346,8 @@ public class WechatMarketingFavorApi extends AbstractApi {
/**
* 查询代金券可用商户API
* <p>
* 通过调用此接口可查询批次的可用商户号,判断券是否在某商户号可用,来决定是否展示。
*
* @param params the params
* @return the wechat response entity
@@ -294,6 +363,8 @@ public class WechatMarketingFavorApi extends AbstractApi {
/**
* 查询代金券可用单品API
* <p>
* 通过此接口可查询批次的可用商品编码,判断券是否可用于某些商品,来决定是否展示。
*
* @param params the params
* @return the wechat response entity
@@ -310,6 +381,8 @@ public class WechatMarketingFavorApi extends AbstractApi {
/**
* 根据商户号查用户的券API
* <p>
* 可通过该接口查询用户在某商户号可用的全部券,可用于商户的小程序/H5中用户"我的代金券"或"提交订单页"展示优惠信息。无法查询到微信支付立减金。本接口查不到用户的微信支付立减金(又称“全平台通用券”),即在所有商户都可以使用的券,例如:摇摇乐红包;当按可用商户号查询时,无法查询用户已经核销的券
*
* @param params the params
* @return the wechat response entity
@@ -324,6 +397,13 @@ public class WechatMarketingFavorApi extends AbstractApi {
return wechatResponseEntity;
}
/**
* Query user coupons function request entity.
*
* @param type the type
* @param params the params
* @return the request entity
*/
private RequestEntity<?> queryUserCouponsFunction(WechatPayV3Type type, UserCouponsQueryParams params) {
WechatPayProperties.V3 v3 = this.wechatMetaBean().getV3();
@@ -363,6 +443,10 @@ public class WechatMarketingFavorApi extends AbstractApi {
/**
* 下载批次核销明细API
* <p>
* 数据结果包含在响应体的 <strong>csv</strong> 字段中
* <p>
* 可获取到某批次的核销明细数据,包括订单号、单品信息、银行流水号等,用于对账/数据分析。
*
* @param stockId the stock id
* @return the wechat response entity
@@ -380,6 +464,10 @@ public class WechatMarketingFavorApi extends AbstractApi {
/**
* 下载批次退款明细API
* <p>
* 数据结果包含在响应体的 <strong>csv</strong> 字段中
* <p>
* 可获取到某批次的退款明细数据,包括订单号、单品信息、银行流水号等,用于对账/数据分析。
*
* @param stockId the stock id
* @return the wechat response entity
@@ -395,6 +483,13 @@ public class WechatMarketingFavorApi extends AbstractApi {
return wechatResponseEntity;
}
/**
* Download flow function request entity.
*
* @param type the type
* @param stockId the stock id
* @return the request entity
*/
private RequestEntity<?> downloadFlowFunction(WechatPayV3Type type, String stockId) {
URI uri = UriComponentsBuilder.fromHttpUrl(type.uri(WeChatServer.CHINA))
.build()
@@ -405,6 +500,10 @@ public class WechatMarketingFavorApi extends AbstractApi {
/**
* 营销图片上传API
* <p>
* 媒体图片只支持JPG、BMP、PNG格式文件大小不能超过2M。
* <p>
* 通过本接口上传图片后可获得图片url地址。图片url可在微信支付营销相关的API使用包括商家券、代金券、支付有礼等。
*
* @param file the file
* @return the wechat response entity
@@ -419,6 +518,13 @@ public class WechatMarketingFavorApi extends AbstractApi {
}
/**
* Marketing image upload function request entity.
*
* @param type the type
* @param file the file
* @return the request entity
*/
@SneakyThrows
private RequestEntity<?> marketingImageUploadFunction(WechatPayV3Type type, MultipartFile file) {
@@ -445,11 +551,13 @@ public class WechatMarketingFavorApi extends AbstractApi {
}
/**
* 代金券核销回调通知API
* 代金券核销回调通知API
* <p>
* 设置核销回调通知的{@code notifyUrl},{@code notifyUrl}需要设置应用白名单。开发者应该对代金券的核销结果进行流水记录。
*
* @param notifyUrl the notify url
* @return the wechat response entity
* @see WechatPayCallback#couponCallback(ResponseSignVerifyParams, Consumer)
* @see WechatPayCallback#couponCallback(ResponseSignVerifyParams, Consumer) WechatPayCallback#couponCallback(ResponseSignVerifyParams, Consumer)WechatPayCallback#couponCallback(ResponseSignVerifyParams, Consumer)
*/
public WechatResponseEntity<ObjectNode> setMarketingFavorCallback(String notifyUrl) {
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
@@ -460,6 +568,13 @@ public class WechatMarketingFavorApi extends AbstractApi {
return wechatResponseEntity;
}
/**
* Sets marketing favor callback function.
*
* @param type the type
* @param notifyUrl the notify url
* @return the marketing favor callback function
*/
private RequestEntity<?> setMarketingFavorCallbackFunction(WechatPayV3Type type, String notifyUrl) {
WechatPayProperties.V3 v3 = this.wechatMetaBean().getV3();
@@ -473,6 +588,14 @@ public class WechatMarketingFavorApi extends AbstractApi {
return Post(uri, body);
}
/**
* csv对账单下载。
*
* @param link the link
* @return the string
* @see WechatMarketingFavorApi#downloadStockUseFlow(String) 下载批次核销明细API
* @see WechatMarketingFavorApi#downloadStockRefundFlow(String) 下载批次退款明细API
*/
public String billDownload(String link) {
return this.client().withType(WechatPayV3Type.FILE_DOWNLOAD, link)
.function(this::billDownloadFunction)
@@ -480,6 +603,13 @@ public class WechatMarketingFavorApi extends AbstractApi {
}
/**
* Bill download function request entity.
*
* @param type the type
* @param link the link
* @return the request entity
*/
private RequestEntity<?> billDownloadFunction(WechatPayV3Type type, String link) {
URI uri = UriComponentsBuilder.fromHttpUrl(link)
.build()

View File

@@ -9,8 +9,8 @@ import java.security.KeyPair;
/**
* 微信支付元数据Bean.
*
* @author Dax
* @since 15 :50
* @author felord.cn
* @since 1.0.0.RELEASE
*/
@Data
public class WechatMetaBean {

View File

@@ -6,8 +6,8 @@ import java.util.*;
/**
* 配置容器
*
* @author Dax
* @since 15 :18
* @author felord.cn
* @since 1.0.0.RELEASE
*/
public class WechatMetaContainer {
private final Map<String, WechatMetaBean> wechatMetaBeanMap = new HashMap<>();

View File

@@ -21,8 +21,8 @@ import java.util.function.Consumer;
/**
* 微信支付回调工具.
*
* @author Dax
* @since 10 :21
* @author felord.cn
* @since 1.0.0.RELEASE
*/
@Slf4j
public class WechatPayCallback {
@@ -108,6 +108,9 @@ public class WechatPayCallback {
/**
* 事件类型用于处理回调.
*
* @author felord.cn
* @since 1.0.0.RELEASE
*/
enum EventType {
/**

View File

@@ -25,8 +25,8 @@ import java.util.function.Consumer;
/**
* The type Wechat pay client.
*
* @author Dax
* @since 11 :43
* @author felord.cn
* @since 1.0.0.RELEASE
*/
public class WechatPayClient {
/**
@@ -66,6 +66,8 @@ public class WechatPayClient {
* The type Executor.
*
* @param <M> the type parameter
* @author felord.cn
* @since 1.0.0.RELEASE
*/
public static class Executor<M> {
/**

View File

@@ -16,12 +16,15 @@ import java.util.function.Consumer;
* The type Wechat request entity.
*
* @param <T> the type parameter
* @author Dax
* @since 14 :01
* @author felord.cn
* @since 1.0.0.RELEASE
*/
@Getter
public class WechatRequestEntity<T> extends RequestEntity<T> {
/**
* The Response body consumer.
*/
private final Consumer<ResponseEntity<ObjectNode>> responseBodyConsumer;
/**

View File

@@ -11,13 +11,19 @@ import java.util.Objects;
* The type Wechat response entity.
*
* @param <T> the type parameter
* @author Dax
* @since 13 :20
* @author felord.cn
* @since 1.0.0.RELEASE
*/
@Slf4j
@Data
public class WechatResponseEntity<T> {
/**
* The Http status.
*/
private int httpStatus;
/**
* The Body.
*/
private T body;

View File

@@ -4,11 +4,18 @@ import lombok.Data;
/**
* 支付金额 货币单位【分】默认使用人民币标识CNY
* @author Dax
* @since 16:45
*
* @author felord.cn
* @since 1.0.0.RELEASE
*/
@Data
public class Amount {
/**
* The Total.
*/
private int total;
/**
* The Currency.
*/
private String currency ="CNY";
}

View File

@@ -3,25 +3,63 @@ package cn.felord.payment.wechat.v3.model;
import lombok.Data;
/**
* @author Dax
* @since 10:13
* 微信支付回调请求参数.
*
* @author felord.cn
* @since 1.0.0.RELEASE
*/
@Data
public class CallbackParams {
/**
* The Id.
*/
private String id;
/**
* The Create time.
*/
private String createTime;
/**
* The Event type.
*/
private String eventType;
/**
* The Resource type.
*/
private String resourceType;
/**
* The Summary.
*/
private String summary;
/**
* The Resource.
*/
private Resource resource;
/**
* The type Resource.
*/
@Data
public static class Resource {
/**
* The Algorithm.
*/
private String algorithm;
/**
* The Ciphertext.
*/
private String ciphertext;
/**
* The Associated data.
*/
private String associatedData;
/**
* The Nonce.
*/
private String nonce;
/**
* The Original type.
*/
private String originalType;
}

View File

@@ -7,6 +7,9 @@ import java.util.List;
/**
* 已实扣代金券信息
*
* @author felord.cn
* @since 1.0.0.RELEASE
*/
@Data
public class ConsumeInformation {

View File

@@ -3,9 +3,23 @@ package cn.felord.payment.wechat.v3.model;
import lombok.Data;
/**
*
* @author felord.cn
* @since 1.0.0.RELEASE
*/
@Data
public class CouponAvailableTime {
/**
* The Available time after receive.
*/
private Long availableTimeAfterReceive;
/**
* The Fix available time.
*/
private FixAvailableTime fixAvailableTime;
/**
* The Second day available.
*/
private Boolean secondDayAvailable;
}

View File

@@ -5,6 +5,9 @@ import lombok.Data;
/**
* 微信代金券核销通知参数
*
* @author felord.cn
* @since 1.0.0.RELEASE
*/
@Data
public class CouponConsumeData {

View File

@@ -5,8 +5,8 @@ import lombok.Data;
/**
* 查询代金券详情API参数
*
* @author Dax
* @since 18 :51
* @author felord.cn
* @since 1.0.0.RELEASE
*/
@Data
public class CouponDetailsQueryParams {

View File

@@ -7,6 +7,9 @@ import java.util.List;
/**
* 核销规则.
*
* @author felord.cn
* @since 1.0.0.RELEASE
*/
@Data
public class CouponUseRule {

View File

@@ -5,8 +5,9 @@ import lombok.Data;
import java.util.List;
/**
* @author Dax
* @since 17:01
*
* @author felord.cn
* @since 1.0.0.RELEASE
*/
@Data
public class Detail {

View File

@@ -5,6 +5,9 @@ import lombok.Data;
/**
* 减至优惠限定字段,仅减至优惠场景有返回
*
* @author felord.cn
* @since 1.0.0.RELEASE
*/
@Data
public class DiscountTo {

View File

@@ -5,11 +5,26 @@ import lombok.Data;
import java.util.List;
/**
* The type Fix available time.
*
* @author felord.cn
* @since 1.0.0.RELEASE
*/
@Data
public class FixAvailableTime {
/**
* The Available week day.
*/
private List<Long> availableWeekDay;
/**
* The Begin time.
*/
private Long beginTime;
/**
* The End time.
*/
private Long endTime;
}

View File

@@ -9,6 +9,8 @@ import lombok.Data;
*
* 满transactionMinimum 减少 couponAmount
*
* @author felord.cn
* @since 1.0.0.RELEASE
*/
@Data
public class FixedNormalCoupon {

View File

@@ -3,8 +3,9 @@ package cn.felord.payment.wechat.v3.model;
import lombok.Data;
/**
* @author Dax
* @since 17:02
*
* @author felord.cn
* @since 1.0.0.RELEASE
*/
@Data
public class Goods {

View File

@@ -5,6 +5,9 @@ import lombok.Data;
/**
* 商户下单接口传的单品信息
*
* @author felord.cn
* @since 1.0.0.RELEASE
*/
@Data
public class GoodsDetail {

View File

@@ -3,8 +3,9 @@ package cn.felord.payment.wechat.v3.model;
import lombok.Data;
/**
* @author Dax
* @since 17:03
*
* @author felord.cn
* @since 1.0.0.RELEASE
*/
@Data
public class H5Info {

View File

@@ -5,6 +5,9 @@ import lombok.Data;
/**
* 普通满减券面额、门槛信息
*
* @author felord.cn
* @since 1.0.0.RELEASE
*/
@Data
public class NormalCouponInformation {

View File

@@ -7,8 +7,9 @@ import lombok.Data;
/**
* 优惠券样式
*
* @author Dax
* @since 15:09
*
* @author felord.cn
* @since 1.0.0.RELEASE
*/
@Data
public class PatternInfo {

View File

@@ -4,10 +4,10 @@ package cn.felord.payment.wechat.v3.model;
import lombok.Data;
/**
* The type App pay model.
* 支付请求参数.
*
* @author Dax
* @since 17 :10
* @author felord.cn
* @since 1.0.0.RELEASE
*/
@Data
public class PayParams {

View File

@@ -3,8 +3,9 @@ package cn.felord.payment.wechat.v3.model;
import lombok.Data;
/**
* @author Dax
* @since 17:04
*
* @author felord.cn
* @since 1.0.0.RELEASE
*/
@Data
public class Payer {

View File

@@ -5,27 +5,87 @@ import lombok.Data;
import java.util.List;
/**
* The type Promotion detail.
*
* @author felord.cn
* @since 1.0.0.RELEASE
*/
public class PromotionDetail {
/**
* The Amount.
*/
private Long amount;
/**
* The Coupon id.
*/
private String couponId;
/**
* The Currency.
*/
private String currency;
/**
* The Goods detail.
*/
private List<GoodsDetail> goodsDetail;
/**
* The Merchant contribute.
*/
private Long merchantContribute;
/**
* The Name.
*/
private String name;
/**
* The Other contribute.
*/
private Long otherContribute;
/**
* The Scope.
*/
private String scope;
/**
* The Stock id.
*/
private String stockId;
/**
* The Type.
*/
private String type;
/**
* The Wechatpay contribute.
*/
private Long wechatpayContribute;
/**
* The type Goods detail.
*
* @author felord.cn
* @since 1.0.0.RELEASE
*/
@Data
public static class GoodsDetail {
/**
* The Goods id.
*/
private String goodsId;
/**
* The Quantity.
*/
private Long quantity;
/**
* The Unit price.
*/
private Long unitPrice;
/**
* The Discount amount.
*/
private Long discountAmount;
/**
* The Goods remark.
*/
private String goodsRemark;
}

View File

@@ -6,9 +6,9 @@ import lombok.Data;
/**
* 微信的响应签名校验参数
*
* @author Dax
* @see SignatureProvider#responseSignVerify(ResponseSignVerifyParams)
* @since 16:32
* @author felord.cn
* @see SignatureProvider#responseSignVerify(ResponseSignVerifyParams) SignatureProvider#responseSignVerify(ResponseSignVerifyParams)SignatureProvider#responseSignVerify(ResponseSignVerifyParams)
* @since 1.0.0.RELEASE
*/
@Data
public class ResponseSignVerifyParams {

View File

@@ -3,8 +3,10 @@ package cn.felord.payment.wechat.v3.model;
import lombok.Data;
/**
* @author Dax
* @since 17:05
* 场景信息
*
* @author felord.cn
* @since 1.0.0.RELEASE
*/
@Data
public class SceneInfo {

View File

@@ -3,8 +3,9 @@ package cn.felord.payment.wechat.v3.model;
import lombok.Data;
/**
* @author Dax
* @since 17:05
*
* @author felord.cn
* @since 1.0.0.RELEASE
*/
@Data
public class SettleInfo {

View File

@@ -5,6 +5,9 @@ import lombok.Data;
/**
* 单品优惠特定信息
*
* @author felord.cn
* @since 1.0.0.RELEASE
*/
@Data
public class SingleitemDiscountOff {

View File

@@ -5,8 +5,8 @@ import lombok.Data;
/**
* 批次使用规则
*
* @author Dax
* @since 15:08
* @author felord.cn
* @since 1.0.0.RELEASE
*/
@Data
public class StockUseRule {

View File

@@ -8,8 +8,8 @@ import java.time.OffsetDateTime;
/**
* 创建优惠券批次参数.
*
* @author Dax
* @since 14 :19
* @author felord.cn
* @since 1.0.0.RELEASE
*/
@Data
public class StocksCreateParams {
@@ -36,7 +36,11 @@ public class StocksCreateParams {
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX", timezone = "GMT+8")
private OffsetDateTime availableEndTime;
/**
* 是否无资金流
* 可创建代金券的类型包含预充值和免充值两种类型。此字段用来标识制券 <strong>是否无资金流</strong>
* <p>
* ● 预充值代金券适用于第三方出资策划的活动例如满100减10. 指订单金额100元用户实付90元商户实收100元。设置为{@link Boolean#FALSE}
* <p>
* ● 免充值适用于商户策划的活动例如满100减10。 指订单金额100元用户实付90元用户领券后在支付中直接核销10元商户实收90元。设置为{@link Boolean#TRUE}
*/
private Boolean noCash;
/**

View File

@@ -11,8 +11,8 @@ import java.time.OffsetDateTime;
* <p>
* 条件查询批次列表API、查询代金券可用商户API、查询代金券可用单品API
*
* @author Dax
* @since 15 :16
* @author felord.cn
* @since 1.0.0.RELEASE
*/
@Data
public class StocksQueryParams {

View File

@@ -2,6 +2,12 @@ package cn.felord.payment.wechat.v3.model;
import lombok.Data;
/**
* 代金券发放接口请求参数
*
* @author felord.cn
* @since 1.0.0.RELEASE
*/
@Data
public class StocksSendParams {
/**
@@ -25,11 +31,13 @@ public class StocksSendParams {
*/
private String stockCreatorMchid;
/**
* 指定面额发券,面额
* 指定面额发券场景,券面额,其他场景不需要填,单位:分。
* 校验规则:仅在发券时指定面额及门槛的场景才生效,常规发券场景请勿传入该信息。
*/
private String couponValue;
private Long couponValue;
/**
* 指定面额发券,券门槛
* 指定面额发券批次门槛,其他场景不需要,单位:分。
* 校验规则:仅在发券时指定面额及门槛的场景才生效,常规发券场景请勿传入该信息。
*/
private String couponMinimum;
private Long couponMinimum;
}

View File

@@ -3,8 +3,9 @@ package cn.felord.payment.wechat.v3.model;
import lombok.Data;
/**
* @author Dax
* @since 17:06
*
* @author felord.cn
* @since 1.0.0.RELEASE
*/
@Data
public class StoreInfo {

View File

@@ -5,40 +5,123 @@ import lombok.Data;
import java.util.List;
/**
*
* @author felord.cn
* @since 1.0.0.RELEASE
*/
@Data
public class TransactionConsumeData {
/**
* The Amount.
*/
private Amount amount;
/**
* The Appid.
*/
private String appid;
/**
* The Attach.
*/
private String attach;
/**
* The Bank type.
*/
private String bankType;
/**
* The Mchid.
*/
private String mchid;
/**
* The Out trade no.
*/
private String outTradeNo;
/**
* The Payer.
*/
private Payer payer;
/**
* The Promotion detail.
*/
private List<PromotionDetail> promotionDetail;
/**
* The Scene info.
*/
private SceneInfo sceneInfo;
/**
* The Success time.
*/
private String successTime;
/**
* The Trade state.
*/
private String tradeState;
/**
* The Trade state desc.
*/
private String tradeStateDesc;
/**
* The Trade type.
*/
private String tradeType;
/**
* The Transaction id.
*/
private String transactionId;
/**
* The type Payer.
*
* @author felord.cn
* @since 1.0.0.RELEASE
*/
@Data
public static class Payer {
/**
* The Openid.
*/
private String openid;
}
/**
* The type Scene info.
*
* @author felord.cn
* @since 1.0.0.RELEASE
*/
@Data
public static class SceneInfo {
/**
* The Device id.
*/
private String deviceId;
}
/**
* The type Amount.
*
* @author felord.cn
* @since 1.0.0.RELEASE
*/
@Data
public static class Amount {
/**
* The Total.
*/
private int total;
/**
* The Payer total.
*/
private int payerTotal;
/**
* The Currency.
*/
private String currency;
/**
* The Payer currency.
*/
private String payerCurrency;
}

View File

@@ -3,8 +3,9 @@ package cn.felord.payment.wechat.v3.model;
import lombok.Data;
/**
* @author Dax
* @since 17:42
*
* @author felord.cn
* @since 1.0.0.RELEASE
*/
@Data
public class TransactionQueryParams {

View File

@@ -3,8 +3,10 @@ package cn.felord.payment.wechat.v3.model;
import lombok.Data;
/**
* @author Dax
* @since 19:19
* The type User coupons query params.
*
* @author felord.cn
* @since 1.0.0.RELEASE
*/
@Data
public class UserCouponsQueryParams {
@@ -46,8 +48,20 @@ public class UserCouponsQueryParams {
private Integer limit = 20;
public enum Status{
/**
* The enum Status.
*
* @author felord.cn
* @since 1.0.0.RELEASE
*/
public enum Status{
/**
* Sended status.
*/
SENDED,
/**
* Used status.
*/
USED
}