12 Commits

Author SHA1 Message Date
felord.cn
abc0033792 Merge pull request #1 from NotFound403/1.0.3.SNAPSHOT
1.0.3.release
2021-01-07 21:19:57 +08:00
felord.cn
b7e1a496bb Merge branch 'release' into 1.0.3.SNAPSHOT 2021-01-07 21:19:11 +08:00
felord.cn
60a47fa5bc README.md 2021-01-07 21:10:23 +08:00
felord.cn
282836d036 changelog 2021-01-07 21:08:49 +08:00
felord.cn
f1a3683bc6 fix: 微信支付能够正确根据环境条件动态启用了,修复了不配置微信支付时,无法启用支付宝的问题。
1. 当配置中存在`wechat.pay.v3`配置时,微信支付启用;否则微信支付不启用,不会影响支付宝的运行。
2021-01-07 21:07:48 +08:00
felord.cn
b291dbfa44 refactor: 下载交易账单API和下载资金账单现在是公共接口 2021-01-05 21:21:02 +08:00
felord.cn
9e712fa6b9 feat:
doc
2021-01-04 17:33:38 +08:00
felord.cn
08f3ee6e0b feat:
1.合单支付-申请交易账单API
2.合单支付-申请资金账单API
2021-01-04 15:27:39 +08:00
felord.cn
fc997d3a9f Merge remote-tracking branch 'github/1.0.3.SNAPSHOT' into 1.0.3.SNAPSHOT 2021-01-04 09:45:29 +08:00
dax
f2c66bef10 fix: #I2BCMZ 合单支付url不正确的问题 2021-01-04 09:45:11 +08:00
dax
e8737adbbf refactor: 先享卡回调优化 2020-12-28 16:54:01 +08:00
dax
c101cdd857 refactor: 先享卡优化 2020-12-28 15:41:29 +08:00
33 changed files with 734 additions and 197 deletions

View File

@@ -2,13 +2,16 @@
为了满足业务中出现app支付、公众号支付、小程序支付等多appid并存的场景对原有的进行了增强开发出了多租户版本。 为了满足业务中出现app支付、公众号支付、小程序支付等多appid并存的场景对原有的进行了增强开发出了多租户版本。
请给[Payment Spring Boot](https://github.com/NotFound403/payment-spring-boot) **Star**以鼓励,谢谢。
## Maven 最新中央仓库坐标 ## Maven 最新中央仓库坐标
```xml ```xml
<dependency> <dependency>
<groupId>cn.felord</groupId> <groupId>cn.felord</groupId>
<artifactId>payment-spring-boot-starter</artifactId> <artifactId>payment-spring-boot-starter</artifactId>
<version>1.0.2.RELEASE</version> <version>1.0.3.RELEASE</version>
</dependency> </dependency>
``` ```

View File

@@ -24,11 +24,12 @@
- 微信合单支付 `WechatCombinePayApi` 100% - 微信合单支付 `WechatCombinePayApi` 100%
## Maven 中央仓库坐标 ## Maven 中央仓库坐标
> 推荐使用最新版本
```xml ```xml
<dependency> <dependency>
<groupId>cn.felord</groupId> <groupId>cn.felord</groupId>
<artifactId>payment-spring-boot-starter</artifactId> <artifactId>payment-spring-boot-starter</artifactId>
<version>1.0.1.RELEASE</version> <version>1.0.3.RELEASE</version>
</dependency> </dependency>
``` ```
## 采用技术 ## 采用技术

View File

@@ -1,3 +1,19 @@
## 1.0.3.RELEASE
- 微信支付
- feat: 完善合单支付账单
1. 增加合单支付-申请交易账单API。
2. 增加合单支付-申请资金账单API。
- fix: #I2BCMZ 合单支付url不正确的问题。
- fix: 微信支付能够正确根据环境条件动态启用了,修复了不配置微信支付时,无法启用支付宝的问题。
1. 当配置中存在`wechat.pay.v3`配置时,微信支付启用;否则微信支付不启用,不会再影响支付宝的运行。
- refactor: 先享卡优化
## 1.0.2.RELEASE
- 微信支付
- feat: 接入微信支付分
- feat: 接入微信支付先享卡
- fix: 支付回调参数不全的问题
## 1.0.1.RELEASE ## 1.0.1.RELEASE
- 微信支付 - 微信支付

View File

@@ -4,7 +4,7 @@
<dependency> <dependency>
<groupId>cn.felord</groupId> <groupId>cn.felord</groupId>
<artifactId>payment-spring-boot-starter</artifactId> <artifactId>payment-spring-boot-starter</artifactId>
<version>1.0.1.RELEASE</version> <version>1.0.3.RELEASE</version>
</dependency> </dependency>
``` ```
> 基于 **Spring Boot 2.4.1** > 基于 **Spring Boot 2.4.1**

View File

@@ -35,7 +35,7 @@
## 支付宝 ## 支付宝
### 证书 ### 支付宝证书
请注意因为未来**SHA1withRSA**将被淘汰,因此采用最新的**SHA256withRSA**证书,旧的模式将不提供支持。步骤如下: 请注意因为未来**SHA1withRSA**将被淘汰,因此采用最新的**SHA256withRSA**证书,旧的模式将不提供支持。步骤如下:

View File

@@ -5,11 +5,11 @@
<parent> <parent>
<groupId>cn.felord</groupId> <groupId>cn.felord</groupId>
<artifactId>payment-spring-boot</artifactId> <artifactId>payment-spring-boot</artifactId>
<version>1.0.2.RELEASE</version> <version>1.0.3.RELEASE</version>
</parent> </parent>
<artifactId>payment-spring-boot-autoconfigure</artifactId> <artifactId>payment-spring-boot-autoconfigure</artifactId>
<version>1.0.2.RELEASE</version> <version>1.0.3.RELEASE</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -23,6 +23,7 @@ import cn.felord.payment.wechat.v3.*;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import java.util.Map; import java.util.Map;
@@ -34,6 +35,7 @@ import java.util.Map;
* @since 1.0.0.RELEASE * @since 1.0.0.RELEASE
*/ */
@Configuration @Configuration
@Conditional(WechatPayConfiguredCondition.class)
@EnableConfigurationProperties(WechatPayProperties.class) @EnableConfigurationProperties(WechatPayProperties.class)
public class WechatPayConfiguration { public class WechatPayConfiguration {
/** /**

View File

@@ -0,0 +1,64 @@
/*
*
* 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;
import org.springframework.boot.autoconfigure.condition.ConditionMessage;
import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
import org.springframework.boot.autoconfigure.condition.SpringBootCondition;
import org.springframework.boot.context.properties.bind.Bindable;
import org.springframework.boot.context.properties.bind.Binder;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.env.Environment;
import org.springframework.core.type.AnnotatedTypeMetadata;
import java.util.Collections;
import java.util.Map;
import java.util.stream.Collectors;
/**
* The type Wechat pay configured condition.
*
* @author felord.cn
* @since 1.0.3.RELEASE
*/
public class WechatPayConfiguredCondition extends SpringBootCondition {
/**
* The constant STRING_WECHAT_V3_MAP.
*/
private static final Bindable<Map<String, WechatPayProperties.V3>> STRING_WECHAT_V3_MAP = Bindable
.mapOf(String.class, WechatPayProperties.V3.class);
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {
ConditionMessage.Builder message = ConditionMessage.forCondition("Wechat Pay V3 Configured Condition");
Map<String, WechatPayProperties.V3> v3 = getV3(context.getEnvironment());
if (!v3.isEmpty()) {
return ConditionOutcome.match(message.foundExactly("registered wechat mchIds " + v3.values().stream()
.map(WechatPayProperties.V3::getMchId).collect(Collectors.joining(", "))));
}
return ConditionOutcome.noMatch(message.notAvailable("registered wechat pay configs"));
}
private Map<String, WechatPayProperties.V3> getV3(Environment environment) {
return Binder.get(environment).bind("wechat.pay.v3", STRING_WECHAT_V3_MAP)
.orElse(Collections.emptyMap());
}
}

View File

@@ -1,3 +1,20 @@
/*
*
* Copyright 2019-2020 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; package cn.felord.payment.wechat.enumeration;
/** /**

View File

@@ -0,0 +1,35 @@
/*
*
* Copyright 2019-2020 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.3.RELEASE
*/
public enum CountType {
/**
* 不限数量
*/
COUNT_UNLIMITED,
/**
* 有限数量
*/
COUNT_LIMIT
}

View File

@@ -20,7 +20,7 @@ package cn.felord.payment.wechat.enumeration;
/** /**
* 优惠券背景色 * 优惠券背景色
* <p> * <p>
* https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/marketing/convention/chapter3_1.shtml#menu1 * 详见<a target= "_blank" href= "https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/marketing/convention/chapter3_1.shtml#menu1">优惠券背景色参考</a>
* *
* @author felord.cn * @author felord.cn
* @since 1.0.0.RELEASE * @since 1.0.0.RELEASE

View File

@@ -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;
/**
* 申请资金账单账户类型.
*
* @since 1.0.3.RELEASE
*/
public enum FundFlowAccountType {
/**
* 基本账户
*/
BASIC,
/**
* 运营账户
*/
OPERATION,
/**
* 手续费账户
*/
FEES
}

View File

@@ -1,3 +1,20 @@
/*
*
* Copyright 2019-2020 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; package cn.felord.payment.wechat.enumeration;
/** /**

View File

@@ -0,0 +1,31 @@
/*
*
* 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.3.RELEASE
*/
public enum TarType {
/**
* 格式为{@code .gzip}的压缩包账单
*/
GZIP
}

View File

@@ -0,0 +1,40 @@
/*
*
* 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.3.RELEASE
*/
public enum TradeBillType {
/**
* 返回当日所有订单信息(不含充值退款订单)
*/
ALL,
/**
* 返回当日成功支付的订单(不含充值退款订单)
*/
SUCCESS,
/**
* 返回当日退款订单(不含充值退款订单)
*/
REFUND
}

View File

@@ -0,0 +1,36 @@
/*
*
* Copyright 2019-2020 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;
/**
* 未完成约定原因
* <p>
* 当订单守约状态为{@link ContractStatus#UNFINISHED},返回此字段
*
* @since 1.0.3.RELEASE
*/
public enum UnfinishedReason {
/**
* 到期未完成约
*/
DUE_TO_QUIT,
/**
* 提前退出约定
*/
EARLY_QUIT
}

View File

@@ -44,6 +44,18 @@ public enum WechatPayV3Type {
* @since 1.0.0.RELEASE * @since 1.0.0.RELEASE
*/ */
FILE_DOWNLOAD(HttpMethod.GET, "%s/v3/billdownload/file"), FILE_DOWNLOAD(HttpMethod.GET, "%s/v3/billdownload/file"),
/**
* 申请交易账单API.
*
* @since 1.0.3.RELEASE
*/
TRADEBILL(HttpMethod.GET, "%s/v3/bill/tradebill"),
/**
* 申请资金账单API.
*
* @since 1.0.3.RELEASE
*/
FUNDFLOWBILL(HttpMethod.GET, "%s/v3/bill/fundflowbill"),
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -107,19 +119,19 @@ public enum WechatPayV3Type {
* *
* @since 1.0.0.RELEASE * @since 1.0.0.RELEASE
*/ */
COMBINE_JSAPI(HttpMethod.POST, "%s/v3/pay/combine-transactions/jsapi"), COMBINE_JSAPI(HttpMethod.POST, "%s/v3/combine-transactions/jsapi"),
/** /**
* 合单下单-H5支付API. * 合单下单-H5支付API.
* *
* @since 1.0.0.RELEASE * @since 1.0.0.RELEASE
*/ */
COMBINE_MWEB(HttpMethod.POST, "%s/v3/pay/combine-transactions/h5"), COMBINE_MWEB(HttpMethod.POST, "%s/v3/combine-transactions/h5"),
/** /**
* 合单下单-Native支付API. * 合单下单-Native支付API.
* *
* @since 1.0.0.RELEASE * @since 1.0.0.RELEASE
*/ */
COMBINE_NATIVE(HttpMethod.POST, "%s/v3/pay/combine-transactions/native"), COMBINE_NATIVE(HttpMethod.POST, "%s/v3/combine-transactions/native"),
/** /**
* 合单查询订单API. * 合单查询订单API.
* *
@@ -223,6 +235,7 @@ public enum WechatPayV3Type {
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/** /**
* 微信先享卡预受理领卡请求API. * 微信先享卡预受理领卡请求API.
* *

View File

@@ -19,6 +19,9 @@
package cn.felord.payment.wechat.v3; package cn.felord.payment.wechat.v3;
import cn.felord.payment.PayException; import cn.felord.payment.PayException;
import cn.felord.payment.wechat.enumeration.*;
import cn.felord.payment.wechat.v3.model.FundFlowBillParams;
import cn.felord.payment.wechat.v3.model.TradeBillParams;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
@@ -27,8 +30,16 @@ import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import org.springframework.http.RequestEntity; import org.springframework.http.RequestEntity;
import org.springframework.util.Assert; import org.springframework.util.Assert;
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; import java.net.URI;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Objects;
import java.util.Optional;
/** /**
* The type Abstract api. * The type Abstract api.
@@ -127,7 +138,7 @@ public abstract class AbstractApi {
} }
/** /**
* Post request entity. * 构建Post请求对象.
* *
* @param uri the uri * @param uri the uri
* @param params the params * @param params the params
@@ -143,7 +154,7 @@ public abstract class AbstractApi {
} }
/** /**
* Get request entity. * 构建Get请求对象.
* *
* @param uri the uri * @param uri the uri
* @return the request entity * @return the request entity
@@ -152,4 +163,104 @@ public abstract class AbstractApi {
return RequestEntity.get(uri).header("Pay-TenantId", tenantId) return RequestEntity.get(uri).header("Pay-TenantId", tenantId)
.build(); .build();
} }
/**
* 对账单下载。
*
* @param link the link
* @return 对账单内容,有可能为空字符 “”
*/
protected String billDownload(String link) {
return this.client().withType(WechatPayV3Type.FILE_DOWNLOAD, link)
.function((type, downloadUrl) -> {
URI uri = UriComponentsBuilder.fromHttpUrl(downloadUrl)
.build()
.toUri();
return Get(uri);
})
.download();
}
/**
* 申请交易账单API
* <p>
* 微信支付按天提供交易账单文件,商户可以通过该接口获取账单文件的下载地址。文件内包含交易相关的金额、时间、营销等信息,供商户核对订单、退款、银行到账等情况。
* <p>
* 注意:
* <ul>
* <li>微信侧未成功下单的交易不会出现在对账单中。支付成功后撤销的交易会出现在对账单中,跟原支付单订单号一致;</li>
* <li>对账单中涉及金额的字段单位为“元”;</li>
* <li>对账单接口只能下载三个月以内的账单。</li>
* <li>小微商户不单独提供对账单下载如有需要可在调取“下载对账单”API接口时不传sub_mch_id获取服务商下全量电商二级商户包括小微商户和非小微商户的对账单。</li>
* </ul>
*
* @param tradeBillParams tradeBillParams
* @since 1.0.3.RELEASE
*/
public final void downloadTradeBill(TradeBillParams tradeBillParams) {
this.client().withType(WechatPayV3Type.TRADEBILL, tradeBillParams)
.function((wechatPayV3Type, params) -> {
MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>();
LocalDate billDate = params.getBillDate();
queryParams.add("bill_date", billDate.format(DateTimeFormatter.ISO_DATE));
String subMchid = params.getSubMchid();
if (StringUtils.hasText(subMchid)) {
queryParams.add("sub_mchid", subMchid);
}
TradeBillType tradeBillType = Optional.ofNullable(params.getBillType())
.orElse(TradeBillType.ALL);
queryParams.add("bill_type", tradeBillType.name());
TarType tarType = params.getTarType();
if (Objects.nonNull(tarType)) {
queryParams.add("tar_type", tarType.name());
}
URI uri = UriComponentsBuilder.fromHttpUrl(wechatPayV3Type.uri(WeChatServer.CHINA))
.queryParams(queryParams)
.build().toUri();
return Get(uri);
})
.consumer(response -> this.billDownload(Objects.requireNonNull(response.getBody()).get("download_url").asText()))
.request();
}
/**
* 申请资金账单API
* <p>
* 微信支付按天提供微信支付账户的资金流水账单文件,商户可以通过该接口获取账单文件的下载地址。文件内包含该账户资金操作相关的业务单号、收支金额、记账时间等信息,供商户进行核对。
* <p>
* 注意:
* <ul>
* <li>资金账单中的数据反映的是商户微信支付账户资金变动情况;</li>
* <li>对账单中涉及金额的字段单位为“元”。</li>
* </ul>
*
* @param fundFlowBillParams fundFlowBillParams
* @since 1.0.3.RELEASE
*/
public final void downloadFundFlowBill(FundFlowBillParams fundFlowBillParams) {
this.client().withType(WechatPayV3Type.FUNDFLOWBILL, fundFlowBillParams)
.function((wechatPayV3Type, params) -> {
MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>();
LocalDate billDate = params.getBillDate();
queryParams.add("bill_date", billDate.format(DateTimeFormatter.ISO_DATE));
FundFlowAccountType accountType = Optional.ofNullable(params.getAccountType())
.orElse(FundFlowAccountType.BASIC);
queryParams.add("account_type", accountType.name());
TarType tarType = params.getTarType();
if (Objects.nonNull(tarType)) {
queryParams.add("tar_type", tarType.name());
}
URI uri = UriComponentsBuilder.fromHttpUrl(wechatPayV3Type.uri(WeChatServer.CHINA))
.queryParams(queryParams)
.build().toUri();
return Get(uri);
})
.consumer(response -> this.billDownload(Objects.requireNonNull(response.getBody()).get("download_url").asText()))
.request();
}
} }

View File

@@ -490,6 +490,7 @@ public class WechatMarketingFavorApi extends AbstractApi {
* *
* @param stockId the stock id * @param stockId the stock id
* @return the wechat response entity * @return the wechat response entity
* @see AbstractApi#billDownload(String) 对账单下载api
*/ */
public WechatResponseEntity<ObjectNode> downloadStockUseFlow(String stockId) { public WechatResponseEntity<ObjectNode> downloadStockUseFlow(String stockId) {
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>(); WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
@@ -497,7 +498,7 @@ public class WechatMarketingFavorApi extends AbstractApi {
.function(this::downloadFlowFunction) .function(this::downloadFlowFunction)
.consumer(wechatResponseEntity::convert) .consumer(wechatResponseEntity::convert)
.request(); .request();
String csv = billDownload(wechatResponseEntity.getBody().get("url").asText()); String csv = this.billDownload(wechatResponseEntity.getBody().get("url").asText());
wechatResponseEntity.getBody().put("csv", csv); wechatResponseEntity.getBody().put("csv", csv);
return wechatResponseEntity; return wechatResponseEntity;
} }
@@ -511,6 +512,7 @@ public class WechatMarketingFavorApi extends AbstractApi {
* *
* @param stockId the stock id * @param stockId the stock id
* @return the wechat response entity * @return the wechat response entity
* @see AbstractApi#billDownload(String) 对账单下载api
*/ */
public WechatResponseEntity<ObjectNode> downloadStockRefundFlow(String stockId) { public WechatResponseEntity<ObjectNode> downloadStockRefundFlow(String stockId) {
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>(); WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
@@ -518,7 +520,7 @@ public class WechatMarketingFavorApi extends AbstractApi {
.function(this::downloadFlowFunction) .function(this::downloadFlowFunction)
.consumer(wechatResponseEntity::convert) .consumer(wechatResponseEntity::convert)
.request(); .request();
String csv = billDownload(wechatResponseEntity.getBody().get("url").asText()); String csv = this.billDownload(wechatResponseEntity.getBody().get("url").asText());
wechatResponseEntity.getBody().put("csv", csv); wechatResponseEntity.getBody().put("csv", csv);
return wechatResponseEntity; return wechatResponseEntity;
} }
@@ -629,35 +631,6 @@ public class WechatMarketingFavorApi extends AbstractApi {
.toUri(); .toUri();
return Post(uri, body); 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)
.download();
}
/**
* 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()
.toUri();
return Get(uri);
}
} }

View File

@@ -24,6 +24,7 @@ import cn.felord.payment.wechat.v3.model.ResponseSignVerifyParams;
import cn.felord.payment.wechat.v3.model.TransactionConsumeData; import cn.felord.payment.wechat.v3.model.TransactionConsumeData;
import cn.felord.payment.wechat.v3.model.combine.CombineTransactionConsumeData; import cn.felord.payment.wechat.v3.model.combine.CombineTransactionConsumeData;
import cn.felord.payment.wechat.v3.model.discountcard.*; import cn.felord.payment.wechat.v3.model.discountcard.*;
import cn.felord.payment.wechat.v3.model.payscore.PayScoreConsumer;
import cn.felord.payment.wechat.v3.model.payscore.PayScoreUserConfirmConsumeData; import cn.felord.payment.wechat.v3.model.payscore.PayScoreUserConfirmConsumeData;
import cn.felord.payment.wechat.v3.model.payscore.PayScoreUserPaidConsumeData; import cn.felord.payment.wechat.v3.model.payscore.PayScoreUserPaidConsumeData;
import cn.felord.payment.wechat.v3.model.payscore.PayScoreUserPermissionConsumeData; import cn.felord.payment.wechat.v3.model.payscore.PayScoreUserPermissionConsumeData;

View File

@@ -37,6 +37,7 @@ import org.springframework.web.util.UriComponentsBuilder;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.Optional;
import java.util.function.BiFunction; import java.util.function.BiFunction;
import java.util.function.Consumer; import java.util.function.Consumer;
@@ -276,17 +277,13 @@ public class WechatPayClient {
ResponseEntity<String> responseEntity = restOperations.exchange(requestEntity, String.class); ResponseEntity<String> responseEntity = restOperations.exchange(requestEntity, String.class);
String body = responseEntity.getBody();
HttpStatus statusCode = responseEntity.getStatusCode(); HttpStatus statusCode = responseEntity.getStatusCode();
// 微信请求id // 微信请求id
String requestId = requestEntity.getHeaders().getFirst("Request-ID"); String requestId = requestEntity.getHeaders().getFirst("Request-ID");
if (!statusCode.is2xxSuccessful()) { if (!statusCode.is2xxSuccessful()) {
throw new PayException("wechat pay server error, Request-ID "+requestId+" , statusCode " + statusCode + ",result : " + body); throw new PayException("wechat pay server error, Request-ID " + requestId + " , statusCode " + statusCode + ",result : " + responseEntity);
} }
if (Objects.isNull(body)) { return Optional.ofNullable(responseEntity.getBody()).orElse("");
throw new PayException("cant obtain wechat response body, Request-ID "+requestId);
}
return body;
} }
} }

View File

@@ -0,0 +1,52 @@
/*
*
* 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;
import cn.felord.payment.wechat.enumeration.FundFlowAccountType;
import cn.felord.payment.wechat.enumeration.TarType;
import lombok.Data;
import java.time.LocalDate;
/**
* 申请资金账单请求参数
*
* @author felord.cn
* @since 1.0.3.RELEASE
*/
@Data
public class FundFlowBillParams {
/**
* 账单日期,必传。
* <p>
* 格式YYYY-MM-DD仅支持三个月内的账单下载申请。
*/
private LocalDate billDate;
/**
* 资金账户类型,不填则默认值为{@link FundFlowAccountType#BASIC}
*
* @see FundFlowAccountType
*/
private FundFlowAccountType accountType;
/**
* 压缩类型,不填默认值为数据流
*
* @see TarType
*/
private TarType tarType;
}

View File

@@ -0,0 +1,70 @@
/*
*
* 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;
import cn.felord.payment.wechat.enumeration.TarType;
import cn.felord.payment.wechat.enumeration.TradeBillType;
import lombok.Data;
import java.time.LocalDate;
/**
* 申请交易账单请求参数
*
* @author felord.cn
* @since 1.0.3.RELEASE
*/
@Data
public class TradeBillParams {
/**
* 账单日期,必传。
* <p>
* 格式YYYY-MM-DD仅支持三个月内的账单下载申请。
*/
private LocalDate billDate;
/**
* 二级商户号,选填。
*
* <ol>
* <li>若商户是直连商户:无需填写该字段。</li>
* <li>若商户是服务商:
* <ul>
* <li>不填则默认返回服务商下的交易或退款数据。</li>
* <li>如需下载某个子商户下的交易或退款数据,则该字段必填。</li>
* </ul>
* </li>
* </ol>
* <p>
* 特殊规则最小字符长度为8
* <p>
* 注意:仅适用于电商平台 服务商
*/
private String subMchid;
/**
* 账单类型,不填则默认值为{@link TradeBillType#ALL}
*
* @see TradeBillType
*/
private TradeBillType billType;
/**
* 压缩类型,不填默认值为数据流
*
* @see TarType
*/
private TarType tarType;
}

View File

@@ -14,11 +14,11 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*
*/ */
package cn.felord.payment.wechat.v3.model.discountcard; package cn.felord.payment.wechat.v3.model.discountcard;
import cn.felord.payment.wechat.enumeration.ContractStatus; import cn.felord.payment.wechat.enumeration.ContractStatus;
import cn.felord.payment.wechat.enumeration.CountType;
import lombok.Data; import lombok.Data;
import java.util.List; import java.util.List;
@@ -33,51 +33,54 @@ import java.util.List;
public class DiscountCardAcceptedConsumeData { public class DiscountCardAcceptedConsumeData {
/** /**
* The Appid. * 应用appid需要绑定微信商户平台
*/ */
private String appid; private String appid;
/** /**
* The Card id. * 先享卡ID唯一标识一个先享卡
*/ */
private String cardId; private String cardId;
/** /**
* The Card template id. * 先享卡模板ID唯一定义此资源的标识。创建模板后可获得
*/ */
private String cardTemplateId; private String cardTemplateId;
/** /**
* The Create time. * 创建先享卡的时间
*/ */
private String createTime; private String createTime;
/** /**
* The Mchid. * 商户号
*/ */
private String mchid; private String mchid;
/** /**
* The Objectives. * 用户先享卡目标列表
*/ */
private List<Objective> objectives; private List<Objective> objectives;
/** /**
* The Openid. * 用户标识,用户在{@code appid}下的唯一标识
*/ */
private String openid; private String openid;
/** /**
* The Out card code. * 商户领卡号商户在请求领卡预受理接口时传入的领卡请求号同一个商户号下必须唯一要求32个字符内只能是数字、大小写字母_-|*
*/ */
private String outCardCode; private String outCardCode;
/** /**
* The Rewards. * 用户先享卡优惠列表
*/ */
private List<Reward> rewards; private List<Reward> rewards;
/** /**
* The Sharer openid. * 邀请者用户标识
* <p>
* 微信用户在商户对应appid下的唯一标识。
* 仅当此卡是通过“邀请有礼”渠道领卡时,会返回此字段;指此先享卡是通过此[邀请者]邀请领卡成功的。当此先享卡完成约定时,商户可给此[邀请者]下发应邀请有礼的奖励
*/ */
private String sharerOpenid; private String sharerOpenid;
/** /**
* The State. * 先享卡的守约状态
*/ */
private ContractStatus state; private ContractStatus state;
/** /**
* The Time range. * 约定时间期限
*/ */
private TimeRange timeRange; private TimeRange timeRange;
@@ -91,23 +94,27 @@ public class DiscountCardAcceptedConsumeData {
public static class Objective { public static class Objective {
/** /**
* The Count. * 目标数量
* <p>
* 履约目标需要完成的数量必须大于0。
*/ */
private Long count; private Long count;
/** /**
* The Description. * 目标描述
*/ */
private String description; private String description;
/** /**
* The Name. * 目标名称
*/ */
private String name; private String name;
/** /**
* The Objective id. * 目标id
*/ */
private String objectiveId; private String objectiveId;
/** /**
* The Unit. * 目标单位
* <p>
* 示例值:次
*/ */
private String unit; private String unit;
@@ -123,38 +130,42 @@ public class DiscountCardAcceptedConsumeData {
public static class Reward { public static class Reward {
/** /**
* The Amount. * 优惠金额
* <p>
* 1、优惠金额此项优惠对应的优惠总金额单位必须大于0。
* 2、此项优惠已享累计金额≤创建模板时配置的此项奖励的奖励金额
* 例如优惠为【满10元减3元优惠券4张】时用户一次消费使用了2张优惠券优惠金额为本次优惠总金额6元优惠数量为本次使用优惠的优惠券数量2张
*/ */
private Long amount; private Long amount;
/** /**
* The Count. * 优惠数量
*/ */
private Long count; private Long count;
/** /**
* The Count type. * 优惠数量类型
*/ */
private CountType countType; private CountType countType;
/** /**
* The Description. * 优惠描述
*/ */
private String description; private String description;
/** /**
* The Name. * 优惠名称
*/ */
private String name; private String name;
/** /**
* The Reward id. * 优惠ID
*/ */
private String rewardId; private String rewardId;
/** /**
* The Unit. * 优惠单位,例如 “个”
*/ */
private String unit; private String unit;
} }
/** /**
* The type Time range. * 先享卡约定时间期限
* *
* @author felord.cn * @author felord.cn
* @since 1.0.2.RELEASE * @since 1.0.2.RELEASE
@@ -162,29 +173,13 @@ public class DiscountCardAcceptedConsumeData {
@Data @Data
public static class TimeRange { public static class TimeRange {
/** /**
* The Betin time. * 开始时间
*/ */
private String betinTime; private String betinTime;
/** /**
* The End time. * 结束时间
*/ */
private String endTime; private String endTime;
} }
/**
* 优惠数量的类型标识
*
* @author felord.cn
* @since 1.0.2.RELEASE
*/
public enum CountType{
/**
* 不限数量
*/
COUNT_UNLIMITED,
/**
* 有限数量
*/
COUNT_LIMIT
}
} }

View File

@@ -14,10 +14,12 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*
*/ */
package cn.felord.payment.wechat.v3.model.discountcard; package cn.felord.payment.wechat.v3.model.discountcard;
import cn.felord.payment.wechat.enumeration.ContractStatus;
import cn.felord.payment.wechat.enumeration.CountType;
import cn.felord.payment.wechat.enumeration.UnfinishedReason;
import lombok.Data; import lombok.Data;
import java.util.List; import java.util.List;
@@ -31,60 +33,60 @@ import java.util.List;
@Data @Data
public class DiscountCardAgreementEndConsumeData { public class DiscountCardAgreementEndConsumeData {
/** /**
* The Appid. * 应用appid需要绑定微信商户平台
*/ */
private String appid; private String appid;
/** /**
* The Card id. * 先享卡ID唯一标识一个先享卡
*/ */
private String cardId; private String cardId;
/** /**
* The Card template id. * 先享卡模板ID唯一定义此资源的标识。创建模板后可获得
*/ */
private String cardTemplateId; private String cardTemplateId;
/** /**
* The Create time. * 创建先享卡的时间
*/ */
private String createTime; private String createTime;
/** /**
* The Mchid. * 商户号
*/ */
private String mchid; private String mchid;
/** /**
* The Objectives. * 用户先享卡目标列表
*/ */
private List<Objective> objectives; private List<Objective> objectives;
/** /**
* The Openid. * 用户标识,用户在{@code appid}下的唯一标识
*/ */
private String openid; private String openid;
/** /**
* The Out card code. * 商户领卡号商户在请求领卡预受理接口时传入的领卡请求号同一个商户号下必须唯一要求32个字符内只能是数字、大小写字母_-|*
*/ */
private String outCardCode; private String outCardCode;
/** /**
* The Rewards. * 用户先享卡优惠列表
*/ */
private List<Reward> rewards; private List<Reward> rewards;
/** /**
* The State. * 先享卡的守约状态
*/ */
private String state; private ContractStatus state;
/** /**
* The Time range. * 先享卡约定时间期限
*/ */
private TimeRange timeRange; private TimeRange timeRange;
/** /**
* The Total amount. * 享受优惠总金额,单位为 “分”
*/ */
private Long totalAmount; private Long totalAmount;
/** /**
* The Unfinished reason. * 未完成约定原因
*/ */
private String unfinishedReason; private UnfinishedReason unfinishedReason;
/** /**
* The type Objective. * 目标列表属性
* *
* @author felord.cn * @author felord.cn
* @since 1.0.2.RELEASE * @since 1.0.2.RELEASE
@@ -93,34 +95,38 @@ public class DiscountCardAgreementEndConsumeData {
public static class Objective { public static class Objective {
/** /**
* The Count. * 目标数量
* <p>
* 履约目标需要完成的数量必须大于0。
*/ */
private Long count; private Long count;
/** /**
* The Description. * 目标描述
*/ */
private String description; private String description;
/** /**
* The Name. * 目标名称
*/ */
private String name; private String name;
/** /**
* The Objective completion records. * 用户先享卡目标完成纪录
*/ */
private List<ObjectiveCompletionRecord> objectiveCompletionRecords; private List<ObjectiveCompletionRecord> objectiveCompletionRecords;
/** /**
* The Objective id. * 目标id
*/ */
private String objectiveId; private String objectiveId;
/** /**
* The Unit. * 目标单位
* <p>
* 示例值:次
*/ */
private String unit; private String unit;
} }
/** /**
* The type Time range. * 先享卡约定时间期限
* *
* @author felord.cn * @author felord.cn
* @since 1.0.2.RELEASE * @since 1.0.2.RELEASE
@@ -128,17 +134,17 @@ public class DiscountCardAgreementEndConsumeData {
@Data @Data
public static class TimeRange { public static class TimeRange {
/** /**
* The Betin time. * 开始时间
*/ */
private String betinTime; private String betinTime;
/** /**
* The End time. * 结束时间
*/ */
private String endTime; private String endTime;
} }
/** /**
* The type Reward. * 优惠列表属性
* *
* @author felord.cn * @author felord.cn
* @since 1.0.2.RELEASE * @since 1.0.2.RELEASE
@@ -147,37 +153,42 @@ public class DiscountCardAgreementEndConsumeData {
public static class Reward { public static class Reward {
/** /**
* The Amount. * 优惠金额
* <p>
* 1、优惠金额此项优惠对应的优惠总金额单位必须大于0。
* 2、此项优惠已享累计金额≤创建模板时配置的此项奖励的奖励金额
* 例如优惠为【满10元减3元优惠券4张】时用户一次消费使用了2张优惠券优惠金额为本次优惠总金额6元优惠数量为本次使用优惠的优惠券数量2张
*/ */
private Long amount; private Long amount;
/** /**
* The Count. * 优惠数量
*/ */
private Long count; private Long count;
/** /**
* The Count type. * 优惠数量类型
*/ */
private String countType; private CountType countType;
/** /**
* The Description. * 优惠描述
*/ */
private String description; private String description;
/** /**
* The Name. * 优惠名称
*/ */
private String name; private String name;
/** /**
* The Reward id. * 优惠ID
*/ */
private String rewardId; private String rewardId;
/** /**
* The Reward usage records. * 优惠单位,例如 “个”
*/
private List<RewardUsageRecord> rewardUsageRecords;
/**
* The Unit.
*/ */
private String unit; private String unit;
/**
* 优惠使用记录列表
*/
private List<RewardUsageRecord> rewardUsageRecords;
} }
} }

View File

@@ -14,7 +14,6 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*
*/ */
package cn.felord.payment.wechat.v3.model.discountcard; package cn.felord.payment.wechat.v3.model.discountcard;
@@ -31,15 +30,15 @@ import java.util.function.Consumer;
@Data @Data
public class DiscountCardConsumer { public class DiscountCardConsumer {
/** /**
* The Accepted consume data consumer. * 用户领取微信先享卡通知解密
*/ */
private Consumer<DiscountCardAcceptedConsumeData> acceptedConsumeDataConsumer; private Consumer<DiscountCardAcceptedConsumeData> acceptedConsumeDataConsumer;
/** /**
* The Agreement end consume data consumer. * 微信支付先享卡用户守约状态变化通知解密
*/ */
private Consumer<DiscountCardAgreementEndConsumeData> agreementEndConsumeDataConsumer; private Consumer<DiscountCardAgreementEndConsumeData> agreementEndConsumeDataConsumer;
/** /**
* The Card user paid consume data consumer. * 先享卡扣费状态变化通知解密
*/ */
private Consumer<DiscountCardUserPaidConsumeData> cardUserPaidConsumeDataConsumer; private Consumer<DiscountCardUserPaidConsumeData> cardUserPaidConsumeDataConsumer;
} }

View File

@@ -14,15 +14,15 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*
*/ */
package cn.felord.payment.wechat.v3.model.discountcard; package cn.felord.payment.wechat.v3.model.discountcard;
import cn.felord.payment.wechat.enumeration.ContractStatus;
import cn.felord.payment.wechat.enumeration.UnfinishedReason;
import lombok.Data; import lombok.Data;
/** /**
* 先享卡扣费状态变化通知解密. * 先享卡扣费状态变化通知解密
*
* *
* @author felord.cn * @author felord.cn
* @since 1.0.2.RELEASE * @since 1.0.2.RELEASE
@@ -31,67 +31,84 @@ import lombok.Data;
public class DiscountCardUserPaidConsumeData { public class DiscountCardUserPaidConsumeData {
/** /**
* The Appid. * 应用appid需要绑定微信商户平台
*/ */
private String appid; private String appid;
/** /**
* The Card id. * 先享卡ID唯一标识一个先享卡
*/ */
private String cardId; private String cardId;
/** /**
* The Card template id. * 先享卡模板ID唯一定义此资源的标识。创建模板后可获得
*/ */
private String cardTemplateId; private String cardTemplateId;
/** /**
* The Mchid. * 商户号
*/ */
private String mchid; private String mchid;
/** /**
* The Openid. * 用户标识,用户在{@code appid}下的唯一标识
*/ */
private String openid; private String openid;
/** /**
* The Out card code. * 商户领卡号商户在请求领卡预受理接口时传入的领卡请求号同一个商户号下必须唯一要求32个字符内只能是数字、大小写字母_-|*
*/ */
private String outCardCode; private String outCardCode;
/** /**
* The Pay information. * 先享卡的守约状态
*/ */
private PayInformation payInformation; private ContractStatus state;
/** /**
* The State. * 享受优惠总金额,单位为 “分”
*/
private String state;
/**
* The Total amount.
*/ */
private Long totalAmount; private Long totalAmount;
/** /**
* The Unfinished reason. * 未完成约定原因
*/ */
private String unfinishedReason; private UnfinishedReason unfinishedReason;
/**
* 用户退回优惠的付款信息
*/
private PayInformation payInformation;
/** /**
* The type Pay information. * 用户退回优惠的付款信息
* <p>
* 当状态为{@link ContractStatus#UNFINISHED}(用户未完成约定)时,且需要退回已享受的优惠金额时,返回此字段;
*/ */
@Data @Data
public static class PayInformation { public static class PayInformation {
/** /**
* The Pay amount. * 付款金额,用户需要退回优惠而付款的金额,单位为:分;
*/ */
private Long payAmount; private Long payAmount;
/** /**
* The Pay state. * 用户付款状态,
*/ */
private String payState; private PayState payState;
/** /**
* The Pay time. * 付款时间
*/ */
private String payTime; private String payTime;
/** /**
* The Transaction id. * 微信支付订单号,仅在订单成功收款时才返回
*/ */
private String transactionId; private String transactionId;
} }
/**
* 付款状态
* @since 1.0.3.RELEASE
*/
public enum PayState {
/**
* 付款中
*/
PAYING,
/**
* 已付款
*/
PAID
}
} }

View File

@@ -14,7 +14,6 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*
*/ */
package cn.felord.payment.wechat.v3.model.discountcard; package cn.felord.payment.wechat.v3.model.discountcard;
@@ -22,7 +21,7 @@ import cn.felord.payment.wechat.enumeration.StrategyType;
import lombok.Data; import lombok.Data;
/** /**
* The type Objective completion record. * 微信先享卡目标完成纪录
* *
* @author felord.cn * @author felord.cn
* @since 1.0.2.RELEASE * @since 1.0.2.RELEASE
@@ -31,31 +30,31 @@ import lombok.Data;
public class ObjectiveCompletionRecord { public class ObjectiveCompletionRecord {
/** /**
* The Completion count. * 目标完成数量
*/ */
private Long completionCount; private Long completionCount;
/** /**
* The Completion time. * 目标完成时间
*/ */
private String completionTime; private String completionTime;
/** /**
* The Completion type. * 目标完成类型
*/ */
private StrategyType completionType; private StrategyType completionType;
/** /**
* The Description. * 目标完成描述
*/ */
private String description; private String description;
/** /**
* The Objective completion serial no. * 目标完成流水号
*/ */
private String objectiveCompletionSerialNo; private String objectiveCompletionSerialNo;
/** /**
* The Objective id. * 目标id
*/ */
private String objectiveId; private String objectiveId;
/** /**
* The Remark. * 备注说明
*/ */
private String remark; private String remark;

View File

@@ -14,7 +14,6 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*
*/ */
package cn.felord.payment.wechat.v3.model.discountcard; package cn.felord.payment.wechat.v3.model.discountcard;
@@ -22,7 +21,7 @@ import cn.felord.payment.wechat.enumeration.StrategyType;
import lombok.Data; import lombok.Data;
/** /**
* The type Reward usage record. * 优惠使用纪录列表对象
* *
* @author felord.cn * @author felord.cn
* @since 1.0.2.RELEASE * @since 1.0.2.RELEASE
@@ -31,35 +30,40 @@ import lombok.Data;
public class RewardUsageRecord { public class RewardUsageRecord {
/** /**
* The Amount. * 优惠金额
*
* <ol>
* <li>优惠金额用户此项本次享受的优惠对应的优惠总金额单位必须大于0。</li>
* <li>子优惠已享金额累计≤创建模板时配置的此子优惠的价值金额 例如优惠为【满10元减3元优惠券4张】时用户一次消费使用了2张优惠券优惠金额为本次优惠总金额6元优惠数量为本次使用优惠的优惠券数量2张</li>
* </ol>
*/ */
private Long amount; private Long amount;
/** /**
* The Description. * 优惠使用描述
*/ */
private String description; private String description;
/** /**
* The Remark. * 备注说明
*/ */
private String remark; private String remark;
/** /**
* The Reward id. * 优惠Id
*/ */
private String rewardId; private String rewardId;
/** /**
* The Reward usage serial no. * 优惠使用纪录流水号
*/ */
private String rewardUsageSerialNo; private String rewardUsageSerialNo;
/** /**
* The Usage count. * 优惠使用数量
*/ */
private Long usageCount; private Long usageCount;
/** /**
* The Usage time. * 优惠使用时间
*/ */
private String usageTime; private String usageTime;
/** /**
* The Usage type. * 优惠使用类型
*/ */
private StrategyType usageType; private StrategyType usageType;

View File

@@ -14,7 +14,6 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*
*/ */
package cn.felord.payment.wechat.v3.model.discountcard; package cn.felord.payment.wechat.v3.model.discountcard;
@@ -30,21 +29,20 @@ import java.util.List;
*/ */
@Data @Data
public class UserRecordsParams { public class UserRecordsParams {
/** /**
* The Out card code. * 商户领卡号商户在请求领卡预受理接口时传入的领卡请求号同一个商户号下必须唯一要求32个字符内只能是数字、大小写字母_-|*
*/ */
private String outCardCode; private String outCardCode;
/** /**
* The Card template id. * 先享卡模板ID唯一定义此资源的标识。创建模板后可获得
*/ */
private String cardTemplateId; private String cardTemplateId;
/** /**
* The Objective completion records. * 微信先享卡目标完成纪录
*/ */
private List<ObjectiveCompletionRecord> objectiveCompletionRecords; private List<ObjectiveCompletionRecord> objectiveCompletionRecords;
/** /**
* The Reward usage records. * 优惠使用纪录
*/ */
private List<RewardUsageRecord> rewardUsageRecords; private List<RewardUsageRecord> rewardUsageRecords;

View File

@@ -14,12 +14,9 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*
*/ */
package cn.felord.payment.wechat.v3.model.discountcard; package cn.felord.payment.wechat.v3.model.payscore;
import cn.felord.payment.wechat.v3.model.payscore.PayScoreUserConfirmConsumeData;
import cn.felord.payment.wechat.v3.model.payscore.PayScoreUserPaidConsumeData;
import lombok.Data; import lombok.Data;
import java.util.function.Consumer; import java.util.function.Consumer;
@@ -33,11 +30,11 @@ import java.util.function.Consumer;
@Data @Data
public class PayScoreConsumer { public class PayScoreConsumer {
/** /**
* The Confirm consume data consumer. * 用户确认回调消费接口
*/ */
private Consumer<PayScoreUserConfirmConsumeData> confirmConsumeDataConsumer; private Consumer<PayScoreUserConfirmConsumeData> confirmConsumeDataConsumer;
/** /**
* The Paid consume data consumer. * 用户支付回调消费接口
*/ */
private Consumer<PayScoreUserPaidConsumeData> paidConsumeDataConsumer; private Consumer<PayScoreUserPaidConsumeData> paidConsumeDataConsumer;
} }

View File

@@ -5,11 +5,11 @@
<parent> <parent>
<groupId>cn.felord</groupId> <groupId>cn.felord</groupId>
<artifactId>payment-spring-boot</artifactId> <artifactId>payment-spring-boot</artifactId>
<version>1.0.2.RELEASE</version> <version>1.0.3.RELEASE</version>
</parent> </parent>
<artifactId>payment-spring-boot-starter</artifactId> <artifactId>payment-spring-boot-starter</artifactId>
<version>1.0.2.RELEASE</version> <version>1.0.3.RELEASE</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -4,7 +4,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<groupId>cn.felord</groupId> <groupId>cn.felord</groupId>
<artifactId>payment-spring-boot</artifactId> <artifactId>payment-spring-boot</artifactId>
<version>1.0.2.RELEASE</version> <version>1.0.3.RELEASE</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>