mirror of
https://github.com/dromara/payment-spring-boot.git
synced 2026-03-14 22:03:41 +08:00
Compare commits
66 Commits
1.0.7.RELE
...
1.0.10.REL
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5646bab7e6 | ||
|
|
40ffb286d3 | ||
|
|
5047be7fd0 | ||
|
|
285356600a | ||
|
|
277a1223c5 | ||
|
|
6086dd5101 | ||
|
|
c9ed68fa80 | ||
|
|
e9307bf490 | ||
|
|
b4f8aa48b1 | ||
|
|
0bfa439c4e | ||
|
|
ee5522e980 | ||
|
|
53e6016c4c | ||
|
|
538e11dabe | ||
|
|
ae618da2d3 | ||
|
|
9dfdb2b295 | ||
|
|
d95f38fb0a | ||
|
|
00dc8da556 | ||
|
|
f1c9a873b5 | ||
|
|
65b3035c55 | ||
|
|
d1f3de7906 | ||
|
|
ef172471c5 | ||
|
|
f62e8eb921 | ||
|
|
291e73b34c | ||
|
|
39ec2ef4f5 | ||
|
|
71d0342eee | ||
|
|
7ed3582c12 | ||
|
|
adfb37a71a | ||
|
|
7ffcc47255 | ||
|
|
237851c7c5 | ||
|
|
8914d7272d | ||
|
|
cea3395aed | ||
|
|
77d80588fb | ||
|
|
f0c0b64a93 | ||
|
|
02ce523cde | ||
|
|
01b9fc3aa0 | ||
|
|
73b19fcc0a | ||
|
|
aae5096349 | ||
|
|
ace5a900d2 | ||
|
|
24f748a197 | ||
|
|
9880a1e561 | ||
|
|
0f8aa8f2d0 | ||
|
|
7eac8dcdc4 | ||
|
|
7c95c8ec7c | ||
|
|
34b65b6417 | ||
|
|
03fba59c49 | ||
|
|
54a0822c73 | ||
|
|
8d130e5df1 | ||
|
|
82bcc11dad | ||
|
|
e0eacd523e | ||
|
|
911f986d80 | ||
|
|
d1068c1fb6 | ||
|
|
b913698884 | ||
|
|
34e5443e88 | ||
|
|
f4dc70e828 | ||
|
|
39716c30e4 | ||
|
|
ab13d90b9b | ||
|
|
4f71f419a7 | ||
|
|
ec77604b99 | ||
|
|
ff5911205b | ||
|
|
22d83edb89 | ||
|
|
64d8294758 | ||
|
|
cecee81b08 | ||
|
|
6276b24c9f | ||
|
|
282a60e3bb | ||
|
|
2e143302e8 | ||
|
|
9fba48d52d |
35
.github/workflows/main.yml
vendored
Normal file
35
.github/workflows/main.yml
vendored
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
# 相当于脚本用途的一个声明
|
||||||
|
name: Maven Central Repo Deployment
|
||||||
|
# 触发脚本的事件 这里为发布release之后触发
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [released]
|
||||||
|
# 定义一个发行任务
|
||||||
|
jobs:
|
||||||
|
publish:
|
||||||
|
# 任务运行的环境
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
# 任务的步骤
|
||||||
|
steps:
|
||||||
|
# 1. 声明 checkout 仓库代码到工作区
|
||||||
|
- name: Checkout Git Repo
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
# 2. 安装Java 环境 这里会用到的参数就是 Git Action secrets中配置的,
|
||||||
|
# 取值要在key前面加 secrets.
|
||||||
|
- name: Set up Maven Central Repo
|
||||||
|
uses: actions/setup-java@v1
|
||||||
|
with:
|
||||||
|
java-version: 1.8
|
||||||
|
server-id: sonatype-nexus-staging
|
||||||
|
server-username: ${{ secrets.OSSRH_USER }}
|
||||||
|
server-password: ${{ secrets.OSSRH_PASSWORD }}
|
||||||
|
gpg-passphrase: ${{ secrets.GPG_PASSWORD }}
|
||||||
|
# 3. 发布到Maven中央仓库
|
||||||
|
- name: Publish to Maven Central Repo
|
||||||
|
# 这里用到了其他人写的action脚本,详细可以去看他的文档。
|
||||||
|
uses: samuelmeuli/action-maven-publish@v1
|
||||||
|
with:
|
||||||
|
gpg_private_key: ${{ secrets.GPG_SECRET }}
|
||||||
|
gpg_passphrase: ${{ secrets.GPG_PASSWORD }}
|
||||||
|
nexus_username: ${{ secrets.OSSRH_USER }}
|
||||||
|
nexus_password: ${{ secrets.OSSRH_PASSWORD }}
|
||||||
@@ -11,7 +11,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.7.RELEASE</version>
|
<version>1.0.10.RELEASE</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -26,6 +26,7 @@
|
|||||||
- 实现微信支付V3 商家券
|
- 实现微信支付V3 商家券
|
||||||
- 实现微信支付V3 批量转账到零钱
|
- 实现微信支付V3 批量转账到零钱
|
||||||
|
|
||||||
|
更多参考[changelog](https://notfound403.github.io/payment-spring-boot/#/changelog)
|
||||||
|
|
||||||
## 核心API结构
|
## 核心API结构
|
||||||

|

|
||||||
|
|||||||
@@ -35,7 +35,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.7.RELEASE</version>
|
<version>1.0.10.RELEASE</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
## 采用技术
|
## 采用技术
|
||||||
|
|||||||
@@ -1,10 +1,48 @@
|
|||||||
|
## 1.0.10.RELEASE
|
||||||
|
|
||||||
|
- 微信支付
|
||||||
|
- feat: 微信支付V2分账接口实现,感谢**zacone**同学贡献的PR
|
||||||
|
- factor: 优化证书加载方式
|
||||||
|
- factor: 商家券修改API的请求方式变更为`Patch`
|
||||||
|
- fix: 修复微信支付V3中native支付通知回调`successTime`字段无时区信息的问题([#I3ED43](https://gitee.com/felord/payment-spring-boot/issues/I3ED43))
|
||||||
|
- 支付宝
|
||||||
|
- fix: 修复支付宝Maven打包无法读取证书的问题([#24](https://github.com/NotFound403/payment-spring-boot/issues/24))
|
||||||
|
|
||||||
|
## 1.0.9.RELEASE
|
||||||
|
|
||||||
|
- 微信支付
|
||||||
|
- refactor: `WechatPartnerPayApi` 加入**Spring IOC**
|
||||||
|
- fix: 支付分支付成功回调反序列化异常 ([#21](https://github.com/NotFound403/payment-spring-boot/issues/21))
|
||||||
|
- fix: 修复枚举空指针问题 ([#22](https://github.com/NotFound403/payment-spring-boot/issues/22))
|
||||||
|
|
||||||
|
## 1.0.8.RELEASE
|
||||||
|
|
||||||
|
- 微信支付
|
||||||
|
- feat: 对基础支付-服务商支付进行支持
|
||||||
|
- refactor: 在异常返回时对非2xx状态返回的元信息进行包装方便序列化([#16](https://github.com/NotFound403/payment-spring-boot/issues/16))
|
||||||
|
- fix: 修复退款数据中时间无法解析的异常([#13](https://github.com/NotFound403/payment-spring-boot/issues/13))
|
||||||
|
- fix: 修复类成员的属性([#14](https://github.com/NotFound403/payment-spring-boot/issues/14))
|
||||||
|
- fix: 查询并下载转账电子回单API接口,下载文件接口签名失败([#18](https://github.com/NotFound403/payment-spring-boot/issues/18))
|
||||||
|
|
||||||
|
## 1.0.7.RELEASE
|
||||||
|
|
||||||
|
- 微信支付
|
||||||
|
- refactor: X509证书加载优化。
|
||||||
|
- refactor: 移除过期的`WechatPayRefundApi`。
|
||||||
|
- refactor: 优化RestTemplate在低版本引起的一个I/O异常,详见 [spring-framework#21321](https://github.com/spring-projects/spring-framework/issues/21321)。
|
||||||
|
- refactor: 在请求头Content-Type中声明字符集UTF-8,避免中文乱码。
|
||||||
|
- fix: 修复退款回调中退款状态枚举无法正确被解析的异常([#11](https://github.com/NotFound403/payment-spring-boot/issues/11))。
|
||||||
|
|
||||||
## 1.0.6.RELEASE
|
## 1.0.6.RELEASE
|
||||||
|
|
||||||
- 微信支付
|
- 微信支付
|
||||||
- feat:实现微信支付V3批量转账到零钱所有API(WechatBatchTransferApi),助力抗击新冠疫情。
|
- feat:实现微信支付V3批量转账到零钱所有API(WechatBatchTransferApi),助力抗击新冠疫情。
|
||||||
- feat:实现微信支付V3退款以及退款通知等所有退款相关的API,推荐使用新的V3退款。
|
- feat:实现微信支付V3退款以及退款通知等所有退款相关的API,推荐使用新的V3退款。
|
||||||
- refactor: V2退款进入过期模式,由于V3已经推出了退款功能,所以V2退款 WechatPayRefundApi 被标记为 Deprecated 未来会被移除。
|
- refactor: V2退款进入过期模式,由于V3已经推出了退款功能,所以V2退款 WechatPayRefundApi 被标记为 Deprecated 未来会被移除。
|
||||||
- refactor: 交易状态增加等待扣款状态,根据微信最新的业务变动增加 “ACCEPT” 字段用来标记“已接收,等待扣款”状态。
|
- refactor: 交易状态增加等待扣款状态,根据微信最新的业务变动增加 “ACCEPT” 字段用来标记“已接收,等待扣款”状态。
|
||||||
|
|
||||||
## 1.0.5.RELEASE
|
## 1.0.5.RELEASE
|
||||||
|
|
||||||
- 微信支付
|
- 微信支付
|
||||||
- feat:增加V2退款接口
|
- feat:增加V2退款接口
|
||||||
- feat:增加V2企业付款到零钱接口
|
- feat:增加V2企业付款到零钱接口
|
||||||
@@ -15,6 +53,7 @@
|
|||||||
- fix: 关单接口调用异常
|
- fix: 关单接口调用异常
|
||||||
|
|
||||||
## 1.0.4.RELEASE
|
## 1.0.4.RELEASE
|
||||||
|
|
||||||
- 微信支付
|
- 微信支付
|
||||||
- feat: 增加微信支付商家券相关接口`WechatMarketingBusiFavorApi`,商家券请阅读相关产品文档。
|
- feat: 增加微信支付商家券相关接口`WechatMarketingBusiFavorApi`,商家券请阅读相关产品文档。
|
||||||
- feat: 代金券功能增加发放消费卡接口。
|
- feat: 代金券功能增加发放消费卡接口。
|
||||||
@@ -24,6 +63,7 @@
|
|||||||
- fix: 支付分`RiskFund`下枚举无法使用的问题[(#2)](https://github.com/NotFound403/payment-spring-boot/issues/2)。
|
- fix: 支付分`RiskFund`下枚举无法使用的问题[(#2)](https://github.com/NotFound403/payment-spring-boot/issues/2)。
|
||||||
|
|
||||||
## 1.0.3.RELEASE
|
## 1.0.3.RELEASE
|
||||||
|
|
||||||
- 微信支付
|
- 微信支付
|
||||||
- feat: 完善合单支付账单
|
- feat: 完善合单支付账单
|
||||||
1. 增加合单支付-申请交易账单API。
|
1. 增加合单支付-申请交易账单API。
|
||||||
|
|||||||
@@ -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.7.RELEASE</version>
|
<version>1.0.10.RELEASE</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
> 基于 **Spring Boot 2.x**
|
> 基于 **Spring Boot 2.x**
|
||||||
@@ -48,13 +48,13 @@ wechat:
|
|||||||
v3:
|
v3:
|
||||||
# 租户id
|
# 租户id
|
||||||
<tentantID>:
|
<tentantID>:
|
||||||
# 应用appId 必填
|
# 应用appId 服务商模式下为服务商的appid 必填
|
||||||
app-id: xxxxxxxx
|
app-id: xxxxxxxx
|
||||||
# v2 api 密钥 1.0.5版本以后如果用到V2的接口时必填
|
# v2 api 密钥 1.0.5版本以后如果用到V2的接口时必填
|
||||||
app-secret: xxxxxxxxxxx
|
app-secret: xxxxxxxxxxx
|
||||||
# api v3 密钥 必填
|
# api v3 密钥 必填
|
||||||
app-v3-secret: xxxxxxxx
|
app-v3-secret: xxxxxxxx
|
||||||
# 微信支付商户号 必填
|
# 微信支付商户号 服务商模式下为服务商的mchid 必填
|
||||||
mch-id: xxxxxxx
|
mch-id: xxxxxxx
|
||||||
# 商户服务器域名 用于回调 需要放开回调接口的安全策略 必填
|
# 商户服务器域名 用于回调 需要放开回调接口的安全策略 必填
|
||||||
domain: https://felord.cn
|
domain: https://felord.cn
|
||||||
|
|||||||
@@ -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.7.RELEASE</version>
|
<version>1.0.10.RELEASE</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>payment-spring-boot-autoconfigure</artifactId>
|
<artifactId>payment-spring-boot-autoconfigure</artifactId>
|
||||||
<version>1.0.7.RELEASE</version>
|
<version>1.0.10.RELEASE</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -18,11 +18,17 @@
|
|||||||
*/
|
*/
|
||||||
package cn.felord.payment;
|
package cn.felord.payment;
|
||||||
|
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author felord.cn
|
* @author felord.cn
|
||||||
* @since 1.0.0.RELEASE
|
* @since 1.0.0.RELEASE
|
||||||
*/
|
*/
|
||||||
public class PayException extends RuntimeException {
|
public class PayException extends RuntimeException {
|
||||||
|
/**
|
||||||
|
* response maybe null
|
||||||
|
*/
|
||||||
|
private ResponseEntity<?> response;
|
||||||
|
|
||||||
public PayException() {
|
public PayException() {
|
||||||
}
|
}
|
||||||
@@ -42,4 +48,12 @@ public class PayException extends RuntimeException {
|
|||||||
public PayException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
|
public PayException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
|
||||||
super(message, cause, enableSuppression, writableStackTrace);
|
super(message, cause, enableSuppression, writableStackTrace);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ResponseEntity<?> getResponse() {
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setResponse(ResponseEntity<?> response) {
|
||||||
|
this.response = response;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,11 +19,12 @@
|
|||||||
package cn.felord.payment.alipay;
|
package cn.felord.payment.alipay;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.felord.payment.PayException;
|
||||||
import com.alipay.api.AlipayApiException;
|
import com.alipay.api.AlipayApiException;
|
||||||
import com.alipay.api.AlipayClient;
|
import com.alipay.api.AlipayClient;
|
||||||
import com.alipay.api.CertAlipayRequest;
|
import com.alipay.api.CertAlipayRequest;
|
||||||
import com.alipay.api.DefaultAlipayClient;
|
import com.alipay.api.DefaultAlipayClient;
|
||||||
import cn.felord.payment.PayException;
|
import com.alipay.api.internal.util.file.IOUtils;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||||
@@ -32,7 +33,9 @@ import org.springframework.context.annotation.Bean;
|
|||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.core.io.ClassPathResource;
|
import org.springframework.core.io.ClassPathResource;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author felord.cn
|
* @author felord.cn
|
||||||
@@ -57,28 +60,28 @@ public class AliPayConfiguration {
|
|||||||
propertyMapper.from(v1::getFormat).to(certAlipayRequest::setFormat);
|
propertyMapper.from(v1::getFormat).to(certAlipayRequest::setFormat);
|
||||||
propertyMapper.from(v1::getCharset).to(certAlipayRequest::setCharset);
|
propertyMapper.from(v1::getCharset).to(certAlipayRequest::setCharset);
|
||||||
propertyMapper.from(v1::getSignType).to(certAlipayRequest::setSignType);
|
propertyMapper.from(v1::getSignType).to(certAlipayRequest::setSignType);
|
||||||
propertyMapper.from(v1::getAppCertPublicKeyPath).as(this::getFileAbsolutePath).to(certAlipayRequest::setCertPath);
|
propertyMapper.from(v1::getAppCertPublicKeyPath).as(this::getContentFromClassPath).to(certAlipayRequest::setCertContent);
|
||||||
propertyMapper.from(v1::getAlipayPublicCertPath).as(this::getFileAbsolutePath).to(certAlipayRequest::setAlipayPublicCertPath);
|
propertyMapper.from(v1::getAlipayPublicCertPath).as(this::getContentFromClassPath).to(certAlipayRequest::setAlipayPublicCertContent);
|
||||||
propertyMapper.from(v1::getAlipayRootCertPath).as(this::getFileAbsolutePath).to(certAlipayRequest::setRootCertPath);
|
propertyMapper.from(v1::getAlipayRootCertPath).as(this::getContentFromClassPath).to(certAlipayRequest::setRootCertContent);
|
||||||
return new DefaultAlipayClient(certAlipayRequest);
|
return new DefaultAlipayClient(certAlipayRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getFileAbsolutePath(String classPath) {
|
|
||||||
try {
|
|
||||||
return new ClassPathResource(classPath).getFile().getAbsolutePath();
|
|
||||||
} catch (IOException e) {
|
|
||||||
log.error("ali pay cert path is not exist ,{}", e.getMessage());
|
|
||||||
throw new PayException("ali pay cert path is not exist");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
private String getContentFromClassPath(String classPath) {
|
||||||
|
ClassPathResource resource = new ClassPathResource(classPath);
|
||||||
|
try (InputStreamReader in = new InputStreamReader(resource.getInputStream())) {
|
||||||
|
return IOUtils.toString(in);
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("ali pay root cert is invalid ,{}", e.getMessage());
|
||||||
|
throw new PayException("ali pay root cert path is invalid");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private String appRSAPrivateKey(String classPath) {
|
private String appRSAPrivateKey(String classPath) {
|
||||||
ClassPathResource resource = new ClassPathResource(classPath);
|
ClassPathResource resource = new ClassPathResource(classPath);
|
||||||
try {
|
try (InputStreamReader inputStreamReader = new InputStreamReader(resource.getInputStream())) {
|
||||||
FileReader in = new FileReader(resource.getFile());
|
try (BufferedReader bufferedReader = new BufferedReader(inputStreamReader)) {
|
||||||
try(BufferedReader bufferedReader = new BufferedReader(in)){
|
|
||||||
return bufferedReader.readLine();
|
return bufferedReader.readLine();
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@@ -87,5 +90,4 @@ public class AliPayConfiguration {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ public class WechatPayConfiguration {
|
|||||||
WechatPayProperties.V3 v3 = v3Map.get(tenantId);
|
WechatPayProperties.V3 v3 = v3Map.get(tenantId);
|
||||||
String certPath = v3.getCertPath();
|
String certPath = v3.getCertPath();
|
||||||
String mchId = v3.getMchId();
|
String mchId = v3.getMchId();
|
||||||
WechatMetaBean wechatMetaBean = keyPairFactory.createPKCS12(certPath, CERT_ALIAS, mchId);
|
WechatMetaBean wechatMetaBean = keyPairFactory.initWechatMetaBean(certPath, CERT_ALIAS, mchId);
|
||||||
wechatMetaBean.setV3(v3);
|
wechatMetaBean.setV3(v3);
|
||||||
wechatMetaBean.setTenantId(tenantId);
|
wechatMetaBean.setTenantId(tenantId);
|
||||||
container.addWechatMeta(tenantId, wechatMetaBean);
|
container.addWechatMeta(tenantId, wechatMetaBean);
|
||||||
|
|||||||
@@ -29,64 +29,42 @@ public enum CouponBgColor {
|
|||||||
/**
|
/**
|
||||||
* Color 010 coupon bg color.
|
* Color 010 coupon bg color.
|
||||||
*/
|
*/
|
||||||
COLOR010("#63B359"),
|
Color010,
|
||||||
/**
|
/**
|
||||||
* Color 020 coupon bg color.
|
* Color 020 coupon bg color.
|
||||||
*/
|
*/
|
||||||
COLOR020("#2C9F67"),
|
Color020,
|
||||||
/**
|
/**
|
||||||
* Color 030 coupon bg color.
|
* Color 030 coupon bg color.
|
||||||
*/
|
*/
|
||||||
COLOR030("#509FC9"),
|
Color030,
|
||||||
/**
|
/**
|
||||||
* Color 040 coupon bg color.
|
* Color 040 coupon bg color.
|
||||||
*/
|
*/
|
||||||
COLOR040("#5885CF"),
|
Color040,
|
||||||
/**
|
/**
|
||||||
* Color 050 coupon bg color.
|
* Color 050 coupon bg color.
|
||||||
*/
|
*/
|
||||||
COLOR050("#9062C0"),
|
Color050,
|
||||||
/**
|
/**
|
||||||
* Color 060 coupon bg color.
|
* Color 060 coupon bg color.
|
||||||
*/
|
*/
|
||||||
COLOR060("#D09A45"),
|
Color060,
|
||||||
/**
|
/**
|
||||||
* Color 070 coupon bg color.
|
* Color 070 coupon bg color.
|
||||||
*/
|
*/
|
||||||
COLOR070("#E4B138"),
|
Color070,
|
||||||
/**
|
/**
|
||||||
* Color 080 coupon bg color.
|
* Color 080 coupon bg color.
|
||||||
*/
|
*/
|
||||||
COLOR080("#EE903C"),
|
Color080,
|
||||||
/**
|
/**
|
||||||
* Color 090 coupon bg color.
|
* Color 090 coupon bg color.
|
||||||
*/
|
*/
|
||||||
COLOR090("#DD6549"),
|
Color090,
|
||||||
/**
|
/**
|
||||||
* Color 100 coupon bg color.
|
* Color 100 coupon bg color.
|
||||||
*/
|
*/
|
||||||
COLOR100("#CC463D");
|
Color100
|
||||||
|
|
||||||
/**
|
|
||||||
* The Color.
|
|
||||||
*/
|
|
||||||
private final String color;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiates a new Coupon bg color.
|
|
||||||
*
|
|
||||||
* @param color the color
|
|
||||||
*/
|
|
||||||
CouponBgColor(String color) {
|
|
||||||
this.color = color;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Color string.
|
|
||||||
*
|
|
||||||
* @return the string
|
|
||||||
*/
|
|
||||||
public String color() {
|
|
||||||
return this.color;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -431,7 +431,7 @@ public enum WechatPayV3Type {
|
|||||||
*
|
*
|
||||||
* @since 1.0.4.RELEASES
|
* @since 1.0.4.RELEASES
|
||||||
*/
|
*/
|
||||||
MARKETING_BUSI_FAVOR_UPDATE(HttpMethod.POST, "%s/v3/marketing/busifavor/stocks/{stock_id}"),
|
MARKETING_BUSI_FAVOR_UPDATE(HttpMethod.PATCH, "%s/v3/marketing/busifavor/stocks/{stock_id}"),
|
||||||
/**
|
/**
|
||||||
* 申请退券API.
|
* 申请退券API.
|
||||||
*
|
*
|
||||||
@@ -486,7 +486,57 @@ public enum WechatPayV3Type {
|
|||||||
*
|
*
|
||||||
* @since 1.0.6.RELEASES
|
* @since 1.0.6.RELEASES
|
||||||
*/
|
*/
|
||||||
BATCH_TRANSFER_DOWNLOAD_BILL(HttpMethod.GET, "%s/v3/transfer/bill-receipt/{out_batch_no}");
|
BATCH_TRANSFER_DOWNLOAD_BILL(HttpMethod.GET, "%s/v3/transfer/bill-receipt/{out_batch_no}"),
|
||||||
|
|
||||||
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务商APP下单API.
|
||||||
|
*
|
||||||
|
* @since 1.0.8.RELEASES
|
||||||
|
*/
|
||||||
|
APP_PARTNER(HttpMethod.POST, "%s/v3/pay/partner/transactions/app"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信公众号支付或者小程序支付.
|
||||||
|
*
|
||||||
|
* @since 1.0.8.RELEASE
|
||||||
|
*/
|
||||||
|
JSAPI_PARTNER(HttpMethod.POST, "%s/v3/pay/partner/transactions/jsapi"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信扫码支付.
|
||||||
|
*
|
||||||
|
* @since 1.0.8.RELEASE
|
||||||
|
*/
|
||||||
|
NATIVE_PARTNER(HttpMethod.POST, "%s/v3/pay/partner/transactions/native"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* H5支付.
|
||||||
|
*
|
||||||
|
* @since 1.0.8.RELEASE
|
||||||
|
*/
|
||||||
|
MWEB_PARTNER(HttpMethod.POST, "%s/v3/pay/partner/transactions/h5"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关闭订单.
|
||||||
|
*
|
||||||
|
* @since 1.0.0.RELEASE
|
||||||
|
*/
|
||||||
|
CLOSE_PARTNER(HttpMethod.POST, "%s/v3/pay/partner/transactions/out-trade-no/{out_trade_no}/close"),
|
||||||
|
/**
|
||||||
|
* 微信支付订单号查询API.
|
||||||
|
*
|
||||||
|
* @since 1.0.0.RELEASE
|
||||||
|
*/
|
||||||
|
TRANSACTION_TRANSACTION_ID_PARTNER(HttpMethod.GET, "%s/v3/pay/partner/transactions/id/{transaction_id}"),
|
||||||
|
/**
|
||||||
|
* 商户订单号查询API.
|
||||||
|
*
|
||||||
|
* @since 1.0.0.RELEASE
|
||||||
|
*/
|
||||||
|
TRANSACTION_OUT_TRADE_NO_PARTNER(HttpMethod.GET, "%s/v3/pay/partner/transactions/out-trade-no/{out_trade_no}"),
|
||||||
|
;
|
||||||
/**
|
/**
|
||||||
* The Pattern.
|
* The Pattern.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -0,0 +1,248 @@
|
|||||||
|
/*
|
||||||
|
* 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.v2;
|
||||||
|
|
||||||
|
import cn.felord.payment.wechat.WechatPayProperties;
|
||||||
|
import cn.felord.payment.wechat.v2.model.BaseModel;
|
||||||
|
import cn.felord.payment.wechat.v2.model.allocation.*;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
|
||||||
|
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.http.HttpMethod;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信支付分账
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* @since 1.0.10.RELEASE
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public class WechatAllocationApi {
|
||||||
|
/**
|
||||||
|
* The constant MAPPER.
|
||||||
|
*/
|
||||||
|
private static final ObjectMapper MAPPER = new ObjectMapper();
|
||||||
|
|
||||||
|
static {
|
||||||
|
MAPPER.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE)
|
||||||
|
.setSerializationInclusion(JsonInclude.Include.NON_NULL)
|
||||||
|
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
|
||||||
|
.configure(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT, true)
|
||||||
|
.registerModule(new JavaTimeModule());
|
||||||
|
}
|
||||||
|
|
||||||
|
private final WechatV2Client wechatV2Client;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new Wechat allocation api.
|
||||||
|
*
|
||||||
|
* @param wechatV2Client the wechat v 2 client
|
||||||
|
*/
|
||||||
|
public WechatAllocationApi(WechatV2Client wechatV2Client) {
|
||||||
|
this.wechatV2Client = wechatV2Client;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请求单次分账
|
||||||
|
*
|
||||||
|
* @param profitSharingModel the profit sharing model
|
||||||
|
* @return json node
|
||||||
|
*/
|
||||||
|
@SneakyThrows
|
||||||
|
public JsonNode profitSharing(ProfitSharingModel profitSharingModel) {
|
||||||
|
ProfitSharingSModel profitSharingSModel = new ProfitSharingSModel();
|
||||||
|
List<Receiver> receivers = profitSharingModel.getReceivers();
|
||||||
|
profitSharingSModel.setReceivers(MAPPER.writeValueAsString(receivers));
|
||||||
|
|
||||||
|
WechatPayProperties.V3 v3 = wechatV2Client.getWechatMetaBean().getV3();
|
||||||
|
profitSharingSModel.setAppid(v3.getAppId());
|
||||||
|
profitSharingSModel.setMchId(v3.getMchId());
|
||||||
|
|
||||||
|
profitSharingSModel.setTransactionId(profitSharingModel.getTransactionId());
|
||||||
|
profitSharingSModel.setOutOrderNo(profitSharingModel.getOutOrderNo());
|
||||||
|
|
||||||
|
profitSharingSModel.certPath(v3.getCertPath());
|
||||||
|
profitSharingSModel.signType(BaseModel.HMAC_SHA256);
|
||||||
|
return wechatV2Client.wechatPayRequest(profitSharingSModel,
|
||||||
|
HttpMethod.POST,
|
||||||
|
"https://api.mch.weixin.qq.com/secapi/pay/profitsharing");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请求单次分账
|
||||||
|
*
|
||||||
|
* @param multiProfitSharingModel the multi profit sharing model
|
||||||
|
* @return json node
|
||||||
|
*/
|
||||||
|
@SneakyThrows
|
||||||
|
public JsonNode multiProfitSharing(MultiProfitSharingModel multiProfitSharingModel) {
|
||||||
|
MultiProfitSharingSModel multiProfitSharingSModel = new MultiProfitSharingSModel();
|
||||||
|
List<Receiver> receivers = multiProfitSharingModel.getReceivers();
|
||||||
|
multiProfitSharingSModel.setReceivers(MAPPER.writeValueAsString(receivers));
|
||||||
|
|
||||||
|
WechatPayProperties.V3 v3 = wechatV2Client.getWechatMetaBean().getV3();
|
||||||
|
multiProfitSharingSModel.setAppid(v3.getAppId());
|
||||||
|
multiProfitSharingSModel.setMchId(v3.getMchId());
|
||||||
|
|
||||||
|
multiProfitSharingSModel.setTransactionId(multiProfitSharingModel.getTransactionId());
|
||||||
|
multiProfitSharingSModel.setOutOrderNo(multiProfitSharingModel.getOutOrderNo());
|
||||||
|
|
||||||
|
multiProfitSharingSModel.certPath(v3.getCertPath());
|
||||||
|
multiProfitSharingSModel.signType(BaseModel.HMAC_SHA256);
|
||||||
|
return wechatV2Client.wechatPayRequest(multiProfitSharingSModel,
|
||||||
|
HttpMethod.POST,
|
||||||
|
"https://api.mch.weixin.qq.com/secapi/pay/multiprofitsharing");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询分账结果
|
||||||
|
*
|
||||||
|
* @param profitSharingQueryModel the profit sharing query model
|
||||||
|
* @return json node
|
||||||
|
*/
|
||||||
|
public JsonNode profitSharingQuery(ProfitSharingQueryModel profitSharingQueryModel) {
|
||||||
|
WechatPayProperties.V3 v3 = wechatV2Client.getWechatMetaBean().getV3();
|
||||||
|
profitSharingQueryModel.setMchId(v3.getMchId());
|
||||||
|
profitSharingQueryModel.certPath(v3.getCertPath());
|
||||||
|
profitSharingQueryModel.signType(BaseModel.HMAC_SHA256);
|
||||||
|
return wechatV2Client.wechatPayRequest(profitSharingQueryModel,
|
||||||
|
HttpMethod.POST,
|
||||||
|
"https://api.mch.weixin.qq.com/pay/profitsharingquery");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加分账接收方
|
||||||
|
*
|
||||||
|
* @param profitSharingAddReceiverModel the profit sharing add receiver model
|
||||||
|
* @return json node
|
||||||
|
*/
|
||||||
|
@SneakyThrows
|
||||||
|
public JsonNode profitSharingAddReceiver(ProfitSharingAddReceiverModel profitSharingAddReceiverModel) {
|
||||||
|
ProfitSharingAddReceiverSModel profitSharingAddReceiverSModel = new ProfitSharingAddReceiverSModel();
|
||||||
|
ProfitSharingAddReceiverModel.Receiver receiver = profitSharingAddReceiverModel.getReceiver();
|
||||||
|
profitSharingAddReceiverSModel.setReceiver(MAPPER.writeValueAsString(receiver));
|
||||||
|
|
||||||
|
WechatPayProperties.V3 v3 = wechatV2Client.getWechatMetaBean().getV3();
|
||||||
|
profitSharingAddReceiverSModel.setAppid(v3.getAppId());
|
||||||
|
profitSharingAddReceiverSModel.setMchId(v3.getMchId());
|
||||||
|
|
||||||
|
profitSharingAddReceiverSModel.certPath(v3.getCertPath());
|
||||||
|
profitSharingAddReceiverSModel.signType(BaseModel.HMAC_SHA256);
|
||||||
|
return wechatV2Client.wechatPayRequest(profitSharingAddReceiverSModel,
|
||||||
|
HttpMethod.POST,
|
||||||
|
"https://api.mch.weixin.qq.com/pay/profitsharingaddreceiver");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除分账接收方
|
||||||
|
*
|
||||||
|
* @param profitSharingRemoveReceiverModel the profit sharing remove receiver model
|
||||||
|
* @return json node
|
||||||
|
*/
|
||||||
|
@SneakyThrows
|
||||||
|
public JsonNode profitSharingRemoveReceiver(ProfitSharingRemoveReceiverModel profitSharingRemoveReceiverModel) {
|
||||||
|
ProfitSharingRemoveReceiverSModel profitSharingRemoveReceiverSModel = new ProfitSharingRemoveReceiverSModel();
|
||||||
|
ProfitSharingRemoveReceiverModel.Receiver receiver = profitSharingRemoveReceiverModel.getReceiver();
|
||||||
|
profitSharingRemoveReceiverSModel.setReceiver(MAPPER.writeValueAsString(receiver));
|
||||||
|
|
||||||
|
WechatPayProperties.V3 v3 = wechatV2Client.getWechatMetaBean().getV3();
|
||||||
|
profitSharingRemoveReceiverSModel.setAppid(v3.getAppId());
|
||||||
|
profitSharingRemoveReceiverSModel.setMchId(v3.getMchId());
|
||||||
|
|
||||||
|
profitSharingRemoveReceiverSModel.certPath(v3.getCertPath());
|
||||||
|
profitSharingRemoveReceiverSModel.signType(BaseModel.HMAC_SHA256);
|
||||||
|
return wechatV2Client.wechatPayRequest(profitSharingRemoveReceiverSModel,
|
||||||
|
HttpMethod.POST,
|
||||||
|
"https://api.mch.weixin.qq.com/pay/profitsharingremovereceiver");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 完结分账
|
||||||
|
*
|
||||||
|
* @param profitSharingFinishModel the profit sharing finish model
|
||||||
|
* @return json node
|
||||||
|
*/
|
||||||
|
public JsonNode profitSharingFinish(ProfitSharingFinishModel profitSharingFinishModel) {
|
||||||
|
WechatPayProperties.V3 v3 = wechatV2Client.getWechatMetaBean().getV3();
|
||||||
|
profitSharingFinishModel.setAppid(v3.getAppId());
|
||||||
|
profitSharingFinishModel.setMchId(v3.getMchId());
|
||||||
|
profitSharingFinishModel.certPath(v3.getCertPath());
|
||||||
|
profitSharingFinishModel.signType(BaseModel.HMAC_SHA256);
|
||||||
|
return wechatV2Client.wechatPayRequest(profitSharingFinishModel,
|
||||||
|
HttpMethod.POST,
|
||||||
|
"https://api.mch.weixin.qq.com/secapi/pay/profitsharingfinish");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询订单待分账金额
|
||||||
|
*
|
||||||
|
* @param profitSharingOrderAmountQueryModel the profit sharing order amount query model
|
||||||
|
* @return json node
|
||||||
|
*/
|
||||||
|
public JsonNode profitSharingOrderAmountQuery(ProfitSharingOrderAmountQueryModel profitSharingOrderAmountQueryModel) {
|
||||||
|
WechatPayProperties.V3 v3 = wechatV2Client.getWechatMetaBean().getV3();
|
||||||
|
profitSharingOrderAmountQueryModel.setMchId(v3.getMchId());
|
||||||
|
profitSharingOrderAmountQueryModel.certPath(v3.getCertPath());
|
||||||
|
profitSharingOrderAmountQueryModel.signType(BaseModel.HMAC_SHA256);
|
||||||
|
return wechatV2Client.wechatPayRequest(profitSharingOrderAmountQueryModel,
|
||||||
|
HttpMethod.POST,
|
||||||
|
"https://api.mch.weixin.qq.com/pay/profitsharingorderamountquery");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分账回退
|
||||||
|
*
|
||||||
|
* @param profitSharingReturnModel the profit sharing return model
|
||||||
|
* @return json node
|
||||||
|
*/
|
||||||
|
public JsonNode profitSharingReturn(ProfitSharingReturnModel profitSharingReturnModel) {
|
||||||
|
WechatPayProperties.V3 v3 = wechatV2Client.getWechatMetaBean().getV3();
|
||||||
|
profitSharingReturnModel.setAppid(v3.getAppId());
|
||||||
|
profitSharingReturnModel.setMchId(v3.getMchId());
|
||||||
|
profitSharingReturnModel.certPath(v3.getCertPath());
|
||||||
|
profitSharingReturnModel.signType(BaseModel.HMAC_SHA256);
|
||||||
|
return wechatV2Client.wechatPayRequest(profitSharingReturnModel,
|
||||||
|
HttpMethod.POST,
|
||||||
|
"https://api.mch.weixin.qq.com/secapi/pay/profitsharingreturn");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 回退结果查询
|
||||||
|
*
|
||||||
|
* @param profitSharingReturnQueryModel the profit sharing return query model
|
||||||
|
* @return json node
|
||||||
|
*/
|
||||||
|
public JsonNode profitSharingReturnQuery(ProfitSharingReturnQueryModel profitSharingReturnQueryModel) {
|
||||||
|
WechatPayProperties.V3 v3 = wechatV2Client.getWechatMetaBean().getV3();
|
||||||
|
profitSharingReturnQueryModel.setAppid(v3.getAppId());
|
||||||
|
profitSharingReturnQueryModel.setMchId(v3.getMchId());
|
||||||
|
profitSharingReturnQueryModel.certPath(v3.getCertPath());
|
||||||
|
profitSharingReturnQueryModel.signType(BaseModel.HMAC_SHA256);
|
||||||
|
return wechatV2Client.wechatPayRequest(profitSharingReturnQueryModel,
|
||||||
|
HttpMethod.POST,
|
||||||
|
"https://api.mch.weixin.qq.com/pay/profitsharingreturnquery");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -48,6 +48,8 @@ import org.springframework.util.IdGenerator;
|
|||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
import org.springframework.web.util.UriComponentsBuilder;
|
import org.springframework.web.util.UriComponentsBuilder;
|
||||||
|
|
||||||
|
import javax.crypto.Mac;
|
||||||
|
import javax.crypto.spec.SecretKeySpec;
|
||||||
import javax.net.ssl.HostnameVerifier;
|
import javax.net.ssl.HostnameVerifier;
|
||||||
import javax.net.ssl.SSLContext;
|
import javax.net.ssl.SSLContext;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -63,6 +65,7 @@ import java.security.cert.CertificateException;
|
|||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
public abstract class BaseModel {
|
public abstract class BaseModel {
|
||||||
|
public static final String HMAC_SHA256="HMAC-SHA256";
|
||||||
private static final XmlMapper XML_MAPPER = new XmlMapper();
|
private static final XmlMapper XML_MAPPER = new XmlMapper();
|
||||||
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
|
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
|
||||||
|
|
||||||
@@ -84,13 +87,27 @@ public abstract class BaseModel {
|
|||||||
private String sign;
|
private String sign;
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
private String appSecret;
|
private String appSecret;
|
||||||
|
@JsonIgnore
|
||||||
|
private String certPath;
|
||||||
|
@JsonIgnore
|
||||||
|
private String signType;
|
||||||
|
|
||||||
public BaseModel appSecret(String appSecret) {
|
public BaseModel appSecret(String appSecret) {
|
||||||
this.appSecret = appSecret;
|
this.appSecret = appSecret;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BaseModel certPath(String certPath) {
|
||||||
|
this.certPath = certPath;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public BaseModel signType(String signType) {
|
||||||
|
this.signType = signType;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Xml string.
|
* Xml string.
|
||||||
*
|
*
|
||||||
@@ -99,7 +116,11 @@ public abstract class BaseModel {
|
|||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
private String xml() {
|
private String xml() {
|
||||||
String link = link(this);
|
String link = link(this);
|
||||||
this.sign = this.md5(link);
|
if (HMAC_SHA256.equals(signType)) {
|
||||||
|
this.sign = this.hmacSha256(link);
|
||||||
|
} else {
|
||||||
|
this.sign = this.md5(link);
|
||||||
|
}
|
||||||
return XML_MAPPER.writer()
|
return XML_MAPPER.writer()
|
||||||
.withRootName("xml")
|
.withRootName("xml")
|
||||||
.writeValueAsString(this);
|
.writeValueAsString(this);
|
||||||
@@ -120,6 +141,21 @@ public abstract class BaseModel {
|
|||||||
return Hex.toHexString(md5Bytes).toUpperCase();
|
return Hex.toHexString(md5Bytes).toUpperCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* hmacSha256.
|
||||||
|
*
|
||||||
|
* @param src the src
|
||||||
|
* @return the string
|
||||||
|
*/
|
||||||
|
@SneakyThrows
|
||||||
|
private String hmacSha256(String src) {
|
||||||
|
Mac sha256_HMAC = Mac.getInstance("HmacSHA256");
|
||||||
|
SecretKeySpec secret_key = new SecretKeySpec(appSecret.getBytes(),"HmacSHA256");
|
||||||
|
sha256_HMAC.init(secret_key);
|
||||||
|
byte[] bytes = sha256_HMAC.doFinal(src.getBytes(StandardCharsets.UTF_8));
|
||||||
|
return Hex.toHexString(bytes).toUpperCase();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 按照格式拼接参数以生成签名
|
* 按照格式拼接参数以生成签名
|
||||||
*
|
*
|
||||||
@@ -130,14 +166,13 @@ public abstract class BaseModel {
|
|||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
private <T> String link(T t) {
|
private <T> String link(T t) {
|
||||||
Assert.hasText(appSecret, "wechat pay appSecret is required");
|
Assert.hasText(appSecret, "wechat pay appSecret is required");
|
||||||
return OBJECT_MAPPER
|
String link = OBJECT_MAPPER
|
||||||
.writer()
|
.writer()
|
||||||
.writeValueAsString(t)
|
.writeValueAsString(t)
|
||||||
.replaceAll("\":\"", "=")
|
.replaceAll("\":\"", "=")
|
||||||
.replaceAll("\",\"", "&")
|
.replaceAll("\",\"", "&")
|
||||||
.replaceAll("\\{\"", "")
|
.replaceAll("\\\\\"", "\"");
|
||||||
.replaceAll("\"}", "")
|
return link.substring(2, link.length() - 2).concat("&key=").concat(this.appSecret);
|
||||||
.concat("&key=").concat(this.appSecret);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -164,7 +199,7 @@ public abstract class BaseModel {
|
|||||||
private RestTemplate getRestTemplateClientAuthentication(String mchId)
|
private RestTemplate getRestTemplateClientAuthentication(String mchId)
|
||||||
throws IOException, UnrecoverableKeyException, CertificateException, NoSuchAlgorithmException,
|
throws IOException, UnrecoverableKeyException, CertificateException, NoSuchAlgorithmException,
|
||||||
KeyStoreException, KeyManagementException {
|
KeyStoreException, KeyManagementException {
|
||||||
ClassPathResource resource = new ClassPathResource("wechat/apiclient_cert.p12");
|
ClassPathResource resource = new ClassPathResource(certPath == null ? "wechat/apiclient_cert.p12" : certPath);
|
||||||
|
|
||||||
char[] pem = mchId.toCharArray();
|
char[] pem = mchId.toCharArray();
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* 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.v2.model.allocation;
|
||||||
|
|
||||||
|
import cn.felord.payment.wechat.v2.model.BaseModel;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type Base profit sharing model.
|
||||||
|
*
|
||||||
|
* @author wangzecheng
|
||||||
|
* @since 1.0.10.RELEASE
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
public class BaseProfitSharingModel extends BaseModel {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户号.
|
||||||
|
* <p>
|
||||||
|
* 微信支付分配的商户号
|
||||||
|
*/
|
||||||
|
private String mchId;
|
||||||
|
private String appid;
|
||||||
|
private String transactionId;
|
||||||
|
private String outOrderNo;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* 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.v2.model.allocation;
|
||||||
|
|
||||||
|
import cn.felord.payment.wechat.v2.model.BaseModel;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type Base profit sharing receiver model.
|
||||||
|
*
|
||||||
|
* @author wangzecheng
|
||||||
|
* @since 1.0.10.RELEASE
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
public class BaseProfitSharingReceiverModel extends BaseModel {
|
||||||
|
/**
|
||||||
|
* 商户号.
|
||||||
|
* <p>
|
||||||
|
* 微信支付分配的商户号
|
||||||
|
*/
|
||||||
|
private String mchId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公众账号ID.
|
||||||
|
* <p>
|
||||||
|
* 微信分配的公众账号ID
|
||||||
|
*/
|
||||||
|
private String appid;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* 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.v2.model.allocation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type Multi profit sharing model.
|
||||||
|
*
|
||||||
|
* @author wangzecheng
|
||||||
|
* @since 1.0.10.RELEASE
|
||||||
|
*/
|
||||||
|
public class MultiProfitSharingModel extends ProfitSharingModel {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* 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.v2.model.allocation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type Multi profit sharing s model.
|
||||||
|
*
|
||||||
|
* @author wangzecheng
|
||||||
|
* @since 1.0.10.RELEASE
|
||||||
|
*/
|
||||||
|
public class MultiProfitSharingSModel extends ProfitSharingSModel {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
/*
|
||||||
|
* 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.v2.model.allocation;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type Profit sharing add receiver model.
|
||||||
|
*
|
||||||
|
* @author wangzecheng
|
||||||
|
* @since 1.0.10.RELEASE
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
public class ProfitSharingAddReceiverModel extends BaseProfitSharingReceiverModel {
|
||||||
|
|
||||||
|
private Receiver receiver;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type Receiver.
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public static class Receiver {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分账接收方类型.
|
||||||
|
* <p>
|
||||||
|
* MERCHANT_ID:商户号(mch_id或者sub_mch_id)
|
||||||
|
* PERSONAL_OPENID:个人openid
|
||||||
|
*/
|
||||||
|
private Type type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分账接收方帐号.
|
||||||
|
* <p>
|
||||||
|
* 类型是MERCHANT_ID时,是商户号(mch_id或者sub_mch_id)
|
||||||
|
* 类型是PERSONAL_OPENID时,是个人openid
|
||||||
|
*/
|
||||||
|
private String account;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分账接收方全称.
|
||||||
|
* <p>
|
||||||
|
* 分账接收方类型是MERCHANT_ID时,是商户全称(必传),当商户是小微商户或个体户时,是开户人姓名
|
||||||
|
* 分账接收方类型是PERSONAL_OPENID时,是个人姓名(选传,传则校验)
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 与分账方的关系类型.
|
||||||
|
* <p>
|
||||||
|
* 子商户与接收方的关系。
|
||||||
|
* 本字段值为枚举:
|
||||||
|
* SERVICE_PROVIDER:服务商
|
||||||
|
* STORE:门店
|
||||||
|
* STAFF:员工
|
||||||
|
* STORE_OWNER:店主
|
||||||
|
* PARTNER:合作伙伴
|
||||||
|
* HEADQUARTER:总部
|
||||||
|
* BRAND:品牌方
|
||||||
|
* DISTRIBUTOR:分销商
|
||||||
|
* USER:用户
|
||||||
|
* SUPPLIER:供应商
|
||||||
|
* CUSTOM:自定义
|
||||||
|
*/
|
||||||
|
private RelationType relationType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义的分账关系.
|
||||||
|
* <p>
|
||||||
|
* 子商户与接收方具体的关系,本字段最多10个字。
|
||||||
|
* 当字段relation_type的值为CUSTOM时,本字段必填
|
||||||
|
* 当字段relation_type的值不为CUSTOM时,本字段无需填写
|
||||||
|
*/
|
||||||
|
private String customRelation;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* 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.v2.model.allocation;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type Profit sharing add receiver s model.
|
||||||
|
*
|
||||||
|
* @author wangzecheng
|
||||||
|
* @since 1.0.10.RELEASE
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
public class ProfitSharingAddReceiverSModel extends BaseProfitSharingReceiverModel {
|
||||||
|
|
||||||
|
private String receiver;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
/*
|
||||||
|
* 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.v2.model.allocation;
|
||||||
|
|
||||||
|
import cn.felord.payment.wechat.v2.model.BaseModel;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type Profit sharing finish model.
|
||||||
|
*
|
||||||
|
* @author wangzecheng
|
||||||
|
* @since 1.0.10.RELEASE
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
public class ProfitSharingFinishModel extends BaseModel {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户号.
|
||||||
|
* <p>
|
||||||
|
* 微信支付分配的商户号
|
||||||
|
*/
|
||||||
|
private String mchId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公众账号ID.
|
||||||
|
* <p>
|
||||||
|
* 微信分配的公众账号ID
|
||||||
|
*/
|
||||||
|
private String appid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信订单号.
|
||||||
|
* <p>
|
||||||
|
* 微信支付订单号
|
||||||
|
*/
|
||||||
|
private String transactionId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户分账单号.
|
||||||
|
* <p>
|
||||||
|
* 查询分账结果,输入申请分账时的商户分账单号; 查询分账完结执行的结果,输入发起分账完结时的商户分账单号
|
||||||
|
*/
|
||||||
|
private String outOrderNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分账完结描述.
|
||||||
|
* <p>
|
||||||
|
* 分账完结的原因描述
|
||||||
|
*/
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* 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.v2.model.allocation;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单次分账请求按照传入的分账接收方账号和资金进行分账,同时会将订单剩余的待分账金额解冻给本商户。
|
||||||
|
* 故操作成功后,订单不能再进行分账,也不能进行分账完结。
|
||||||
|
*
|
||||||
|
* @author wangzecheng
|
||||||
|
* @since 1.0.10.RELEASE
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
public class ProfitSharingModel extends BaseProfitSharingModel {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分账接收方列表,不超过50个json对象,不能设置分账方作为分账接受方
|
||||||
|
*/
|
||||||
|
private List<Receiver> receivers;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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.v2.model.allocation;
|
||||||
|
|
||||||
|
import cn.felord.payment.wechat.v2.model.BaseModel;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type Profit sharing order amount query model.
|
||||||
|
*
|
||||||
|
* @author wangzecheng
|
||||||
|
* @since 1.0.10.RELEASE
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
public class ProfitSharingOrderAmountQueryModel extends BaseModel {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户号.
|
||||||
|
* <p>
|
||||||
|
* 微信支付分配的商户号
|
||||||
|
*/
|
||||||
|
private String mchId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信订单号.
|
||||||
|
* <p>
|
||||||
|
* 微信支付订单号
|
||||||
|
*/
|
||||||
|
private String transactionId;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
* 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.v2.model.allocation;
|
||||||
|
|
||||||
|
import cn.felord.payment.wechat.v2.model.BaseModel;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type Profit sharing query model.
|
||||||
|
*
|
||||||
|
* @author wangzecheng
|
||||||
|
* @since 1.0.10.RELEASE
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
public class ProfitSharingQueryModel extends BaseModel {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户号.
|
||||||
|
* <p>
|
||||||
|
* 微信支付分配的商户号
|
||||||
|
*/
|
||||||
|
private String mchId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信订单号.
|
||||||
|
* <p>
|
||||||
|
* 微信支付订单号
|
||||||
|
*/
|
||||||
|
private String transactionId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户分账单号.
|
||||||
|
* <p>
|
||||||
|
* 查询分账结果,输入申请分账时的商户分账单号; 查询分账完结执行的结果,输入发起分账完结时的商户分账单号
|
||||||
|
*/
|
||||||
|
private String outOrderNo;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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.v2.model.allocation;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type Profit sharing remove receiver model.
|
||||||
|
*
|
||||||
|
* @author wangzecheng
|
||||||
|
* @since 1.0.10.RELEASE
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
public class ProfitSharingRemoveReceiverModel extends BaseProfitSharingReceiverModel {
|
||||||
|
|
||||||
|
private Receiver receiver;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type Receiver.
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public static class Receiver {
|
||||||
|
|
||||||
|
private Type type;
|
||||||
|
private String account;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* 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.v2.model.allocation;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type Profit sharing remove receiver s model.
|
||||||
|
*
|
||||||
|
* @author wangzecheng
|
||||||
|
* @since 1.0.10.RELEASE
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
public class ProfitSharingRemoveReceiverSModel extends BaseProfitSharingReceiverModel {
|
||||||
|
|
||||||
|
private String receiver;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
* 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.v2.model.allocation;
|
||||||
|
|
||||||
|
import cn.felord.payment.wechat.v2.model.BaseModel;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type Profit sharing return model.
|
||||||
|
*
|
||||||
|
* @author wangzecheng
|
||||||
|
* @since 1.0.10.RELEASE
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
public class ProfitSharingReturnModel extends BaseModel {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户号.
|
||||||
|
* <p>
|
||||||
|
* 微信支付分配的商户号
|
||||||
|
*/
|
||||||
|
private String mchId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公众账号ID.
|
||||||
|
* <p>
|
||||||
|
* 微信分配的公众账号ID
|
||||||
|
*/
|
||||||
|
private String appid;
|
||||||
|
private String orderId;
|
||||||
|
private String outOrderNo;
|
||||||
|
private String outReturnNo;
|
||||||
|
private String returnAccountType;
|
||||||
|
private String returnAccount;
|
||||||
|
private String returnAmount;
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
/*
|
||||||
|
* 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.v2.model.allocation;
|
||||||
|
|
||||||
|
import cn.felord.payment.wechat.v2.model.BaseModel;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type Profit sharing return query model.
|
||||||
|
*
|
||||||
|
* @author wangzecheng
|
||||||
|
* @since 1.0.10.RELEASE
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
public class ProfitSharingReturnQueryModel extends BaseModel {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户号.
|
||||||
|
* <p>
|
||||||
|
* 微信支付分配的商户号
|
||||||
|
*/
|
||||||
|
private String mchId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公众账号ID.
|
||||||
|
* <p>
|
||||||
|
* 微信分配的公众账号ID
|
||||||
|
*/
|
||||||
|
private String appid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信分账订单号.
|
||||||
|
* <p>
|
||||||
|
* 原发起分账请求时,微信返回的微信分账单号,与商户分账单号一一对应。
|
||||||
|
* 微信分账单号与商户分账单号二选一填写
|
||||||
|
*/
|
||||||
|
private String orderId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户分账单号.
|
||||||
|
* <p>
|
||||||
|
* 原发起分账请求时使用的商户系统内部的分账单号。
|
||||||
|
* 微信分账单号与商户分账单号二选一填写
|
||||||
|
*/
|
||||||
|
private String outOrderNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户回退单号.
|
||||||
|
* <p>
|
||||||
|
* 调用回退接口提供的商户系统内部的回退单号
|
||||||
|
*/
|
||||||
|
private String outReturnNo;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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.v2.model.allocation;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type Profit sharing s model.
|
||||||
|
*
|
||||||
|
* @author wangzecheng
|
||||||
|
* @since 1.0.10.RELEASE
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
public class ProfitSharingSModel extends BaseProfitSharingModel {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分账接收方列表,不超过50个json对象,不能设置分账方作为分账接受方。
|
||||||
|
*/
|
||||||
|
private String receivers;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
/*
|
||||||
|
* 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.v2.model.allocation;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type Receiver.
|
||||||
|
*
|
||||||
|
* @author wangzecheng
|
||||||
|
* @since 1.0.10.RELEASE
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class Receiver {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分账接收方类型.
|
||||||
|
* <p>
|
||||||
|
* MERCHANT_ID:商户号(mch_id或者sub_mch_id)
|
||||||
|
* PERSONAL_OPENID:个人openid
|
||||||
|
*/
|
||||||
|
private Type type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分账接收方帐号.
|
||||||
|
* <p>
|
||||||
|
* 类型是MERCHANT_ID时,是商户号(mch_id或者sub_mch_id)
|
||||||
|
* 类型是PERSONAL_OPENID时,是个人openid
|
||||||
|
*/
|
||||||
|
private String account;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分账金额.
|
||||||
|
* <p>
|
||||||
|
* 单位为分,只能为整数,不能超过原订单支付金额及最大分账比例金额
|
||||||
|
*/
|
||||||
|
private Integer amount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分账描述.
|
||||||
|
* <p>
|
||||||
|
* 分账的原因描述,分账账单中需要体现
|
||||||
|
*/
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分账个人接收方姓名.
|
||||||
|
* <p>
|
||||||
|
* 可选项,在接收方类型为个人的时可选填,若有值,会检查与 name 是否实名匹配,不匹配会拒绝分账请求.
|
||||||
|
* 1、分账接收方类型是PERSONAL_OPENID时,是个人姓名(选传,传则校验)
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
/*
|
||||||
|
* 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.v2.model.allocation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The enum Relation type.
|
||||||
|
* @author wangzecheng
|
||||||
|
* @since 1.0.10.RELEASE
|
||||||
|
*/
|
||||||
|
public enum RelationType {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Service provider relation type.
|
||||||
|
*/
|
||||||
|
SERVICE_PROVIDER,
|
||||||
|
/**
|
||||||
|
* Store relation type.
|
||||||
|
*/
|
||||||
|
STORE,
|
||||||
|
/**
|
||||||
|
* Staff relation type.
|
||||||
|
*/
|
||||||
|
STAFF,
|
||||||
|
/**
|
||||||
|
* Store owner relation type.
|
||||||
|
*/
|
||||||
|
STORE_OWNER,
|
||||||
|
/**
|
||||||
|
* Partner relation type.
|
||||||
|
*/
|
||||||
|
PARTNER,
|
||||||
|
/**
|
||||||
|
* Headquarter relation type.
|
||||||
|
*/
|
||||||
|
HEADQUARTER,
|
||||||
|
/**
|
||||||
|
* Brand relation type.
|
||||||
|
*/
|
||||||
|
BRAND,
|
||||||
|
/**
|
||||||
|
* Distributor relation type.
|
||||||
|
*/
|
||||||
|
DISTRIBUTOR,
|
||||||
|
/**
|
||||||
|
* User relation type.
|
||||||
|
*/
|
||||||
|
USER,
|
||||||
|
/**
|
||||||
|
* Supplier relation type.
|
||||||
|
*/
|
||||||
|
SUPPLIER,
|
||||||
|
/**
|
||||||
|
* Custom relation type.
|
||||||
|
*/
|
||||||
|
CUSTOM
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package cn.felord.payment.wechat.v2.model.allocation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The enum Type.
|
||||||
|
*
|
||||||
|
* @author wangzecheng
|
||||||
|
* @since 1.0.10.RELEASE
|
||||||
|
*/
|
||||||
|
public enum Type {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户号(mch_id或者sub_mch_id)
|
||||||
|
*/
|
||||||
|
MERCHANT_ID,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 个人openid
|
||||||
|
*/
|
||||||
|
PERSONAL_OPENID
|
||||||
|
}
|
||||||
@@ -24,9 +24,9 @@ import cn.felord.payment.wechat.v3.model.FundFlowBillParams;
|
|||||||
import cn.felord.payment.wechat.v3.model.TradeBillParams;
|
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.DeserializationFeature;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
|
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
|
||||||
import com.fasterxml.jackson.databind.module.SimpleModule;
|
|
||||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||||
import org.springframework.core.io.Resource;
|
import org.springframework.core.io.Resource;
|
||||||
import org.springframework.http.HttpHeaders;
|
import org.springframework.http.HttpHeaders;
|
||||||
@@ -88,10 +88,12 @@ public abstract class AbstractApi {
|
|||||||
* @param mapper the mapper
|
* @param mapper the mapper
|
||||||
*/
|
*/
|
||||||
private void applyObjectMapper(ObjectMapper mapper) {
|
private void applyObjectMapper(ObjectMapper mapper) {
|
||||||
mapper.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE);
|
mapper.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE)
|
||||||
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
|
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES,false)
|
||||||
SimpleModule module = new JavaTimeModule();
|
// empty string error
|
||||||
mapper.registerModule(module);
|
.configure(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT, true)
|
||||||
|
.setSerializationInclusion(JsonInclude.Include.NON_NULL)
|
||||||
|
.registerModule(new JavaTimeModule());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -185,10 +187,11 @@ public abstract class AbstractApi {
|
|||||||
return RequestEntity.get(uri).header("Pay-TenantId", tenantId)
|
return RequestEntity.get(uri).header("Pay-TenantId", tenantId)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构建Get请求对象.
|
* 构建Get请求对象.
|
||||||
*
|
*
|
||||||
* @param uri the uri
|
* @param uri the uri
|
||||||
* @param httpHeaders the http headers
|
* @param httpHeaders the http headers
|
||||||
* @return the request entity
|
* @return the request entity
|
||||||
*/
|
*/
|
||||||
@@ -199,6 +202,21 @@ public abstract class AbstractApi {
|
|||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构建Post请求对象.
|
||||||
|
*
|
||||||
|
* @param uri the uri
|
||||||
|
* @param params the params
|
||||||
|
* @return the request entity
|
||||||
|
*/
|
||||||
|
protected RequestEntity<?> Patch(URI uri, Object params) {
|
||||||
|
try {
|
||||||
|
return RequestEntity.patch(uri).header("Pay-TenantId", tenantId)
|
||||||
|
.body(mapper.writeValueAsString(params));
|
||||||
|
} catch (JsonProcessingException e) {
|
||||||
|
throw new PayException("wechat app pay json failed");
|
||||||
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 对账单内容下载,非流文件。
|
* 对账单内容下载,非流文件。
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -22,10 +22,7 @@ package cn.felord.payment.wechat.v3;
|
|||||||
import cn.felord.payment.PayException;
|
import cn.felord.payment.PayException;
|
||||||
import org.springframework.core.io.ClassPathResource;
|
import org.springframework.core.io.ClassPathResource;
|
||||||
|
|
||||||
import java.security.KeyPair;
|
import java.security.*;
|
||||||
import java.security.KeyStore;
|
|
||||||
import java.security.PrivateKey;
|
|
||||||
import java.security.PublicKey;
|
|
||||||
import java.security.cert.X509Certificate;
|
import java.security.cert.X509Certificate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -36,9 +33,16 @@ import java.security.cert.X509Certificate;
|
|||||||
**/
|
**/
|
||||||
public class KeyPairFactory {
|
public class KeyPairFactory {
|
||||||
|
|
||||||
private KeyStore store;
|
private static final KeyStore PKCS12_KEY_STORE;
|
||||||
|
|
||||||
|
static {
|
||||||
|
try {
|
||||||
|
PKCS12_KEY_STORE = KeyStore.getInstance("PKCS12");
|
||||||
|
} catch (KeyStoreException e) {
|
||||||
|
throw new PayException(" wechat pay keystore initialization failed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private final Object lock = new Object();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取公私钥.
|
* 获取公私钥.
|
||||||
@@ -48,23 +52,16 @@ public class KeyPairFactory {
|
|||||||
* @param keyPass password
|
* @param keyPass password
|
||||||
* @return the key pair
|
* @return the key pair
|
||||||
*/
|
*/
|
||||||
public WechatMetaBean createPKCS12(String keyPath, String keyAlias, String keyPass) {
|
public WechatMetaBean initWechatMetaBean(String keyPath, String keyAlias, String keyPass) {
|
||||||
ClassPathResource resource = new ClassPathResource(keyPath);
|
ClassPathResource resource = new ClassPathResource(keyPath);
|
||||||
char[] pem = keyPass.toCharArray();
|
char[] pem = keyPass.toCharArray();
|
||||||
try {
|
try {
|
||||||
synchronized (lock) {
|
PKCS12_KEY_STORE.load(resource.getInputStream(), pem);
|
||||||
if (store == null) {
|
X509Certificate certificate = (X509Certificate) PKCS12_KEY_STORE.getCertificate(keyAlias);
|
||||||
synchronized (lock) {
|
|
||||||
store = KeyStore.getInstance("PKCS12");
|
|
||||||
store.load(resource.getInputStream(), pem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
X509Certificate certificate = (X509Certificate) store.getCertificate(keyAlias);
|
|
||||||
certificate.checkValidity();
|
certificate.checkValidity();
|
||||||
String serialNumber = certificate.getSerialNumber().toString(16).toUpperCase();
|
String serialNumber = certificate.getSerialNumber().toString(16).toUpperCase();
|
||||||
PublicKey publicKey = certificate.getPublicKey();
|
PublicKey publicKey = certificate.getPublicKey();
|
||||||
PrivateKey storeKey = (PrivateKey) store.getKey(keyAlias, pem);
|
PrivateKey storeKey = (PrivateKey) PKCS12_KEY_STORE.getKey(keyAlias, pem);
|
||||||
WechatMetaBean wechatMetaBean = new WechatMetaBean();
|
WechatMetaBean wechatMetaBean = new WechatMetaBean();
|
||||||
wechatMetaBean.setKeyPair(new KeyPair(publicKey, storeKey));
|
wechatMetaBean.setKeyPair(new KeyPair(publicKey, storeKey));
|
||||||
wechatMetaBean.setSerialNumber(serialNumber);
|
wechatMetaBean.setSerialNumber(serialNumber);
|
||||||
|
|||||||
@@ -120,6 +120,7 @@ public class SignatureProvider {
|
|||||||
/**
|
/**
|
||||||
* 我方请求前用 SHA256withRSA 加签,使用API证书.
|
* 我方请求前用 SHA256withRSA 加签,使用API证书.
|
||||||
*
|
*
|
||||||
|
* @param newLine the new line
|
||||||
* @param tenantId the properties key
|
* @param tenantId the properties key
|
||||||
* @param method the method
|
* @param method the method
|
||||||
* @param canonicalUrl the canonical url
|
* @param canonicalUrl the canonical url
|
||||||
@@ -127,7 +128,7 @@ public class SignatureProvider {
|
|||||||
* @return the string
|
* @return the string
|
||||||
*/
|
*/
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
public String requestSign(String tenantId, String method, String canonicalUrl, String body) {
|
public String requestSign(boolean newLine,String tenantId, String method, String canonicalUrl, String body) {
|
||||||
|
|
||||||
long timestamp = LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8"));
|
long timestamp = LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8"));
|
||||||
String nonceStr = nonceStrGenerator.generateId()
|
String nonceStr = nonceStrGenerator.generateId()
|
||||||
@@ -135,7 +136,7 @@ public class SignatureProvider {
|
|||||||
.replaceAll("-", "");
|
.replaceAll("-", "");
|
||||||
WechatMetaBean wechatMetaBean = wechatMetaContainer.getWechatMeta(tenantId);
|
WechatMetaBean wechatMetaBean = wechatMetaContainer.getWechatMeta(tenantId);
|
||||||
PrivateKey privateKey = wechatMetaBean.getKeyPair().getPrivate();
|
PrivateKey privateKey = wechatMetaBean.getKeyPair().getPrivate();
|
||||||
String encode = this.doRequestSign(privateKey, method, canonicalUrl, String.valueOf(timestamp), nonceStr, body);
|
String encode = this.doRequestSign(newLine,privateKey, method, canonicalUrl, String.valueOf(timestamp), nonceStr, body);
|
||||||
// 序列号
|
// 序列号
|
||||||
String serialNo = wechatMetaBean.getSerialNumber();
|
String serialNo = wechatMetaBean.getSerialNumber();
|
||||||
// 生成token
|
// 生成token
|
||||||
@@ -149,16 +150,17 @@ public class SignatureProvider {
|
|||||||
/**
|
/**
|
||||||
* Do request sign.
|
* Do request sign.
|
||||||
*
|
*
|
||||||
|
* @param newLine the has suffix
|
||||||
* @param privateKey the private key
|
* @param privateKey the private key
|
||||||
* @param orderedComponents the orderedComponents
|
* @param orderedComponents the orderedComponents
|
||||||
* @return the string
|
* @return the string
|
||||||
* @since 1.0.4.RELEASE
|
* @since 1.0.4.RELEASE
|
||||||
*/
|
*/
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
public String doRequestSign(PrivateKey privateKey, String... orderedComponents) {
|
public String doRequestSign(boolean newLine,PrivateKey privateKey, String... orderedComponents) {
|
||||||
Signature signer = Signature.getInstance("SHA256withRSA", BC_PROVIDER);
|
Signature signer = Signature.getInstance("SHA256withRSA", BC_PROVIDER);
|
||||||
signer.initSign(privateKey);
|
signer.initSign(privateKey);
|
||||||
final String signatureStr = createSign(orderedComponents);
|
final String signatureStr = createSign(newLine,orderedComponents);
|
||||||
signer.update(signatureStr.getBytes(StandardCharsets.UTF_8));
|
signer.update(signatureStr.getBytes(StandardCharsets.UTF_8));
|
||||||
return Base64Utils.encodeToString(signer.sign());
|
return Base64Utils.encodeToString(signer.sign());
|
||||||
}
|
}
|
||||||
@@ -178,7 +180,7 @@ public class SignatureProvider {
|
|||||||
}
|
}
|
||||||
Certificate certificate = CERTIFICATE_MAP.get(wechatpaySerial);
|
Certificate certificate = CERTIFICATE_MAP.get(wechatpaySerial);
|
||||||
|
|
||||||
final String signatureStr = createSign(params.getWechatpayTimestamp(), params.getWechatpayNonce(), params.getBody());
|
final String signatureStr = createSign(true,params.getWechatpayTimestamp(), params.getWechatpayNonce(), params.getBody());
|
||||||
Signature signer = Signature.getInstance("SHA256withRSA");
|
Signature signer = Signature.getInstance("SHA256withRSA");
|
||||||
signer.initVerify(certificate);
|
signer.initVerify(certificate);
|
||||||
signer.update(signatureStr.getBytes(StandardCharsets.UTF_8));
|
signer.update(signatureStr.getBytes(StandardCharsets.UTF_8));
|
||||||
@@ -206,7 +208,7 @@ public class SignatureProvider {
|
|||||||
}
|
}
|
||||||
// 签名
|
// 签名
|
||||||
HttpMethod httpMethod = WechatPayV3Type.CERT.method();
|
HttpMethod httpMethod = WechatPayV3Type.CERT.method();
|
||||||
String authorization = requestSign(tenantId, httpMethod.name(), canonicalUrl, "");
|
String authorization = requestSign(true,tenantId, httpMethod.name(), canonicalUrl, "");
|
||||||
|
|
||||||
HttpHeaders headers = new HttpHeaders();
|
HttpHeaders headers = new HttpHeaders();
|
||||||
headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON));
|
headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON));
|
||||||
@@ -278,7 +280,7 @@ public class SignatureProvider {
|
|||||||
/**
|
/**
|
||||||
* 对请求敏感字段进行加密
|
* 对请求敏感字段进行加密
|
||||||
*
|
*
|
||||||
* @param message the message
|
* @param message the message
|
||||||
* @param certificate the certificate
|
* @param certificate the certificate
|
||||||
* @return encrypt message
|
* @return encrypt message
|
||||||
* @since 1.0.6.RELEASE
|
* @since 1.0.6.RELEASE
|
||||||
@@ -297,6 +299,11 @@ public class SignatureProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get certificate x 509 wechat certificate info.
|
||||||
|
*
|
||||||
|
* @return the x 509 wechat certificate info
|
||||||
|
*/
|
||||||
public X509WechatCertificateInfo getCertificate(){
|
public X509WechatCertificateInfo getCertificate(){
|
||||||
for (String serial : CERTIFICATE_MAP.keySet()) {
|
for (String serial : CERTIFICATE_MAP.keySet()) {
|
||||||
X509Certificate x509Cert = (X509Certificate) CERTIFICATE_MAP.get(serial);
|
X509Certificate x509Cert = (X509Certificate) CERTIFICATE_MAP.get(serial);
|
||||||
@@ -341,9 +348,11 @@ public class SignatureProvider {
|
|||||||
* @param components the components
|
* @param components the components
|
||||||
* @return string string
|
* @return string string
|
||||||
*/
|
*/
|
||||||
private static String createSign(String... components) {
|
private static String createSign(boolean newLine,String... components) {
|
||||||
|
|
||||||
|
String suffix = newLine? "\n":"";
|
||||||
return Arrays.stream(components)
|
return Arrays.stream(components)
|
||||||
.collect(Collectors.joining("\n", "", "\n"));
|
.collect(Collectors.joining("\n", "", suffix));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package cn.felord.payment.wechat.v3;
|
package cn.felord.payment.wechat.v3;
|
||||||
|
|
||||||
|
import cn.felord.payment.wechat.v2.WechatAllocationApi;
|
||||||
import cn.felord.payment.wechat.v2.WechatPayRedpackApi;
|
import cn.felord.payment.wechat.v2.WechatPayRedpackApi;
|
||||||
import cn.felord.payment.wechat.v2.WechatPayTransfersApi;
|
import cn.felord.payment.wechat.v2.WechatPayTransfersApi;
|
||||||
import cn.felord.payment.wechat.v2.WechatV2Client;
|
import cn.felord.payment.wechat.v2.WechatV2Client;
|
||||||
@@ -65,6 +66,18 @@ public class WechatApiProvider {
|
|||||||
return new WechatDirectPayApi(wechatPayClient, tenantId);
|
return new WechatDirectPayApi(wechatPayClient, tenantId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 普通支付-服务商模式.
|
||||||
|
*
|
||||||
|
* @param tenantId the tenant id
|
||||||
|
* @return the wechat pay api
|
||||||
|
* @since 1.0.9.RELEASE
|
||||||
|
*/
|
||||||
|
public WechatPartnerPayApi partnerPayApi(String tenantId) {
|
||||||
|
return new WechatPartnerPayApi(wechatPayClient, tenantId);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 合单支付.
|
* 合单支付.
|
||||||
*
|
*
|
||||||
@@ -165,4 +178,19 @@ public class WechatApiProvider {
|
|||||||
return new WechatPayTransfersApi(wechatV2Client);
|
return new WechatPayTransfersApi(wechatV2Client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信支付分账,基于V2
|
||||||
|
*
|
||||||
|
* @param tenantId the tenant id
|
||||||
|
* @return wechat allocation api
|
||||||
|
* @since 1.0.10.RELEASE
|
||||||
|
*/
|
||||||
|
public WechatAllocationApi allocationApi(String tenantId) {
|
||||||
|
WechatMetaBean wechatMeta = wechatPayClient.signatureProvider()
|
||||||
|
.wechatMetaContainer()
|
||||||
|
.getWechatMeta(tenantId);
|
||||||
|
WechatV2Client wechatV2Client = new WechatV2Client(wechatMeta);
|
||||||
|
return new WechatAllocationApi(wechatV2Client);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ public class WechatDirectPayApi extends AbstractApi {
|
|||||||
.toString()
|
.toString()
|
||||||
.replaceAll("-", "");
|
.replaceAll("-", "");
|
||||||
String prepayId = body.get("prepay_id").asText();
|
String prepayId = body.get("prepay_id").asText();
|
||||||
String paySign = signatureProvider.doRequestSign(privateKey, appId, timestamp, nonceStr, prepayId);
|
String paySign = signatureProvider.doRequestSign(true,privateKey, appId, timestamp, nonceStr, prepayId);
|
||||||
String mchId = wechatMetaBean.getV3().getMchId();
|
String mchId = wechatMetaBean.getV3().getMchId();
|
||||||
|
|
||||||
body.put("appid", appId);
|
body.put("appid", appId);
|
||||||
@@ -136,7 +136,7 @@ public class WechatDirectPayApi extends AbstractApi {
|
|||||||
.toString()
|
.toString()
|
||||||
.replaceAll("-", "");
|
.replaceAll("-", "");
|
||||||
String packageStr = "prepay_id=" + body.get("prepay_id").asText();
|
String packageStr = "prepay_id=" + body.get("prepay_id").asText();
|
||||||
String paySign = signatureProvider.doRequestSign(privateKey, appId, timestamp, nonceStr, packageStr);
|
String paySign = signatureProvider.doRequestSign(true,privateKey, appId, timestamp, nonceStr, packageStr);
|
||||||
|
|
||||||
body.put("appId", appId);
|
body.put("appId", appId);
|
||||||
body.put("timeStamp", timestamp);
|
body.put("timeStamp", timestamp);
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import org.springframework.util.StringUtils;
|
|||||||
import org.springframework.web.util.UriComponentsBuilder;
|
import org.springframework.web.util.UriComponentsBuilder;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 微信支付商家券.
|
* 微信支付商家券.
|
||||||
@@ -146,7 +147,10 @@ public class WechatMarketingBusiFavorApi extends AbstractApi {
|
|||||||
queryParams.add("appid", appid);
|
queryParams.add("appid", appid);
|
||||||
}
|
}
|
||||||
queryParams.add("stock_id", userBusiFavorQueryParams.getStockId());
|
queryParams.add("stock_id", userBusiFavorQueryParams.getStockId());
|
||||||
queryParams.add("coupon_state", userBusiFavorQueryParams.getCouponState().name());
|
|
||||||
|
Optional.ofNullable(userBusiFavorQueryParams.getCouponState())
|
||||||
|
.ifPresent(state-> queryParams.add("coupon_state", state.name()));
|
||||||
|
|
||||||
queryParams.add("creator_merchant", userBusiFavorQueryParams.getCreatorMerchant());
|
queryParams.add("creator_merchant", userBusiFavorQueryParams.getCreatorMerchant());
|
||||||
queryParams.add("belong_merchant", userBusiFavorQueryParams.getBelongMerchant());
|
queryParams.add("belong_merchant", userBusiFavorQueryParams.getBelongMerchant());
|
||||||
queryParams.add("sender_merchant", userBusiFavorQueryParams.getSenderMerchant());
|
queryParams.add("sender_merchant", userBusiFavorQueryParams.getSenderMerchant());
|
||||||
@@ -380,7 +384,7 @@ public class WechatMarketingBusiFavorApi extends AbstractApi {
|
|||||||
.expand(updateParams.getStockId())
|
.expand(updateParams.getStockId())
|
||||||
.toUri();
|
.toUri();
|
||||||
updateParams.setStockId(null);
|
updateParams.setStockId(null);
|
||||||
return Post(uri, updateParams);
|
return Patch(uri, updateParams);
|
||||||
})
|
})
|
||||||
.consumer(wechatResponseEntity::convert)
|
.consumer(wechatResponseEntity::convert)
|
||||||
.request();
|
.request();
|
||||||
|
|||||||
@@ -0,0 +1,276 @@
|
|||||||
|
/*
|
||||||
|
* 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.PayException;
|
||||||
|
import cn.felord.payment.wechat.WechatPayProperties;
|
||||||
|
import cn.felord.payment.wechat.enumeration.WeChatServer;
|
||||||
|
import cn.felord.payment.wechat.enumeration.WechatPayV3Type;
|
||||||
|
import cn.felord.payment.wechat.v3.model.TransactionQueryParams;
|
||||||
|
import cn.felord.payment.wechat.v3.model.partner.CloseTransParams;
|
||||||
|
import cn.felord.payment.wechat.v3.model.partner.PartnerPayParams;
|
||||||
|
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.web.util.UriComponentsBuilder;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
import java.security.PrivateKey;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.ZoneOffset;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 普通支付-服务商模式
|
||||||
|
*
|
||||||
|
* @author felord.cn
|
||||||
|
* @since 1.0.8.RELEASE
|
||||||
|
*/
|
||||||
|
public class WechatPartnerPayApi extends AbstractApi {
|
||||||
|
/**
|
||||||
|
* Instantiates a new Abstract api.
|
||||||
|
*
|
||||||
|
* @param wechatPayClient the wechat pay client
|
||||||
|
* @param tenantId the tenant id
|
||||||
|
*/
|
||||||
|
public WechatPartnerPayApi(WechatPayClient wechatPayClient, String tenantId) {
|
||||||
|
super(wechatPayClient, tenantId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APP下单API
|
||||||
|
*
|
||||||
|
* @param partnerPayParams the partner pay params
|
||||||
|
* @return the wechat response entity
|
||||||
|
* @since 1.0.8.RELEASE
|
||||||
|
*/
|
||||||
|
public WechatResponseEntity<ObjectNode> appPay(PartnerPayParams partnerPayParams) {
|
||||||
|
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
|
||||||
|
this.client().withType(WechatPayV3Type.APP_PARTNER, partnerPayParams)
|
||||||
|
.function(this::payFunction)
|
||||||
|
.consumer(responseEntity -> {
|
||||||
|
ObjectNode body = responseEntity.getBody();
|
||||||
|
if (Objects.isNull(body)) {
|
||||||
|
throw new PayException("response body cannot be resolved");
|
||||||
|
}
|
||||||
|
|
||||||
|
SignatureProvider signatureProvider = this.client().signatureProvider();
|
||||||
|
WechatMetaContainer wechatMetaContainer = signatureProvider.wechatMetaContainer();
|
||||||
|
WechatMetaBean wechatMetaBean = wechatMetaContainer.getWechatMeta(tenantId());
|
||||||
|
PrivateKey privateKey = wechatMetaBean.getKeyPair().getPrivate();
|
||||||
|
|
||||||
|
String subAppid = partnerPayParams.getSubAppid();
|
||||||
|
long epochSecond = LocalDateTime.now()
|
||||||
|
.toEpochSecond(ZoneOffset.of("+8"));
|
||||||
|
String timestamp = String.valueOf(epochSecond);
|
||||||
|
String nonceStr = signatureProvider.nonceStrGenerator()
|
||||||
|
.generateId()
|
||||||
|
.toString()
|
||||||
|
.replaceAll("-", "");
|
||||||
|
String prepayId = body.get("prepay_id").asText();
|
||||||
|
String paySign = signatureProvider.doRequestSign(true, privateKey, subAppid, timestamp, nonceStr, prepayId);
|
||||||
|
|
||||||
|
body.put("appid", subAppid);
|
||||||
|
body.put("partnerid", partnerPayParams.getSubMchid());
|
||||||
|
body.put("prepayid", prepayId);
|
||||||
|
body.put("package", "Sign=WXPay");
|
||||||
|
body.put("nonceStr", nonceStr);
|
||||||
|
body.put("timeStamp", timestamp);
|
||||||
|
body.put("signType", "RSA");
|
||||||
|
body.put("paySign", paySign);
|
||||||
|
|
||||||
|
wechatResponseEntity.setHttpStatus(responseEntity.getStatusCodeValue());
|
||||||
|
wechatResponseEntity.setBody(body);
|
||||||
|
})
|
||||||
|
.request();
|
||||||
|
return wechatResponseEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JSAPI/小程序下单API
|
||||||
|
*
|
||||||
|
* @param partnerPayParams the pay params
|
||||||
|
* @return wechat response entity
|
||||||
|
* @since 1.0.8.RELEASE
|
||||||
|
*/
|
||||||
|
public WechatResponseEntity<ObjectNode> jsPay(PartnerPayParams partnerPayParams) {
|
||||||
|
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
|
||||||
|
this.client().withType(WechatPayV3Type.JSAPI_PARTNER, partnerPayParams)
|
||||||
|
.function(this::payFunction)
|
||||||
|
.consumer(responseEntity -> {
|
||||||
|
ObjectNode body = responseEntity.getBody();
|
||||||
|
if (Objects.isNull(body)) {
|
||||||
|
throw new PayException("response body cannot be resolved");
|
||||||
|
}
|
||||||
|
|
||||||
|
SignatureProvider signatureProvider = this.client().signatureProvider();
|
||||||
|
WechatMetaContainer wechatMetaContainer = signatureProvider.wechatMetaContainer();
|
||||||
|
WechatMetaBean wechatMetaBean = wechatMetaContainer.getWechatMeta(tenantId());
|
||||||
|
PrivateKey privateKey = wechatMetaBean.getKeyPair().getPrivate();
|
||||||
|
|
||||||
|
String subAppid = partnerPayParams.getSubAppid();
|
||||||
|
long epochSecond = LocalDateTime.now()
|
||||||
|
.toEpochSecond(ZoneOffset.of("+8"));
|
||||||
|
String timestamp = String.valueOf(epochSecond);
|
||||||
|
String nonceStr = signatureProvider.nonceStrGenerator()
|
||||||
|
.generateId()
|
||||||
|
.toString()
|
||||||
|
.replaceAll("-", "");
|
||||||
|
String packageStr = "prepay_id=" + body.get("prepay_id").asText();
|
||||||
|
String paySign = signatureProvider.doRequestSign(true, privateKey, subAppid, timestamp, nonceStr, packageStr);
|
||||||
|
|
||||||
|
body.put("appId", subAppid);
|
||||||
|
body.put("timeStamp", timestamp);
|
||||||
|
body.put("nonceStr", nonceStr);
|
||||||
|
body.put("package", packageStr);
|
||||||
|
body.put("signType", "RSA");
|
||||||
|
body.put("paySign", paySign);
|
||||||
|
|
||||||
|
wechatResponseEntity.setHttpStatus(responseEntity.getStatusCodeValue());
|
||||||
|
wechatResponseEntity.setBody(body);
|
||||||
|
})
|
||||||
|
.request();
|
||||||
|
return wechatResponseEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Native下单API
|
||||||
|
*
|
||||||
|
* @param partnerPayParams the pay params
|
||||||
|
* @return wechat response entity
|
||||||
|
* @since 1.0.8.RELEASE
|
||||||
|
*/
|
||||||
|
public WechatResponseEntity<ObjectNode> nativePay(PartnerPayParams partnerPayParams) {
|
||||||
|
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
|
||||||
|
this.client().withType(WechatPayV3Type.NATIVE_PARTNER, partnerPayParams)
|
||||||
|
.function(this::payFunction)
|
||||||
|
.consumer(wechatResponseEntity::convert)
|
||||||
|
.request();
|
||||||
|
return wechatResponseEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* H5下单API
|
||||||
|
*
|
||||||
|
* @param partnerPayParams the partner pay params
|
||||||
|
* @return wechat response entity
|
||||||
|
* @since 1.0.8.RELEASE
|
||||||
|
*/
|
||||||
|
public WechatResponseEntity<ObjectNode> h5Pay(PartnerPayParams partnerPayParams) {
|
||||||
|
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
|
||||||
|
this.client().withType(WechatPayV3Type.MWEB_PARTNER, partnerPayParams)
|
||||||
|
.function(this::payFunction)
|
||||||
|
.consumer(wechatResponseEntity::convert)
|
||||||
|
.request();
|
||||||
|
return wechatResponseEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
private RequestEntity<?> payFunction(WechatPayV3Type type, PartnerPayParams partnerPayParams) {
|
||||||
|
WechatPayProperties.V3 v3 = this.wechatMetaBean().getV3();
|
||||||
|
partnerPayParams.setSpAppid(v3.getAppId());
|
||||||
|
partnerPayParams.setSpMchid(v3.getMchId());
|
||||||
|
String notifyUrl = v3.getDomain().concat(partnerPayParams.getNotifyUrl());
|
||||||
|
partnerPayParams.setNotifyUrl(notifyUrl);
|
||||||
|
URI uri = UriComponentsBuilder.fromHttpUrl(type.uri(WeChatServer.CHINA))
|
||||||
|
.build()
|
||||||
|
.toUri();
|
||||||
|
return Post(uri, partnerPayParams);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信支付订单号查询API
|
||||||
|
*
|
||||||
|
* @param params the params
|
||||||
|
* @return the wechat response entity
|
||||||
|
* @since 1.0.8.RELEASE
|
||||||
|
*/
|
||||||
|
public WechatResponseEntity<ObjectNode> queryTransactionById(TransactionQueryParams params) {
|
||||||
|
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
|
||||||
|
this.client().withType(WechatPayV3Type.TRANSACTION_TRANSACTION_ID_PARTNER, params)
|
||||||
|
.function(this::queryTransactionFunction)
|
||||||
|
.consumer(wechatResponseEntity::convert)
|
||||||
|
.request();
|
||||||
|
return wechatResponseEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户订单号查询API
|
||||||
|
*
|
||||||
|
* @param params the params
|
||||||
|
* @return the wechat response entity
|
||||||
|
* @since 1.0.8.RELEASE
|
||||||
|
*/
|
||||||
|
public WechatResponseEntity<ObjectNode> queryTransactionByOutTradeNo(TransactionQueryParams params) {
|
||||||
|
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
|
||||||
|
this.client().withType(WechatPayV3Type.TRANSACTION_OUT_TRADE_NO_PARTNER, params)
|
||||||
|
.function(this::queryTransactionFunction)
|
||||||
|
.consumer(wechatResponseEntity::convert)
|
||||||
|
.request();
|
||||||
|
return wechatResponseEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
private RequestEntity<?> queryTransactionFunction(WechatPayV3Type type, TransactionQueryParams params) {
|
||||||
|
WechatPayProperties.V3 v3 = this.wechatMetaBean().getV3();
|
||||||
|
|
||||||
|
MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>();
|
||||||
|
queryParams.add("sp_mchid", v3.getMchId());
|
||||||
|
queryParams.add("sub_mchid", params.getMchId());
|
||||||
|
|
||||||
|
URI uri = UriComponentsBuilder.fromHttpUrl(type.uri(WeChatServer.CHINA))
|
||||||
|
.queryParams(queryParams)
|
||||||
|
.build()
|
||||||
|
.expand(params.getTransactionIdOrOutTradeNo())
|
||||||
|
.toUri();
|
||||||
|
return Get(uri);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关单API
|
||||||
|
*
|
||||||
|
* @param closeTransParams the closeTransParams
|
||||||
|
* @return the wechat response entity
|
||||||
|
* @since 1.0.8.RELEASE
|
||||||
|
*/
|
||||||
|
public WechatResponseEntity<ObjectNode> close(CloseTransParams closeTransParams) {
|
||||||
|
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
|
||||||
|
this.client().withType(WechatPayV3Type.CLOSE_PARTNER, closeTransParams)
|
||||||
|
.function(this::closeByOutTradeNoFunction)
|
||||||
|
.consumer(wechatResponseEntity::convert)
|
||||||
|
.request();
|
||||||
|
return wechatResponseEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
private RequestEntity<?> closeByOutTradeNoFunction(WechatPayV3Type type, CloseTransParams closeTransParams) {
|
||||||
|
WechatPayProperties.V3 v3 = this.wechatMetaBean().getV3();
|
||||||
|
|
||||||
|
Map<String, String> queryParams = new HashMap<>(1);
|
||||||
|
queryParams.put("sp_mchid", v3.getMchId());
|
||||||
|
queryParams.put("sub_mchid", closeTransParams.getSubMchid());
|
||||||
|
|
||||||
|
URI uri = UriComponentsBuilder.fromHttpUrl(type.uri(WeChatServer.CHINA))
|
||||||
|
.build()
|
||||||
|
.expand(closeTransParams.getOutTradeNo())
|
||||||
|
.toUri();
|
||||||
|
return Post(uri, queryParams);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -31,8 +31,10 @@ 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;
|
||||||
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.DeserializationFeature;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
|
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
|
||||||
|
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
@@ -69,8 +71,11 @@ public class WechatPayCallback {
|
|||||||
private final String tenantId;
|
private final String tenantId;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
MAPPER.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE);
|
MAPPER.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE)
|
||||||
MAPPER.setSerializationInclusion(JsonInclude.Include.NON_NULL);
|
.setSerializationInclusion(JsonInclude.Include.NON_NULL)
|
||||||
|
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES,false)
|
||||||
|
.configure(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT,true)
|
||||||
|
.registerModule(new JavaTimeModule());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -86,6 +91,27 @@ public class WechatPayCallback {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信支付分账回调.
|
||||||
|
*
|
||||||
|
* @param params the params
|
||||||
|
* @param consumeDataConsumer the consume data consumer
|
||||||
|
* @return the map
|
||||||
|
* @since 1.0.10.RELEASE
|
||||||
|
*/
|
||||||
|
@SneakyThrows
|
||||||
|
public Map<String, ?> profitSharingCallback(ResponseSignVerifyParams params, Consumer<ProfitSharingConsumeData> consumeDataConsumer) {
|
||||||
|
String data = this.callback(params, EventType.TRANSACTION);
|
||||||
|
ProfitSharingConsumeData consumeData = MAPPER.readValue(data, ProfitSharingConsumeData.class);
|
||||||
|
consumeDataConsumer.accept(consumeData);
|
||||||
|
Map<String, Object> responseBody = new HashMap<>(2);
|
||||||
|
responseBody.put("code", 200);
|
||||||
|
responseBody.put("message", "SUCCESS");
|
||||||
|
return responseBody;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 微信支付代金券核销回调.
|
* 微信支付代金券核销回调.
|
||||||
*
|
*
|
||||||
@@ -107,7 +133,7 @@ public class WechatPayCallback {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 微信支付成功回调.
|
* 微信支付成功回调,在1.0.8.RELEASE时支持服务商模式支付回调通知
|
||||||
* <p>
|
* <p>
|
||||||
* 无需开发者判断,只有扣款成功微信才会回调此接口
|
* 无需开发者判断,只有扣款成功微信才会回调此接口
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ public class WechatPayClient {
|
|||||||
public void request() {
|
public void request() {
|
||||||
RequestEntity<?> requestEntity = this.requestEntityBiFunction.apply(this.wechatPayV3Type, this.model);
|
RequestEntity<?> requestEntity = this.requestEntityBiFunction.apply(this.wechatPayV3Type, this.model);
|
||||||
WechatRequestEntity<?> wechatRequestEntity = WechatRequestEntity.of(requestEntity, this.responseBodyConsumer);
|
WechatRequestEntity<?> wechatRequestEntity = WechatRequestEntity.of(requestEntity, this.responseBodyConsumer);
|
||||||
this.doExecute(this.header(wechatRequestEntity));
|
this.doExecute(this.header(true,wechatRequestEntity));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -176,18 +176,19 @@ public class WechatPayClient {
|
|||||||
public String download() {
|
public String download() {
|
||||||
RequestEntity<?> requestEntity = this.requestEntityBiFunction.apply(this.wechatPayV3Type, this.model);
|
RequestEntity<?> requestEntity = this.requestEntityBiFunction.apply(this.wechatPayV3Type, this.model);
|
||||||
WechatRequestEntity<?> wechatRequestEntity = WechatRequestEntity.of(requestEntity, this.responseBodyConsumer);
|
WechatRequestEntity<?> wechatRequestEntity = WechatRequestEntity.of(requestEntity, this.responseBodyConsumer);
|
||||||
return this.doDownload(this.header(wechatRequestEntity));
|
return this.doDownload(this.header(true,wechatRequestEntity));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Download string.
|
* Download string.
|
||||||
*
|
*
|
||||||
* @return the string
|
* @return the string
|
||||||
* @since 1.0.6.RELEASE
|
* @since 1.0.6.RELEASE
|
||||||
*/
|
*/
|
||||||
public ResponseEntity<Resource> resource() {
|
public ResponseEntity<Resource> resource() {
|
||||||
RequestEntity<?> requestEntity = this.requestEntityBiFunction.apply(this.wechatPayV3Type, this.model);
|
RequestEntity<?> requestEntity = this.requestEntityBiFunction.apply(this.wechatPayV3Type, this.model);
|
||||||
WechatRequestEntity<?> wechatRequestEntity = WechatRequestEntity.of(requestEntity, this.responseBodyConsumer);
|
WechatRequestEntity<?> wechatRequestEntity = WechatRequestEntity.of(requestEntity, this.responseBodyConsumer);
|
||||||
return this.doResource(this.header(wechatRequestEntity));
|
return this.doResource(this.header(false,wechatRequestEntity));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -198,7 +199,7 @@ public class WechatPayClient {
|
|||||||
* @param requestEntity the request entity
|
* @param requestEntity the request entity
|
||||||
* @return the wechat request entity
|
* @return the wechat request entity
|
||||||
*/
|
*/
|
||||||
private <T> WechatRequestEntity<T> header(WechatRequestEntity<T> requestEntity) {
|
private <T> WechatRequestEntity<T> header(boolean newLine,WechatRequestEntity<T> requestEntity) {
|
||||||
|
|
||||||
UriComponents uri = UriComponentsBuilder.fromUri(requestEntity.getUrl()).build();
|
UriComponents uri = UriComponentsBuilder.fromUri(requestEntity.getUrl()).build();
|
||||||
String canonicalUrl = uri.getPath();
|
String canonicalUrl = uri.getPath();
|
||||||
@@ -219,7 +220,7 @@ public class WechatPayClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String tenantId = Objects.requireNonNull(headers.get("Pay-TenantId")).get(0);
|
String tenantId = Objects.requireNonNull(headers.get("Pay-TenantId")).get(0);
|
||||||
String authorization = signatureProvider.requestSign(tenantId, httpMethod.name(), canonicalUrl, body);
|
String authorization = signatureProvider.requestSign(newLine,tenantId, httpMethod.name(), canonicalUrl, body);
|
||||||
|
|
||||||
HttpHeaders httpHeaders = new HttpHeaders();
|
HttpHeaders httpHeaders = new HttpHeaders();
|
||||||
httpHeaders.addAll(headers);
|
httpHeaders.addAll(headers);
|
||||||
@@ -253,7 +254,9 @@ public class WechatPayClient {
|
|||||||
// 微信请求id
|
// 微信请求id
|
||||||
String requestId = headers.getFirst("Request-ID");
|
String requestId = headers.getFirst("Request-ID");
|
||||||
if (!statusCode.is2xxSuccessful()) {
|
if (!statusCode.is2xxSuccessful()) {
|
||||||
throw new PayException("wechat pay server error, Request-ID " + requestId + " , statusCode " + statusCode + ",result : " + body);
|
PayException payException = new PayException("wechat pay server error, Request-ID " + requestId + " , statusCode " + statusCode + ",result : " + body);
|
||||||
|
payException.setResponse(responseEntity);
|
||||||
|
throw payException;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResponseSignVerifyParams params = new ResponseSignVerifyParams();
|
ResponseSignVerifyParams params = new ResponseSignVerifyParams();
|
||||||
@@ -276,7 +279,9 @@ public class WechatPayClient {
|
|||||||
responseConsumer.accept(responseEntity);
|
responseConsumer.accept(responseEntity);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new PayException("wechat pay signature verify failed, Request-ID " + requestId);
|
PayException payException = new PayException("wechat pay signature verify failed, Request-ID " + requestId);
|
||||||
|
payException.setResponse(responseEntity);
|
||||||
|
throw payException;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -295,7 +300,9 @@ public class WechatPayClient {
|
|||||||
// 微信请求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 : " + responseEntity);
|
PayException payException = new PayException("wechat pay server error, Request-ID " + requestId + " , statusCode " + statusCode + ",result : " + responseEntity);
|
||||||
|
payException.setResponse(responseEntity);
|
||||||
|
throw payException;
|
||||||
}
|
}
|
||||||
return Optional.ofNullable(responseEntity.getBody()).orElse("");
|
return Optional.ofNullable(responseEntity.getBody()).orElse("");
|
||||||
}
|
}
|
||||||
@@ -309,7 +316,7 @@ public class WechatPayClient {
|
|||||||
* @return the resource
|
* @return the resource
|
||||||
* @since 1.0.6.RELEASE
|
* @since 1.0.6.RELEASE
|
||||||
*/
|
*/
|
||||||
private <T> ResponseEntity<Resource> doResource(WechatRequestEntity<T> requestEntity) {
|
private <T> ResponseEntity<Resource> doResource(WechatRequestEntity<T> requestEntity) {
|
||||||
|
|
||||||
ResponseEntity<Resource> responseEntity = restOperations.exchange(requestEntity, Resource.class);
|
ResponseEntity<Resource> responseEntity = restOperations.exchange(requestEntity, Resource.class);
|
||||||
|
|
||||||
@@ -317,7 +324,9 @@ public class WechatPayClient {
|
|||||||
// 微信请求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 : " + responseEntity);
|
PayException payException = new PayException("wechat pay server error, Request-ID " + requestId + " , statusCode " + statusCode + ",result : " + responseEntity);
|
||||||
|
payException.setResponse(responseEntity);
|
||||||
|
throw payException;
|
||||||
}
|
}
|
||||||
return responseEntity;
|
return responseEntity;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,75 @@
|
|||||||
|
/*
|
||||||
|
* 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 lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author felord.cn
|
||||||
|
* @since 1.0.8.RELEASE
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public abstract class AbstractPayParams {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品描述
|
||||||
|
* Image形象店-深圳腾大-QQ公仔
|
||||||
|
*/
|
||||||
|
private String description;
|
||||||
|
/**
|
||||||
|
* 商户系统内部订单号,只能是数字、大小写字母_-*且在同一个商户号下唯一,详见【商户订单号】。
|
||||||
|
* 示例值:1217752501201407033233368018
|
||||||
|
*/
|
||||||
|
private String outTradeNo;
|
||||||
|
/**
|
||||||
|
* 订单失效时间 YYYY-MM-DDTHH:mm:ss+TIMEZONE
|
||||||
|
*/
|
||||||
|
private String timeExpire;
|
||||||
|
/**
|
||||||
|
* 附加数据,在查询API和支付通知中原样返回,可作为自定义参数使用
|
||||||
|
*/
|
||||||
|
private String attach;
|
||||||
|
/**
|
||||||
|
* 通知URL必须为直接可访问的URL,不允许携带查询串。
|
||||||
|
*/
|
||||||
|
private String notifyUrl;
|
||||||
|
/**
|
||||||
|
* 订单优惠标记
|
||||||
|
*/
|
||||||
|
private String goodsTag;
|
||||||
|
/**
|
||||||
|
* 支付金额
|
||||||
|
*/
|
||||||
|
private Amount amount;
|
||||||
|
/**
|
||||||
|
* 优惠功能
|
||||||
|
*/
|
||||||
|
private Detail detail;
|
||||||
|
/**
|
||||||
|
* 支付者 JSAPI/小程序下单 必传
|
||||||
|
*/
|
||||||
|
private Payer payer;
|
||||||
|
/**
|
||||||
|
* 场景信息
|
||||||
|
*/
|
||||||
|
private SceneInfo sceneInfo;
|
||||||
|
/**
|
||||||
|
* 结算信息
|
||||||
|
*/
|
||||||
|
private SettleInfo settleInfo;
|
||||||
|
}
|
||||||
@@ -31,7 +31,7 @@ public class Amount {
|
|||||||
/**
|
/**
|
||||||
* 金额,单位【分】。
|
* 金额,单位【分】。
|
||||||
*/
|
*/
|
||||||
private int total;
|
private Integer total;
|
||||||
/**
|
/**
|
||||||
* 货币单位,固定为 CNY 。
|
* 货币单位,固定为 CNY 。
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ package cn.felord.payment.wechat.v3.model;
|
|||||||
|
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 支付请求参数.
|
* 支付请求参数.
|
||||||
@@ -27,8 +28,9 @@ import lombok.Data;
|
|||||||
* @author felord.cn
|
* @author felord.cn
|
||||||
* @since 1.0.0.RELEASE
|
* @since 1.0.0.RELEASE
|
||||||
*/
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Data
|
@Data
|
||||||
public class PayParams {
|
public class PayParams extends AbstractPayParams {
|
||||||
/**
|
/**
|
||||||
* The Appid.
|
* The Appid.
|
||||||
*/
|
*/
|
||||||
@@ -37,48 +39,5 @@ public class PayParams {
|
|||||||
* The Mchid.
|
* The Mchid.
|
||||||
*/
|
*/
|
||||||
private String mchid;
|
private String mchid;
|
||||||
/**
|
|
||||||
* 商品描述
|
|
||||||
* Image形象店-深圳腾大-QQ公仔
|
|
||||||
*/
|
|
||||||
private String description;
|
|
||||||
/**
|
|
||||||
* 商户系统内部订单号,只能是数字、大小写字母_-*且在同一个商户号下唯一,详见【商户订单号】。
|
|
||||||
* 示例值:1217752501201407033233368018
|
|
||||||
*/
|
|
||||||
private String outTradeNo;
|
|
||||||
/**
|
|
||||||
* 订单失效时间 YYYY-MM-DDTHH:mm:ss+TIMEZONE
|
|
||||||
*/
|
|
||||||
private String timeExpire;
|
|
||||||
/**
|
|
||||||
* 附加数据,在查询API和支付通知中原样返回,可作为自定义参数使用
|
|
||||||
*/
|
|
||||||
private String attach;
|
|
||||||
/**
|
|
||||||
* 通知URL必须为直接可访问的URL,不允许携带查询串。
|
|
||||||
*/
|
|
||||||
private String notifyUrl;
|
|
||||||
/**
|
|
||||||
* 订单优惠标记
|
|
||||||
*/
|
|
||||||
private String goodsTag;
|
|
||||||
/**
|
|
||||||
* 支付金额
|
|
||||||
*/
|
|
||||||
private Amount amount;
|
|
||||||
/**
|
|
||||||
* 支付者 JSAPI/小程序下单 必传
|
|
||||||
*/
|
|
||||||
private Payer payer;
|
|
||||||
/**
|
|
||||||
* 优惠功能
|
|
||||||
*/
|
|
||||||
private Detail detail;
|
|
||||||
/**
|
|
||||||
* 场景信息
|
|
||||||
*/
|
|
||||||
private SceneInfo sceneInfo;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,77 @@
|
|||||||
|
/*
|
||||||
|
*
|
||||||
|
* 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.v3.model;
|
||||||
|
|
||||||
|
import cn.felord.payment.wechat.v2.model.allocation.Receiver;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信支付分账通知参数
|
||||||
|
*
|
||||||
|
* @author wangzecheng
|
||||||
|
* @since 1.0.10.RELEASE
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ProfitSharingConsumeData {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 直连商户号.
|
||||||
|
* <p>
|
||||||
|
* 直连模式分账发起和出资商户
|
||||||
|
*/
|
||||||
|
private String mchid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信订单号.
|
||||||
|
* <p>
|
||||||
|
* 微信支付订单号
|
||||||
|
*/
|
||||||
|
private String transactionId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信分账/回退单号.
|
||||||
|
*/
|
||||||
|
private String orderId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户分账/回退单号.
|
||||||
|
* <p>
|
||||||
|
* 分账方系统内部的分账/回退单号
|
||||||
|
*/
|
||||||
|
private String outOrderNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分账接收方.
|
||||||
|
* <p>
|
||||||
|
* 分账接收方对象
|
||||||
|
*/
|
||||||
|
private Receiver receiver;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 成功时间.
|
||||||
|
* <p>
|
||||||
|
* Rfc3339标准
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ssXXX", timezone = "GMT+8")
|
||||||
|
private LocalDateTime successTime;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -22,7 +22,7 @@ import cn.felord.payment.wechat.enumeration.RefundStatus;
|
|||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.time.OffsetDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 微信支付退款结果通知解密
|
* 微信支付退款结果通知解密
|
||||||
@@ -59,12 +59,17 @@ public class RefundConsumeData {
|
|||||||
/**
|
/**
|
||||||
* 退款成功时间
|
* 退款成功时间
|
||||||
*/
|
*/
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss", timezone = "GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ssXXX", timezone = "GMT+8")
|
||||||
private OffsetDateTime successTime;
|
private LocalDateTime successTime;
|
||||||
/**
|
/**
|
||||||
* 退款入账账户
|
* 退款入账账户
|
||||||
*/
|
*/
|
||||||
private String userReceivedAccount;
|
private String userReceivedAccount;
|
||||||
|
/**
|
||||||
|
* 金额信息
|
||||||
|
*/
|
||||||
|
private Amount amount;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 微信支付退款金额信息
|
* 微信支付退款金额信息
|
||||||
@@ -85,7 +90,6 @@ public class RefundConsumeData {
|
|||||||
/**
|
/**
|
||||||
* 用户实际支付金额,单位为分
|
* 用户实际支付金额,单位为分
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private Integer payerTotal;
|
private Integer payerTotal;
|
||||||
/**
|
/**
|
||||||
* 退款给用户的金额,单位为分,不包含所有优惠券金额
|
* 退款给用户的金额,单位为分,不包含所有优惠券金额
|
||||||
|
|||||||
@@ -44,12 +44,12 @@ public class StocksCreateParams {
|
|||||||
*/
|
*/
|
||||||
private String belongMerchant;
|
private String belongMerchant;
|
||||||
/**
|
/**
|
||||||
* 批次开始时间 rfc 3339 yyyy-MM-ddTHH:mm:ss+TIMEZONE
|
* 批次开始时间 rfc 3339 yyyy-MM-ddTHH:mm:ss.sss+TIMEZONE
|
||||||
*/
|
*/
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX", timezone = "GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX", timezone = "GMT+8")
|
||||||
private OffsetDateTime availableBeginTime;
|
private OffsetDateTime availableBeginTime;
|
||||||
/**
|
/**
|
||||||
* 批次结束时间 rfc 3339 yyyy-MM-ddTHH:mm:ss+TIMEZONE
|
* 批次结束时间 rfc 3339 yyyy-MM-ddTHH:mm:ss.sss+TIMEZONE
|
||||||
*/
|
*/
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX", timezone = "GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX", timezone = "GMT+8")
|
||||||
private OffsetDateTime availableEndTime;
|
private OffsetDateTime availableEndTime;
|
||||||
|
|||||||
@@ -20,8 +20,10 @@ package cn.felord.payment.wechat.v3.model;
|
|||||||
|
|
||||||
import cn.felord.payment.wechat.enumeration.TradeState;
|
import cn.felord.payment.wechat.enumeration.TradeState;
|
||||||
import cn.felord.payment.wechat.enumeration.TradeType;
|
import cn.felord.payment.wechat.enumeration.TradeType;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -38,9 +40,29 @@ public class TransactionConsumeData {
|
|||||||
*/
|
*/
|
||||||
private Amount amount;
|
private Amount amount;
|
||||||
/**
|
/**
|
||||||
* 应用ID
|
* 直连模式应用ID,服务商模式请解析spAppid
|
||||||
*/
|
*/
|
||||||
private String appid;
|
private String appid;
|
||||||
|
/**
|
||||||
|
* 直连模式商户号,服务商模式请解析spMchid
|
||||||
|
*/
|
||||||
|
private String mchid;
|
||||||
|
/**
|
||||||
|
* 服务商模式-服务商APPID
|
||||||
|
*/
|
||||||
|
private String spAppid;
|
||||||
|
/**
|
||||||
|
* 服务商模式-服务商户号
|
||||||
|
*/
|
||||||
|
private String spMchid;
|
||||||
|
/**
|
||||||
|
* 服务商模式-子商户appid
|
||||||
|
*/
|
||||||
|
private String subAppid;
|
||||||
|
/**
|
||||||
|
* 服务商模式-子商户商户id
|
||||||
|
*/
|
||||||
|
private String subMchid;
|
||||||
/**
|
/**
|
||||||
* 附加数据,在查询API和支付通知中原样返回,可作为自定义参数使用
|
* 附加数据,在查询API和支付通知中原样返回,可作为自定义参数使用
|
||||||
*/
|
*/
|
||||||
@@ -49,10 +71,6 @@ public class TransactionConsumeData {
|
|||||||
* 银行类型,采用字符串类型的银行标识。银行标识请参考 <a target= "_blank" href= "https://pay.weixin.qq.com/wiki/doc/apiv3/terms_definition/chapter1_1_3.shtml#part-6">《银行类型对照表》</a>
|
* 银行类型,采用字符串类型的银行标识。银行标识请参考 <a target= "_blank" href= "https://pay.weixin.qq.com/wiki/doc/apiv3/terms_definition/chapter1_1_3.shtml#part-6">《银行类型对照表》</a>
|
||||||
*/
|
*/
|
||||||
private String bankType;
|
private String bankType;
|
||||||
/**
|
|
||||||
* 商户号
|
|
||||||
*/
|
|
||||||
private String mchid;
|
|
||||||
/**
|
/**
|
||||||
* 商户订单号
|
* 商户订单号
|
||||||
*/
|
*/
|
||||||
@@ -72,7 +90,8 @@ public class TransactionConsumeData {
|
|||||||
/**
|
/**
|
||||||
* 支付完成时间 YYYY-MM-DDTHH:mm:ss+TIMEZONE
|
* 支付完成时间 YYYY-MM-DDTHH:mm:ss+TIMEZONE
|
||||||
*/
|
*/
|
||||||
private String successTime;
|
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ssXXX", timezone = "GMT+8")
|
||||||
|
private LocalDateTime successTime;
|
||||||
/**
|
/**
|
||||||
* 在 1.0.0.RELEASE 直接返回了枚举字符串,1.0.2.RELEASE 中变更为枚举
|
* 在 1.0.0.RELEASE 直接返回了枚举字符串,1.0.2.RELEASE 中变更为枚举
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ package cn.felord.payment.wechat.v3.model.busifavor;
|
|||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.time.OffsetDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商家券领券事件回调通知解密
|
* 商家券领券事件回调通知解密
|
||||||
@@ -50,7 +50,7 @@ public class BusiFavorReceiveConsumeData {
|
|||||||
* 发放时间 rfc 3339 yyyy-MM-ddTHH:mm:ss+TIMEZONE
|
* 发放时间 rfc 3339 yyyy-MM-ddTHH:mm:ss+TIMEZONE
|
||||||
*/
|
*/
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ssXXX", timezone = "GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ssXXX", timezone = "GMT+8")
|
||||||
private OffsetDateTime sendTime;
|
private LocalDateTime sendTime;
|
||||||
/**
|
/**
|
||||||
* 微信用户在appid下的唯一标识。
|
* 微信用户在appid下的唯一标识。
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public class CouponAvailableTime {
|
|||||||
* <p>
|
* <p>
|
||||||
* 需配合{@link #availableDayAfterReceive} 一同填写,不可单独填写。
|
* 需配合{@link #availableDayAfterReceive} 一同填写,不可单独填写。
|
||||||
*/
|
*/
|
||||||
private int waitDaysAfterReceive;
|
private Integer waitDaysAfterReceive;
|
||||||
/**
|
/**
|
||||||
* 生效后N天内有效
|
* 生效后N天内有效
|
||||||
* <p>
|
* <p>
|
||||||
@@ -50,7 +50,7 @@ public class CouponAvailableTime {
|
|||||||
* <p>
|
* <p>
|
||||||
* 可配合{@link #waitDaysAfterReceive}一同填写,也可单独填写。单独填写时,有效期内领券后立即生效,生效后x天内有效。
|
* 可配合{@link #waitDaysAfterReceive}一同填写,也可单独填写。单独填写时,有效期内领券后立即生效,生效后x天内有效。
|
||||||
*/
|
*/
|
||||||
private int availableDayAfterReceive;
|
private Integer availableDayAfterReceive;
|
||||||
/**
|
/**
|
||||||
* 批次开始时间 rfc 3339 yyyy-MM-ddTHH:mm:ss+TIMEZONE
|
* 批次开始时间 rfc 3339 yyyy-MM-ddTHH:mm:ss+TIMEZONE
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -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.partner;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务商模式-关闭订单请求参数
|
||||||
|
*
|
||||||
|
* @author felord.cn
|
||||||
|
* @since 1.0.8.RELEASE
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class CloseTransParams {
|
||||||
|
/**
|
||||||
|
* 子商户号
|
||||||
|
*/
|
||||||
|
private String subMchid;
|
||||||
|
/**
|
||||||
|
* 商户订单号
|
||||||
|
*/
|
||||||
|
private String outTradeNo;
|
||||||
|
}
|
||||||
@@ -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.partner;
|
||||||
|
|
||||||
|
import cn.felord.payment.wechat.v3.model.AbstractPayParams;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author felord.cn
|
||||||
|
* @since 1.0.8.RELEASE
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
public class PartnerPayParams extends AbstractPayParams {
|
||||||
|
/**
|
||||||
|
* 服务商公众号ID
|
||||||
|
*/
|
||||||
|
private String spAppid;
|
||||||
|
/**
|
||||||
|
* 服务商户号
|
||||||
|
*/
|
||||||
|
private String spMchid;
|
||||||
|
/**
|
||||||
|
* 子商户appid.
|
||||||
|
*/
|
||||||
|
private String subAppid;
|
||||||
|
/**
|
||||||
|
* 子商户号
|
||||||
|
*/
|
||||||
|
private String subMchid;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -98,6 +98,10 @@ public class PayScoreUserPaidConsumeData {
|
|||||||
* The Time range.
|
* The Time range.
|
||||||
*/
|
*/
|
||||||
private TimeRange timeRange;
|
private TimeRange timeRange;
|
||||||
|
/**
|
||||||
|
* stateDescription
|
||||||
|
*/
|
||||||
|
private String stateDescription;
|
||||||
/**
|
/**
|
||||||
* The Total amount.
|
* The Total amount.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -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.7.RELEASE</version>
|
<version>1.0.10.RELEASE</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>payment-spring-boot-starter</artifactId>
|
<artifactId>payment-spring-boot-starter</artifactId>
|
||||||
<version>1.0.7.RELEASE</version>
|
<version>1.0.10.RELEASE</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
52
pom.xml
52
pom.xml
@@ -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.7.RELEASE</version>
|
<version>1.0.10.RELEASE</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
@@ -30,12 +30,35 @@
|
|||||||
</developers>
|
</developers>
|
||||||
|
|
||||||
<scm>
|
<scm>
|
||||||
<tag>payment-spring-boot-1.0.7.RELEASE</tag>
|
<tag>payment-spring-boot-1.0.9.RELEASE</tag>
|
||||||
<url>https://github.com/NotFound403/payment-spring-boot</url>
|
<url>https://github.com/NotFound403/payment-spring-boot</url>
|
||||||
<connection>scm:git:https://github.com/NotFound403/payment-spring-boot.git</connection>
|
<connection>scm:git:https://github.com/NotFound403/payment-spring-boot.git</connection>
|
||||||
<developerConnection>scm:git:https://github.com/NotFound403/payment-spring-boot.git</developerConnection>
|
<developerConnection>scm:git:https://github.com/NotFound403/payment-spring-boot.git</developerConnection>
|
||||||
</scm>
|
</scm>
|
||||||
|
|
||||||
|
<profiles>
|
||||||
|
<!-- Deployment profile (required so these plugins are only used when deploying) -->
|
||||||
|
<profile>
|
||||||
|
<id>deploy</id>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-source-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
<!-- GPG plugin -->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-gpg-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
<module>payment-spring-boot-autoconfigure</module>
|
<module>payment-spring-boot-autoconfigure</module>
|
||||||
@@ -60,7 +83,7 @@
|
|||||||
|
|
||||||
<distributionManagement>
|
<distributionManagement>
|
||||||
<repository>
|
<repository>
|
||||||
<id>sonatype-nexus-staging</id>
|
<id>ossrh</id>
|
||||||
<name>Nexus Release Repository</name>
|
<name>Nexus Release Repository</name>
|
||||||
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
|
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
|
||||||
</repository>
|
</repository>
|
||||||
@@ -173,10 +196,18 @@
|
|||||||
<version>1.6</version>
|
<version>1.6</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
|
<id>sign-artifacts</id>
|
||||||
<phase>verify</phase>
|
<phase>verify</phase>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>sign</goal>
|
<goal>sign</goal>
|
||||||
</goals>
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<!-- Prevent `gpg` from using pinentry programs -->
|
||||||
|
<gpgArguments>
|
||||||
|
<arg>--pinentry-mode</arg>
|
||||||
|
<arg>loopback</arg>
|
||||||
|
</gpgArguments>
|
||||||
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
@@ -186,25 +217,14 @@
|
|||||||
<version>1.6.8</version>
|
<version>1.6.8</version>
|
||||||
<extensions>true</extensions>
|
<extensions>true</extensions>
|
||||||
<configuration>
|
<configuration>
|
||||||
<serverId>sonatype-nexus-staging</serverId>
|
<serverId>ossrh</serverId>
|
||||||
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
|
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
|
||||||
|
<autoReleaseAfterClose>false</autoReleaseAfterClose>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</pluginManagement>
|
</pluginManagement>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-source-plugin</artifactId>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-javadoc-plugin</artifactId>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-gpg-plugin</artifactId>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.sonatype.plugins</groupId>
|
<groupId>org.sonatype.plugins</groupId>
|
||||||
<artifactId>nexus-staging-maven-plugin</artifactId>
|
<artifactId>nexus-staging-maven-plugin</artifactId>
|
||||||
|
|||||||
Reference in New Issue
Block a user