mirror of
https://github.com/dromara/payment-spring-boot.git
synced 2026-03-14 05:43:46 +08:00
Compare commits
16 Commits
1.0.17
...
1.0.18.REL
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
730c15b6b8 | ||
|
|
dc6e48d538 | ||
|
|
e6e704cc28 | ||
|
|
8578300d1c | ||
|
|
aef8ef9ac3 | ||
|
|
f630301bc3 | ||
|
|
f7ba4dd306 | ||
|
|
997f004708 | ||
|
|
5e63779f36 | ||
|
|
30613a2fdd | ||
|
|
e9388f62c1 | ||
|
|
685839089f | ||
|
|
7b9bdd21f7 | ||
|
|
8c4ecad809 | ||
|
|
e24aa83ba0 | ||
|
|
d6d5e33dae |
43
README.md
43
README.md
@@ -1,8 +1,8 @@
|
||||
<div align="center" style="margin-bottom: 10px"><h1>最全最好用的微信支付V3 Spring Boot 组件</h1></div>
|
||||
|
||||
<p align="center">
|
||||
<a target="_blank" href="https://github.com/NotFound403/payment-spring-boot/blob/release/LICENSE">
|
||||
<img alt="" src="https://img.shields.io/github/license/NotFound403/payment-spring-boot"/>
|
||||
<a target="_blank" href="https://github.com/dromara/payment-spring-boot/blob/release/LICENSE">
|
||||
<img alt="" src="https://img.shields.io/github/license/dromara/payment-spring-boot"/>
|
||||
</a>
|
||||
<a target="_blank" href="https://felord.cn">
|
||||
<img alt="" src="https://img.shields.io/badge/java-8-red"/>
|
||||
@@ -13,8 +13,8 @@
|
||||
<a target="_blank" href="https://mvnrepository.com/artifact/cn.felord/payment-spring-boot">
|
||||
<img alt="" src="https://img.shields.io/maven-central/v/cn.felord/payment-spring-boot.svg?style=flat-square"/>
|
||||
</a>
|
||||
<a target="_blank" href="https://github.com/NotFound403/payment-spring-boot">
|
||||
<img alt="" src="https://img.shields.io/github/stars/NotFound403/payment-spring-boot?style=social"/>
|
||||
<a target="_blank" href="https://github.com/dromara/payment-spring-boot">
|
||||
<img alt="" src="https://img.shields.io/github/stars/dromara/payment-spring-boot?style=social"/>
|
||||
</a>
|
||||
<a target="_blank" href="https://gitee.com/felord/payment-spring-boot/stargazers">
|
||||
<img alt="" src="https://gitee.com/felord/payment-spring-boot/badge/star.svg?theme=white"/>
|
||||
@@ -42,46 +42,33 @@ Starter,支持微信优惠券,代金券、商家券、智慧商圈、商家
|
||||
<dependency>
|
||||
<groupId>cn.felord</groupId>
|
||||
<artifactId>payment-spring-boot-starter</artifactId>
|
||||
<version>1.0.17.RELEASE</version>
|
||||
<version>1.0.18.RELEASE</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
## JDK问题
|
||||
|
||||
**推荐使用Open JDK**,原因参见[FBI Warning](https://github.com/NotFound403/payment-spring-boot/issues/5)
|
||||
**推荐使用Open JDK**,原因参见[FBI Warning](https://github.com/dromara/payment-spring-boot/issues/5)
|
||||
|
||||
## 文档地址
|
||||
|
||||
- [payment-spring-boot GitHub文档](https://notfound403.github.io/payment-spring-boot)
|
||||
|
||||
## 目前已经实现所有服务商和直连商户接口
|
||||
|
||||
- 实现微信支付多商户
|
||||
- 集成支付宝SDK、快速接入Spring Boot
|
||||
- 实现微信支付V3 基础支付
|
||||
- 实现微信支付V3 合单支付
|
||||
- 实现微信支付V3 代金券
|
||||
- 实现微信支付V3 微信支付分
|
||||
- 实现微信支付V3 先享卡
|
||||
- 实现微信支付V3 商家券
|
||||
- 实现微信支付V3 批量转账到零钱
|
||||
|
||||
更新日志参考[changelog](https://notfound403.github.io/payment-spring-boot/#/changelog)
|
||||
- [payment-spring-boot GitHub文档](https://dromara.github.io/payment-spring-boot)
|
||||
|
||||
## API清单
|
||||
|
||||
API结构如下:
|
||||

|
||||
具体分为**直连商户**和**服务商**两个体系,请详细阅读文档说明
|
||||
目前已经实现绝大部分微信支付直连商户和服务商的接口,具体的API明细可查看[API清单](https://dromara.github.io/payment-spring-boot/#/wechat_v3_api)
|
||||
> 随着版本迭代功能会增加,也可通过API注册表类`WechatPayV3Type`进行API接口检索。
|
||||
|
||||
> 随着版本迭代功能会增加,可通过API注册表类`WechatPayV3Type`进行API接口检索。
|
||||
## CHANGELOG
|
||||
|
||||
更新日志[CHANGELOG](https://dromara.github.io/payment-spring-boot/#/changelog)
|
||||
|
||||
## 使用入门
|
||||
|
||||
### 集成配置
|
||||
|
||||
关于集成配置请详细阅读[payment-spring-boot GitHub文档](https://notfound403.github.io/payment-spring-boot)
|
||||
中[快速接入](https://notfound403.github.io/payment-spring-boot/#/quick_start)章节
|
||||
关于集成配置请详细阅读[payment-spring-boot GitHub文档](https://dromara.github.io/payment-spring-boot)
|
||||
中[快速接入](https://dromara.github.io/payment-spring-boot/#/quick_start)章节
|
||||
|
||||
### 调用示例
|
||||
|
||||
@@ -360,7 +347,7 @@ public class CallbackController {
|
||||
|
||||
## 仓库地址
|
||||
|
||||
- [GitHub](https://github.com/NotFound403/payment-spring-boot)
|
||||
- [GitHub](https://github.com/dromara/payment-spring-boot)
|
||||
- [Gitee](https://gitee.com/felord/payment-spring-boot)
|
||||
|
||||
## QQ交流群
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
<dependency>
|
||||
<groupId>cn.felord</groupId>
|
||||
<artifactId>payment-spring-boot-starter</artifactId>
|
||||
<version>1.0.17.RELEASE</version>
|
||||
<version>1.0.18.RELEASE</version>
|
||||
</dependency>
|
||||
```
|
||||
## 采用技术
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
* [项目简介](README.md)
|
||||
* [快速接入](quick_start.md)
|
||||
* [JavaDoc](apidocs/index.html ':ignore')
|
||||
* [微信支付V3接口文档](wechat_v3_api.md)
|
||||
* [Payment微信支付V3接口文档](wechat_v3_api.md)
|
||||
* [日常踩坑](stackoverflow.md)
|
||||
* [更新日志](changelog.md)
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
## 1.0.17.RELEASE
|
||||
### 微信支付
|
||||
- feat: 直连商户合单支付增加查询单笔退款
|
||||
- feat: 支付分增加退款独立的API
|
||||
- factor: 营销图片上传API现在由WechatMediaApi#marketingImageUpload实现,以代替WechatMarketingFavorApi#marketingImageUpload,旧实现已标记为过时
|
||||
- factor:时间格式优化,移除时区限制为东八区,由LocalDateTime改为OffsetDateTime
|
||||
- docs: 现在可以通过API清单检索API了
|
||||
|
||||
## 1.0.16.RELEASE
|
||||
### 微信支付
|
||||
- feat: 直连商户-委托营销相关API实现
|
||||
@@ -186,4 +194,4 @@
|
||||
- 多租户
|
||||
- 支付宝
|
||||
- 仅仅引入支付宝SDK,后续维护以支付宝SDK变动为准
|
||||
- 支付宝暂时不支持多租户
|
||||
- 支付宝暂时不支持多租户
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<dependency>
|
||||
<groupId>cn.felord</groupId>
|
||||
<artifactId>payment-spring-boot-starter</artifactId>
|
||||
<version>1.0.17.RELEASE</version>
|
||||
<version>1.0.18.RELEASE</version>
|
||||
</dependency>
|
||||
```
|
||||
> 基于 **Spring Boot 2.x**
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
## 入口类
|
||||
|
||||
`WechatApiProvider`是本项目微信支付的入口类,已被注入**Spring IoC**,由它来初始化微信支付相关的**API**,具体分为**直连商户
|
||||
**和**服务商**两个体系。
|
||||
`WechatApiProvider`是本项目微信支付的入口类,已被注入**Spring IoC**,由它来初始化微信支付相关的**API**,具体分为**直连商户**和**服务商**两个体系。
|
||||
|
||||
> 以下清单请搭配微信支付文档使用。
|
||||
|
||||
@@ -10,8 +9,8 @@
|
||||
#### 基础支付
|
||||
|
||||
- [x] `WechatDirectPayApi` 基础支付,通过`WechatApiProvider#directPayApi`初始化
|
||||
- [x] `jsPay` APP下单
|
||||
- [x] `appPay` JSAPI/小程序下单
|
||||
- [x] `jsPay` JSAPI/小程序下单
|
||||
- [x] `appPay` APP下单
|
||||
- [x] `h5Pay` H5下单
|
||||
- [x] `nativePay` Native下单
|
||||
- [x] 查询订单
|
||||
@@ -25,8 +24,8 @@
|
||||
- [x] `downloadTradeBill` 申请交易账单,直接下载为gzip或者txt文件
|
||||
- [x] `downloadFundFlowBill` 申请资金账单,直接下载为gzip或者txt文件
|
||||
- [x] `WechatCombinePayApi` 合单支付,通过`WechatApiProvider#combinePayApi`初始化
|
||||
- [x] `jsPay` 合单APP下单
|
||||
- [x] `appPay` 合单JSAPI/小程序下单
|
||||
- [x] `jsPay` 合单JSAPI/小程序下单
|
||||
- [x] `appPay` 合单APP下单
|
||||
- [x] `h5Pay` 合单H5下单
|
||||
- [x] `nativePay` 合单Native下单
|
||||
- [x] `queryTransactionByOutTradeNo` 查询订单,**合单支付目前只支持商户订单号查询**
|
||||
@@ -186,9 +185,6 @@
|
||||
- [x] 申请转账明细电子回单
|
||||
1. `transferElectronic` 受理转账明细电子回单
|
||||
2. `queryTransferElectronicResult` 查询转账账单电子回单接口
|
||||
- [x] 申请转账电子回单
|
||||
1. `` 转账账单电子回单申请受理接口
|
||||
2. `` 查询转账账单电子回单接口
|
||||
|
||||
##### 分账
|
||||
|
||||
@@ -224,4 +220,6 @@
|
||||
- [x] `mediaVideoUpload` 视频上传
|
||||
- [x] `marketingImageUpload` 营销图片上传
|
||||
|
||||
> 通过营销**图片上传API**上传图片后可获得图片url地址。图片url可在微信支付营销相关的API使用,包括商家券、代金券、支付有礼等。
|
||||
> 通过营销**图片上传API**上传图片后可获得图片url地址。图片url可在微信支付营销相关的API使用,包括商家券、代金券、支付有礼等。
|
||||
### 服务商
|
||||
施工中……
|
||||
@@ -22,11 +22,11 @@
|
||||
<parent>
|
||||
<groupId>cn.felord</groupId>
|
||||
<artifactId>payment-spring-boot</artifactId>
|
||||
<version>1.0.17.RELEASE</version>
|
||||
<version>1.0.18.RELEASE</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>payment-spring-boot-autoconfigure</artifactId>
|
||||
<version>1.0.17.RELEASE</version>
|
||||
<version>1.0.18.RELEASE</version>
|
||||
<packaging>jar</packaging>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -20,9 +20,10 @@ package cn.felord.payment.wechat;
|
||||
import cn.felord.payment.wechat.v3.KeyPairFactory;
|
||||
import cn.felord.payment.wechat.v3.WechatMetaBean;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.FileSystemResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.core.io.ResourceLoader;
|
||||
import org.springframework.util.ResourceUtils;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -37,6 +38,7 @@ import java.util.stream.Collectors;
|
||||
@AllArgsConstructor
|
||||
public class InMemoryWechatTenantService implements WechatTenantService {
|
||||
private final WechatPayProperties wechatPayProperties;
|
||||
private final ResourceLoader resourceLoader;
|
||||
|
||||
@Override
|
||||
public Set<WechatMetaBean> loadTenants() {
|
||||
@@ -51,7 +53,8 @@ public class InMemoryWechatTenantService implements WechatTenantService {
|
||||
String certAbsolutePath = v3.getCertAbsolutePath();
|
||||
String mchId = v3.getMchId();
|
||||
Resource resource = certAbsolutePath != null ? new FileSystemResource(certAbsolutePath) :
|
||||
new ClassPathResource(certPath == null ? "wechat/apiclient_cert.p12" : certPath);
|
||||
resourceLoader.getResource(certPath == null ? "classpath:wechat/apiclient_cert.p12" :
|
||||
certPath.startsWith(ResourceUtils.CLASSPATH_URL_PREFIX) ? certPath : ResourceUtils.CLASSPATH_URL_PREFIX + certPath);
|
||||
WechatMetaBean wechatMetaBean = keyPairFactory.initWechatMetaBean(resource, mchId);
|
||||
wechatMetaBean.setV3(v3);
|
||||
wechatMetaBean.setTenantId(tenantId);
|
||||
|
||||
@@ -43,9 +43,7 @@ public class WechatPayConfiguration {
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
WechatMetaContainer wechatMetaContainer(WechatTenantService wechatTenantService) {
|
||||
WechatMetaContainer container = new WechatMetaContainer();
|
||||
container.addWechatMetas(wechatTenantService.loadTenants());
|
||||
return container;
|
||||
return new WechatMetaContainer(wechatTenantService);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Conditional;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.io.ResourceLoader;
|
||||
|
||||
/**
|
||||
* The type Wechat tenant service configuration.
|
||||
@@ -42,7 +43,7 @@ public class WechatTenantServiceConfiguration {
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public WechatTenantService wechatTenantService(WechatPayProperties wechatPayProperties) {
|
||||
return new InMemoryWechatTenantService(wechatPayProperties);
|
||||
public WechatTenantService wechatTenantService(WechatPayProperties wechatPayProperties, ResourceLoader resourceLoader) {
|
||||
return new InMemoryWechatTenantService(wechatPayProperties, resourceLoader);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Copyright 2019-2022 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;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* @author felord.cn
|
||||
* @since 1.0.4.RELEASE
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class RefundModel extends BaseModel {
|
||||
|
||||
private String appid;
|
||||
private String mchId;
|
||||
private String signType="MD5";
|
||||
private String transactionId;
|
||||
private String outTradeNo;
|
||||
private String outRefundNo;
|
||||
private Integer totalFee;
|
||||
private Integer refundFee;
|
||||
private String refundFeeType="CNY";
|
||||
private String refundDesc;
|
||||
private String refundAccount;
|
||||
private String notifyUrl;
|
||||
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Copyright 2019-2022 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;
|
||||
|
||||
/**
|
||||
* @author felord.cn
|
||||
* @since 1.0.4.RELEASE
|
||||
*/
|
||||
public class RefundQueryModel {
|
||||
}
|
||||
@@ -17,6 +17,9 @@
|
||||
package cn.felord.payment.wechat.v3;
|
||||
|
||||
|
||||
import cn.felord.payment.wechat.WechatTenantService;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentSkipListSet;
|
||||
@@ -27,10 +30,11 @@ import java.util.concurrent.ConcurrentSkipListSet;
|
||||
* @author felord.cn
|
||||
* @since 1.0.0.RELEASE
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
public class WechatMetaContainer {
|
||||
private final Map<String, WechatMetaBean> wechatMetaBeanMap = new ConcurrentHashMap<>();
|
||||
private final Set<String> tenantIds = new ConcurrentSkipListSet<>();
|
||||
|
||||
private final WechatTenantService wechatTenantService;
|
||||
|
||||
/**
|
||||
* Add wechat metas.
|
||||
@@ -66,7 +70,14 @@ public class WechatMetaContainer {
|
||||
* @return the wechat meta
|
||||
*/
|
||||
public WechatMetaBean getWechatMeta(String tenantId) {
|
||||
return Objects.requireNonNull(this.wechatMetaBeanMap.get(tenantId));
|
||||
WechatMetaBean wechatMetaBean = this.wechatMetaBeanMap.get(tenantId);
|
||||
if (Objects.nonNull(wechatMetaBean)) {
|
||||
return wechatMetaBean;
|
||||
} else {
|
||||
this.addWechatMetas(wechatTenantService.loadTenants());
|
||||
return Objects.requireNonNull(this.wechatMetaBeanMap.get(tenantId),
|
||||
"cant obtain the config with tenant: "+tenantId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,11 +22,11 @@
|
||||
<parent>
|
||||
<groupId>cn.felord</groupId>
|
||||
<artifactId>payment-spring-boot</artifactId>
|
||||
<version>1.0.17.RELEASE</version>
|
||||
<version>1.0.18.RELEASE</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>payment-spring-boot-starter</artifactId>
|
||||
<version>1.0.17.RELEASE</version>
|
||||
<version>1.0.18.RELEASE</version>
|
||||
<packaging>jar</packaging>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
4
pom.xml
4
pom.xml
@@ -21,7 +21,7 @@
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<groupId>cn.felord</groupId>
|
||||
<artifactId>payment-spring-boot</artifactId>
|
||||
<version>1.0.17.RELEASE</version>
|
||||
<version>1.0.18.RELEASE</version>
|
||||
<packaging>pom</packaging>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
</developers>
|
||||
|
||||
<scm>
|
||||
<tag>payment-spring-boot-1.0.14.RELEASE</tag>
|
||||
<tag>payment-spring-boot-1.0.18.RELEASE</tag>
|
||||
<url>https://github.com/NotFound403/payment-spring-boot</url>
|
||||
<connection>scm:git:https://github.com/NotFound403/payment-spring-boot.git</connection>
|
||||
<developerConnection>scm:git:https://github.com/NotFound403/payment-spring-boot.git</developerConnection>
|
||||
|
||||
Reference in New Issue
Block a user