31 Commits

Author SHA1 Message Date
xiafang
2bd091e268 init 2.0.0 2023-06-27 14:01:26 +08:00
xiafang
1ba456f5dd - 电商二级商户进件补充最终受益人列表 2023-06-27 14:00:52 +08:00
xiafang
0635d59666 1.0.19 2023-06-24 11:29:11 +08:00
xiafang
5941907d7c feat: 支付有礼-直连商户 2023-06-21 15:15:22 +08:00
xiafang
348fe9b5f1 enhance: 代金券商家券样式兼容 2023-06-20 09:34:20 +08:00
xiafang
fa0cc541de fix:服务商模式下预支付的签名问题
Closes #I7829T
2023-06-20 08:35:22 +08:00
xiafang
85fde9bb68 优化默认的证书加载,增加缓存 2023-05-22 14:07:24 +08:00
xiafang
da0fe928eb Merge README.md 2023-05-05 12:55:33 +08:00
felord.cn
1c27375d93 Merge pull request #99 from dromara/1.0.18
1.0.18
2023-05-05 12:44:37 +08:00
xiafang
4271491bc3 Merge README.md 2023-05-05 12:41:23 +08:00
xiafang
730c15b6b8 Update pom.xml 2023-05-05 12:33:21 +08:00
xiafang
dc6e48d538 enhance: 修改了支付配置加载机制,现在可以不停机维护微信支付参数了 2023-05-05 12:20:06 +08:00
xiafang
36259fc8ac 更新群信息 2023-04-25 11:00:18 +08:00
xiafang
e6e704cc28 docs: 修正文档描述错误 2023-03-24 13:43:34 +08:00
xiafang
8578300d1c docs: 修正文档描述错误 2023-03-24 13:40:32 +08:00
Fang
d7cdebc731 docs: 项目文档迁入dromara
Closes #96
2023-03-12 20:54:25 +08:00
felord.cn
97d87ce6f0 Delete 提问.md 2023-03-11 08:53:13 +08:00
felord.cn
99136f9bd6 Update issue templates 2023-03-11 08:52:15 +08:00
felord.cn
571bd2e563 Update issue templates 2023-03-11 08:49:32 +08:00
Fang
aef8ef9ac3 factor:移除过时的V2退款API 2023-03-10 22:32:52 +08:00
Fang
f630301bc3 docs:更新文档地址到dromara组织 2023-03-10 22:31:06 +08:00
xiafang
f7ba4dd306 1.0.18 2023-03-08 13:39:11 +08:00
Fang
997f004708 enhance: 增强资源加载器 2023-03-06 22:31:55 +08:00
xiafang
5e63779f36 1.0.18 2023-03-01 09:29:36 +08:00
xiafang
30613a2fdd enhance: 优化证书加载方式以支持Docker内读取
Closes #94
2023-03-01 09:24:51 +08:00
felord.cn
e9388f62c1 Update changelog.md 2023-02-26 14:33:38 +08:00
xiafang
685839089f README.md 2023-02-25 17:16:29 +08:00
xiafang
7b9bdd21f7 README.md 2023-02-25 16:56:37 +08:00
xiafang
8c4ecad809 README.md 2023-02-25 16:52:29 +08:00
xiafang
e24aa83ba0 README.md 2023-02-25 16:47:36 +08:00
felord.cn
d6d5e33dae Merge pull request #93 from NotFound403/1.0.17
1.0.17
2023-02-25 16:41:16 +08:00
45 changed files with 1404 additions and 174 deletions

27
.github/ISSUE_TEMPLATE/issues.md vendored Normal file
View File

@@ -0,0 +1,27 @@
---
name: issues
about: 向维护者提问以帮助改进
title: ''
labels: ''
assignees: ''
---
**提问前的思考**
1. 我是否已经认真阅读了文档和相关操作说明
2. 其它ISSUES是否已经有了解决方案
**描述问题**
提问时应该按照以下要点清晰地描述问题,才能得到可靠的答复
**环境版本信息**
问题发生的环境,不限于软件版本、运行时环境、操作系统等
**操作行为**
产生问题的操作行为
**期望的结果**
清晰地描述期望达成的结果
**代码与截图**
通常不建议使用代码截图这样不太方便维护者进行Preview。代码应该使用Markdown代码块进行格式化。因交互导致的问题才建议使用截图辅助排查。

View File

@@ -1,8 +1,8 @@
<div align="center" style="margin-bottom: 10px"><h1>最全最好用的微信支付V3 Spring Boot 组件</h1></div> <div align="center" style="margin-bottom: 10px"><h1>最全最好用的微信支付V3 Spring Boot 组件</h1></div>
<p align="center"> <p align="center">
<a target="_blank" href="https://github.com/NotFound403/payment-spring-boot/blob/release/LICENSE"> <a target="_blank" href="https://github.com/dromara/payment-spring-boot/blob/release/LICENSE">
<img alt="" src="https://img.shields.io/github/license/NotFound403/payment-spring-boot"/> <img alt="" src="https://img.shields.io/github/license/dromara/payment-spring-boot"/>
</a> </a>
<a target="_blank" href="https://felord.cn"> <a target="_blank" href="https://felord.cn">
<img alt="" src="https://img.shields.io/badge/java-8-red"/> <img alt="" src="https://img.shields.io/badge/java-8-red"/>
@@ -13,17 +13,20 @@
<a target="_blank" href="https://mvnrepository.com/artifact/cn.felord/payment-spring-boot"> <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"/> <img alt="" src="https://img.shields.io/maven-central/v/cn.felord/payment-spring-boot.svg?style=flat-square"/>
</a> </a>
<a target="_blank" href="https://github.com/NotFound403/payment-spring-boot"> <a target="_blank" href="https://github.com/dromara/payment-spring-boot">
<img alt="" src="https://img.shields.io/github/stars/NotFound403/payment-spring-boot?style=social"/> <img alt="" src="https://img.shields.io/github/stars/dromara/payment-spring-boot?style=social"/>
</a> </a>
<a target="_blank" href="https://gitee.com/felord/payment-spring-boot/stargazers"> <a target="_blank" href="https://gitee.com/dromara/payment-spring-boot/stargazers">
<img alt="" src="https://gitee.com/felord/payment-spring-boot/badge/star.svg?theme=white"/> <img alt="" src="https://gitee.com/felord/payment-spring-boot/badge/star.svg?theme=white"/>
</a> </a>
<a target="_blank" href="https://work.weixin.qq.com/kfid/kfc9d9d759f27f087e1"> <a target="_blank" href="https://work.weixin.qq.com/kfid/kfc9d9d759f27f087e1">
<img alt="点击立即微信咨询" src="https://img.shields.io/badge/%E7%82%B9%E5%87%BB-%E5%BE%AE%E4%BF%A1%E5%92%A8%E8%AF%A2-brightgreen"/> <img alt="点击立即微信咨询" src="https://img.shields.io/badge/%E7%82%B9%E5%87%BB-%E5%BE%AE%E4%BF%A1%E5%92%A8%E8%AF%A2-brightgreen"/>
</a> </a>
<a target="_blank" href="https://jq.qq.com/?_wv=1027&k=qRTKHWY0"> <a target="_blank" href="#">
<img alt="点击加入QQ交流" src="https://img.shields.io/badge/QQ%E4%BA%A4%E6%B5%81%E7%BE%A4-945342113-ff69b4"/> <img alt="点击加入QQ交流①群(满)" src="https://img.shields.io/badge/QQ%E4%BA%A4%E6%B5%81%E7%BE%A4-945342113(满)-ff69b4"/>
</a>
<a target="_blank" href="https://jq.qq.com/?_wv=1027&k=cCiv8Vlv">
<img alt="点击加入QQ交流②群" src="https://img.shields.io/badge/QQ%E4%BA%A4%E6%B5%81%E7%BE%A4-549174561-ff69b4"/>
</a> </a>
</p> </p>
@@ -42,46 +45,33 @@ Starter支持微信优惠券代金券、商家券、智慧商圈、商家
<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.17.RELEASE</version> <version>1.0.19.RELEASE</version>
</dependency> </dependency>
``` ```
## JDK问题 ## 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) - [payment-spring-boot GitHub文档](https://dromara.github.io/payment-spring-boot)
## 目前已经实现所有服务商和直连商户接口
- 实现微信支付多商户
- 集成支付宝SDK、快速接入Spring Boot
- 实现微信支付V3 基础支付
- 实现微信支付V3 合单支付
- 实现微信支付V3 代金券
- 实现微信支付V3 微信支付分
- 实现微信支付V3 先享卡
- 实现微信支付V3 商家券
- 实现微信支付V3 批量转账到零钱
更新日志参考[changelog](https://notfound403.github.io/payment-spring-boot/#/changelog)
## API清单 ## API清单
API结构如下 目前已经实现绝大部分微信支付直连商户和服务商的接口具体的API明细可查看[API清单](https://dromara.github.io/payment-spring-boot/#/wechat_v3_api)
![](https://asset.felord.cn/blog/20220613092244.png) > 随着版本迭代功能会增加也可通过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) 关于集成配置请详细阅读[payment-spring-boot GitHub文档](https://dromara.github.io/payment-spring-boot)
中[快速接入](https://notfound403.github.io/payment-spring-boot/#/quick_start)章节 中[快速接入](https://dromara.github.io/payment-spring-boot/#/quick_start)章节
### 调用示例 ### 调用示例
@@ -360,11 +350,6 @@ 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) - [Gitee](https://gitee.com/dromara/payment-spring-boot)
## QQ交流群
为了交流解惑新建QQ群可通过扫码进入。
![QQ交流群](./docs/img/qqun.png)

View File

@@ -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.17.RELEASE</version> <version>1.0.19.RELEASE</version>
</dependency> </dependency>
``` ```
## 采用技术 ## 采用技术

View File

@@ -2,6 +2,6 @@
* [项目简介](README.md) * [项目简介](README.md)
* [快速接入](quick_start.md) * [快速接入](quick_start.md)
* [JavaDoc](apidocs/index.html ':ignore') * [JavaDoc](apidocs/index.html ':ignore')
* [微信支付V3接口文档](wechat_v3_api.md) * [Payment微信支付V3接口文档](wechat_v3_api.md)
* [日常踩坑](stackoverflow.md) * [日常踩坑](stackoverflow.md)
* [更新日志](changelog.md) * [更新日志](changelog.md)

View File

@@ -1,3 +1,20 @@
## 1.0.18.RELEASE
### 微信支付
- enhance: 使用`ResourceLoader`加载资源以改善Docker容器环境下的文件挂载问题
- enhance: 修改了微信支付配置加载机制,现在可以借助于`WechatTenantService`实现不停机维护微信支付参数的能力
- factor: 移除过时的V2退款API相关参数`RefundModel``RefundQueryModel`
- docs: 更新文档地址到[dromara.org](https://gitee.com/dromara),现在你可以通过[https://dromara.org/payment-spring-boot/](https://dromara.org/payment-spring-boot/)访问项目文档
- docs: 修正文档描述错误
## 1.0.17.RELEASE
### 微信支付
- feat: 直连商户合单支付增加查询单笔退款
- feat: 支付分增加退款独立的API
- factor: 营销图片上传API现在由WechatMediaApi#marketingImageUpload实现以代替WechatMarketingFavorApi#marketingImageUpload,旧实现已标记为过时
- factor:时间格式优化移除时区限制为东八区由LocalDateTime改为OffsetDateTime
- docs: 现在可以通过API清单检索API了
## 1.0.16.RELEASE ## 1.0.16.RELEASE
### 微信支付 ### 微信支付
- feat: 直连商户-委托营销相关API实现 - feat: 直连商户-委托营销相关API实现

View File

@@ -4,7 +4,7 @@
<dependency> <dependency>
<groupId>cn.felord</groupId> <groupId>cn.felord</groupId>
<artifactId>payment-spring-boot-starter</artifactId> <artifactId>payment-spring-boot-starter</artifactId>
<version>1.0.17.RELEASE</version> <version>1.0.19.RELEASE</version>
</dependency> </dependency>
``` ```
> 基于 **Spring Boot 2.x** > 基于 **Spring Boot 2.x**

View File

@@ -10,8 +10,8 @@
#### 基础支付 #### 基础支付
- [x] `WechatDirectPayApi` 基础支付,通过`WechatApiProvider#directPayApi`初始化 - [x] `WechatDirectPayApi` 基础支付,通过`WechatApiProvider#directPayApi`初始化
- [x] `jsPay` APP下单 - [x] `jsPay` JSAPI/小程序下单
- [x] `appPay` JSAPI/小程序下单 - [x] `appPay` APP下单
- [x] `h5Pay` H5下单 - [x] `h5Pay` H5下单
- [x] `nativePay` Native下单 - [x] `nativePay` Native下单
- [x] 查询订单 - [x] 查询订单
@@ -25,8 +25,8 @@
- [x] `downloadTradeBill` 申请交易账单直接下载为gzip或者txt文件 - [x] `downloadTradeBill` 申请交易账单直接下载为gzip或者txt文件
- [x] `downloadFundFlowBill` 申请资金账单直接下载为gzip或者txt文件 - [x] `downloadFundFlowBill` 申请资金账单直接下载为gzip或者txt文件
- [x] `WechatCombinePayApi` 合单支付,通过`WechatApiProvider#combinePayApi`初始化 - [x] `WechatCombinePayApi` 合单支付,通过`WechatApiProvider#combinePayApi`初始化
- [x] `jsPay` 合单APP下单 - [x] `jsPay` 合单JSAPI/小程序下单
- [x] `appPay` 合单JSAPI/小程序下单 - [x] `appPay` 合单APP下单
- [x] `h5Pay` 合单H5下单 - [x] `h5Pay` 合单H5下单
- [x] `nativePay` 合单Native下单 - [x] `nativePay` 合单Native下单
- [x] `queryTransactionByOutTradeNo` 查询订单,**合单支付目前只支持商户订单号查询** - [x] `queryTransactionByOutTradeNo` 查询订单,**合单支付目前只支持商户订单号查询**
@@ -153,7 +153,15 @@
##### 支付有礼 ##### 支付有礼
- [ ] 功能实现中…… - [x] `WechatMarketingPayGiftActivityApi` 支付有礼,通过`WechatApiProvider#marketingPayGiftActivityApi`初始化
- [x] `create` 创建全场满额送活动
- [x] `details` 查询活动详情接口
- [x] `merchants` 查询活动发券商户号
- [x] `goods` 查询活动指定商品列表
- [x] `terminate` 终止活动
- [x] `addMches` 新增活动发券商户号
- [x] `page` 获取支付有礼活动列表
- [x] `deleteMch` 删除活动发券商户号
##### 图片上传(营销专用) ##### 图片上传(营销专用)
@@ -186,9 +194,6 @@
- [x] 申请转账明细电子回单 - [x] 申请转账明细电子回单
1. `transferElectronic` 受理转账明细电子回单 1. `transferElectronic` 受理转账明细电子回单
2. `queryTransferElectronicResult` 查询转账账单电子回单接口 2. `queryTransferElectronicResult` 查询转账账单电子回单接口
- [x] 申请转账电子回单
1. `` 转账账单电子回单申请受理接口
2. `` 查询转账账单电子回单接口
##### 分账 ##### 分账
@@ -225,3 +230,7 @@
- [x] `marketingImageUpload` 营销图片上传 - [x] `marketingImageUpload` 营销图片上传
> 通过营销**图片上传API**上传图片后可获得图片url地址。图片url可在微信支付营销相关的API使用包括商家券、代金券、支付有礼等。 > 通过营销**图片上传API**上传图片后可获得图片url地址。图片url可在微信支付营销相关的API使用包括商家券、代金券、支付有礼等。
### 服务商
施工中……

View File

@@ -22,11 +22,11 @@
<parent> <parent>
<groupId>cn.felord</groupId> <groupId>cn.felord</groupId>
<artifactId>payment-spring-boot</artifactId> <artifactId>payment-spring-boot</artifactId>
<version>1.0.17.RELEASE</version> <version>1.0.19.RELEASE</version>
</parent> </parent>
<artifactId>payment-spring-boot-autoconfigure</artifactId> <artifactId>payment-spring-boot-autoconfigure</artifactId>
<version>1.0.17.RELEASE</version> <version>1.0.19.RELEASE</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@@ -64,6 +64,42 @@
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>com.squareup.retrofit2</groupId>
<artifactId>retrofit</artifactId>
</dependency>
<dependency>
<groupId>com.squareup.retrofit2</groupId>
<artifactId>adapter-rxjava3</artifactId>
</dependency>
<dependency>
<groupId>com.squareup.retrofit2</groupId>
<artifactId>converter-jaxb</artifactId>
</dependency>
<dependency>
<groupId>com.squareup.retrofit2</groupId>
<artifactId>converter-jackson</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>logging-interceptor</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.bouncycastle</groupId> <groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15to18</artifactId> <artifactId>bcprov-jdk15to18</artifactId>

View File

@@ -20,10 +20,13 @@ package cn.felord.payment.wechat;
import cn.felord.payment.wechat.v3.KeyPairFactory; import cn.felord.payment.wechat.v3.KeyPairFactory;
import cn.felord.payment.wechat.v3.WechatMetaBean; import cn.felord.payment.wechat.v3.WechatMetaBean;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.FileSystemResource; import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ResourceUtils;
import java.util.HashSet;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -31,32 +34,39 @@ import java.util.stream.Collectors;
/** /**
* 从配置文件中加载租户信息,默认实现,可被覆盖 * 从配置文件中加载租户信息,默认实现,可被覆盖
* *
* @author xiafang * @author dax
* @since 2023/2/3 11:40 * @since 2023/2/3 11:40
*/ */
@AllArgsConstructor @AllArgsConstructor
public class InMemoryWechatTenantService implements WechatTenantService { public class InMemoryWechatTenantService implements WechatTenantService {
private final WechatPayProperties wechatPayProperties; private final WechatPayProperties wechatPayProperties;
private final ResourceLoader resourceLoader;
private final Set<WechatMetaBean> cache = new HashSet<>();
@Override @Override
public Set<WechatMetaBean> loadTenants() { public Set<WechatMetaBean> loadTenants() {
Map<String, WechatPayProperties.V3> v3Map = wechatPayProperties.getV3(); if (CollectionUtils.isEmpty(cache)) {
KeyPairFactory keyPairFactory = new KeyPairFactory(); Map<String, WechatPayProperties.V3> v3Map = wechatPayProperties.getV3();
return v3Map.entrySet() KeyPairFactory keyPairFactory = new KeyPairFactory();
.stream() Set<WechatMetaBean> beans = v3Map.entrySet()
.map(entry -> { .stream()
WechatPayProperties.V3 v3 = entry.getValue(); .map(entry -> {
String tenantId = entry.getKey(); WechatPayProperties.V3 v3 = entry.getValue();
String certPath = v3.getCertPath(); String tenantId = entry.getKey();
String certAbsolutePath = v3.getCertAbsolutePath(); String certPath = v3.getCertPath();
String mchId = v3.getMchId(); String certAbsolutePath = v3.getCertAbsolutePath();
Resource resource = certAbsolutePath != null ? new FileSystemResource(certAbsolutePath) : String mchId = v3.getMchId();
new ClassPathResource(certPath == null ? "wechat/apiclient_cert.p12" : certPath); Resource resource = certAbsolutePath != null ? new FileSystemResource(certAbsolutePath) :
WechatMetaBean wechatMetaBean = keyPairFactory.initWechatMetaBean(resource, mchId); resourceLoader.getResource(certPath == null ? "classpath:wechat/apiclient_cert.p12" :
wechatMetaBean.setV3(v3); certPath.startsWith(ResourceUtils.CLASSPATH_URL_PREFIX) ? certPath : ResourceUtils.CLASSPATH_URL_PREFIX + certPath);
wechatMetaBean.setTenantId(tenantId); WechatMetaBean wechatMetaBean = keyPairFactory.initWechatMetaBean(resource, mchId);
return wechatMetaBean; wechatMetaBean.setV3(v3);
}) wechatMetaBean.setTenantId(tenantId);
.collect(Collectors.toSet()); return wechatMetaBean;
})
.collect(Collectors.toSet());
cache.addAll(beans);
}
return cache;
} }
} }

View File

@@ -43,9 +43,7 @@ public class WechatPayConfiguration {
@Bean @Bean
@ConditionalOnMissingBean @ConditionalOnMissingBean
WechatMetaContainer wechatMetaContainer(WechatTenantService wechatTenantService) { WechatMetaContainer wechatMetaContainer(WechatTenantService wechatTenantService) {
WechatMetaContainer container = new WechatMetaContainer(); return new WechatMetaContainer(wechatTenantService);
container.addWechatMetas(wechatTenantService.loadTenants());
return container;
} }
/** /**

View File

@@ -22,6 +22,7 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ResourceLoader;
/** /**
* The type Wechat tenant service configuration. * The type Wechat tenant service configuration.
@@ -42,7 +43,7 @@ public class WechatTenantServiceConfiguration {
*/ */
@Bean @Bean
@ConditionalOnMissingBean @ConditionalOnMissingBean
public WechatTenantService wechatTenantService(WechatPayProperties wechatPayProperties) { public WechatTenantService wechatTenantService(WechatPayProperties wechatPayProperties, ResourceLoader resourceLoader) {
return new InMemoryWechatTenantService(wechatPayProperties); return new InMemoryWechatTenantService(wechatPayProperties, resourceLoader);
} }
} }

View File

@@ -0,0 +1,58 @@
/*
* 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.enumeration;
/**
* The enum Activity status.
*
* @author dax
* @since 1.0.19.RELEASE
*/
public enum ActivityStatus {
/**
* 状态未知
*/
ACT_STATUS_UNKNOWN,
/**
* 已创建
*/
CREATE_ACT_STATUS,
/**
* 运行中
*/
ONGOING_ACT_STATUS,
/**
* 已终止
*/
TERMINATE_ACT_STATUS,
/**
* 已暂停
*/
STOP_ACT_STATUS,
/**
* 已过期
*/
OVER_TIME_ACT_STATUS,
/**
* 创建活动失败
*/
CREATE_ACT_FAILED
}

View File

@@ -15,11 +15,17 @@
* limitations under the License. * limitations under the License.
*/ */
package cn.felord.payment.wechat.v2.model; package cn.felord.payment.wechat.enumeration;
/** /**
* @author felord.cn * The enum Award type.
* @since 1.0.4.RELEASE *
* @author dax
* @since 1.0.19.RELEASE
*/ */
public class RefundQueryModel { public enum AwardType {
/**
* 商家券
*/
BUSIFAVOR
} }

View File

@@ -28,41 +28,57 @@ public enum CouponBgColor {
/** /**
* Color 010 coupon bg color. * Color 010 coupon bg color.
*/ */
COLOR010, COLOR010("Color010"),
/** /**
* COLOR 020 coupon bg color. * COLOR 020 coupon bg color.
*/ */
COLOR020, COLOR020("Color010"),
/** /**
* COLOR 030 coupon bg color. * COLOR 030 coupon bg color.
*/ */
COLOR030, COLOR030("Color010"),
/** /**
* COLOR 040 coupon bg color. * COLOR 040 coupon bg color.
*/ */
COLOR040, COLOR040("Color010"),
/** /**
* COLOR 050 coupon bg color. * COLOR 050 coupon bg color.
*/ */
COLOR050, COLOR050("Color010"),
/** /**
* COLOR 060 coupon bg color. * COLOR 060 coupon bg color.
*/ */
COLOR060, COLOR060("Color010"),
/** /**
* COLOR 070 coupon bg color. * COLOR 070 coupon bg color.
*/ */
COLOR070, COLOR070("Color010"),
/** /**
* COLOR 080 coupon bg color. * COLOR 080 coupon bg color.
*/ */
COLOR080, COLOR080("Color010"),
/** /**
* COLOR 090 coupon bg color. * COLOR 090 coupon bg color.
*/ */
COLOR090, COLOR090("Color010"),
/** /**
* COLOR 100 coupon bg color. * COLOR 100 coupon bg color.
*/ */
COLOR100 COLOR100("Color010");
private final String value;
CouponBgColor(String value) {
this.value = value;
}
/**
* Gets value.
*
* @return the value
*/
public String getValue() {
return value;
}
} }

View File

@@ -0,0 +1,35 @@
/*
* 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.enumeration;
/**
* The enum Delivery purpose.
*
* @author felord.cn
* @since 1.0.19.RELEASE
*/
public enum DeliveryPurpose {
/**
* 拉用户回店消费
*/
OFF_LINE_PAY,
/**
* 引导用户前往小程序消费
*/
JUMP_MINI_APP
}

View File

@@ -0,0 +1,33 @@
/*
* 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.enumeration;
/**
* @author dax
* @since 1.0.19.RELEASE
*/
public enum DeliveryUserCategory {
/**
* 所有用户
*/
DELIVERY_ALL_PERSON,
/**
* 会员用户
*/
DELIVERY_MEMBER_PERSON
}

View File

@@ -0,0 +1,35 @@
/*
* 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.enumeration;
/**
* The enum Send content.
*
* @author dax
* @since 1.0.19.RELEASE
*/
public enum SendContent {
/**
* 单张券
*/
SINGLE_COUPON,
/**
* 礼包
*/
GIFT_PACKAGE
}

View File

@@ -20,7 +20,7 @@ package cn.felord.payment.wechat.enumeration;
import lombok.Getter; import lombok.Getter;
/** /**
* @author xiafang * @author dax
* @since 2023/2/1 8:59 * @since 2023/2/1 8:59
*/ */
@Getter @Getter

View File

@@ -507,6 +507,55 @@ public enum WechatPayV3Type {
*/ */
MARKETING_PARTNERSHIPS_GET(HttpMethod.GET, "%s/v3/marketing/partnerships"), MARKETING_PARTNERSHIPS_GET(HttpMethod.GET, "%s/v3/marketing/partnerships"),
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/**
* 创建全场满额送活动API
*
* @since 1.0.19.RELEASES
*/
MARKETING_PAYGIFTACTIVITY(HttpMethod.POST, "%s/v3/marketing/paygiftactivity/unique-threshold-activity"),
/**
* 查询活动详情接口API
*
* @since 1.0.19.RELEASES
*/
MARKETING_PAYGIFTACTIVITY_DETAIL(HttpMethod.GET, "%s/v3/marketing/paygiftactivity/activities/{activity_id}"),
/**
* 查询活动发券商户号API
*
* @since 1.0.19.RELEASES
*/
MARKETING_PAYGIFTACTIVITY_MCH(HttpMethod.GET, "%s/v3/marketing/paygiftactivity/activities/{activity_id}/merchants"),
/**
* 查询活动指定商品列表API
*
* @since 1.0.19.RELEASES
*/
MARKETING_PAYGIFTACTIVITY_GOODS(HttpMethod.GET, "%s/v3/marketing/paygiftactivity/activities/{activity_id}/goods"),
/**
* 终止活动API
*
* @since 1.0.19.RELEASES
*/
MARKETING_PAYGIFTACTIVITY_TERMINATE(HttpMethod.POST, "%s/v3/marketing/paygiftactivity/activities/{activity_id}/terminate"),
/**
* 新增活动发券商户号API
*
* @since 1.0.19.RELEASES
*/
MARKETING_PAYGIFTACTIVITY_MCH_ADD(HttpMethod.POST, "%s/v3/marketing/paygiftactivity/activities/{activity_id}/merchants/add"),
/**
* 获取支付有礼活动列表API
*
* @since 1.0.19.RELEASES
*/
MARKETING_PAYGIFTACTIVITY_ACTIVITIES(HttpMethod.GET, "%s/v3/marketing/paygiftactivity/activities"),
/**
* 删除活动发券商户号API
*
* @since 1.0.19.RELEASES
*/
MARKETING_PAYGIFTACTIVITY_MCH_DEL(HttpMethod.POST, "%s/v3/marketing/paygiftactivity/activities/{activity_id}/merchants/delete"),
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/** /**
* 发起批量转账API. * 发起批量转账API.

View File

@@ -73,7 +73,7 @@ import java.util.stream.Collectors;
*/ */
@Getter @Getter
public abstract class BaseModel { public abstract class BaseModel {
public static final String HMAC_SHA256="HMAC-SHA256"; 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,8 +84,7 @@ public abstract class BaseModel {
.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE); .setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE);
OBJECT_MAPPER OBJECT_MAPPER
// .configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, true) // .configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, true)
.setSerializationInclusion(JsonInclude.Include.NON_NULL) .setSerializationInclusion(JsonInclude.Include.NON_NULL);
.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE);
} }
@@ -165,7 +164,7 @@ public abstract class BaseModel {
@SneakyThrows @SneakyThrows
private String hmacSha256(String src) { private String hmacSha256(String src) {
String algorithm = "HmacSHA256"; String algorithm = "HmacSHA256";
Mac sha256HMAC = Mac.getInstance(algorithm,"BC"); Mac sha256HMAC = Mac.getInstance(algorithm, "BC");
SecretKeySpec secretKeySpec = new SecretKeySpec(appSecret.getBytes(), algorithm); SecretKeySpec secretKeySpec = new SecretKeySpec(appSecret.getBytes(), algorithm);
sha256HMAC.init(secretKeySpec); sha256HMAC.init(secretKeySpec);
byte[] bytes = sha256HMAC.doFinal(src.getBytes(StandardCharsets.UTF_8)); byte[] bytes = sha256HMAC.doFinal(src.getBytes(StandardCharsets.UTF_8));
@@ -182,7 +181,7 @@ 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");
String json = OBJECT_MAPPER String json = OBJECT_MAPPER
.writeValueAsString(t); .writeValueAsString(t);
TreeMap<String, String> map = OBJECT_MAPPER.readValue(json, new TypeReference<TreeMap<String, String>>() { TreeMap<String, String> map = OBJECT_MAPPER.readValue(json, new TypeReference<TreeMap<String, String>>() {
@@ -200,8 +199,8 @@ public abstract class BaseModel {
public JsonNode request(String mchId, HttpMethod method, String url) { public JsonNode request(String mchId, HttpMethod method, String url) {
String xml = this.xml(); String xml = this.xml();
RequestEntity<String> body = RequestEntity.method(method, UriComponentsBuilder.fromHttpUrl(url) RequestEntity<String> body = RequestEntity.method(method, UriComponentsBuilder.fromHttpUrl(url)
.build() .build()
.toUri()) .toUri())
.contentType(MediaType.valueOf("application/x-www-form-urlencoded;charset=UTF-8")) .contentType(MediaType.valueOf("application/x-www-form-urlencoded;charset=UTF-8"))
.body(xml); .body(xml);
ResponseEntity<String> responseEntity = this.getRestTemplateClientAuthentication(mchId) ResponseEntity<String> responseEntity = this.getRestTemplateClientAuthentication(mchId)

View File

@@ -27,11 +27,7 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.bouncycastle.jce.provider.BouncyCastleProvider; import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.springframework.http.HttpHeaders; import org.springframework.http.*;
import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;
import org.springframework.http.RequestEntity;
import org.springframework.http.ResponseEntity;
import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.xml.MappingJackson2XmlHttpMessageConverter; import org.springframework.http.converter.xml.MappingJackson2XmlHttpMessageConverter;
import org.springframework.util.AlternativeJdkIdGenerator; import org.springframework.util.AlternativeJdkIdGenerator;
@@ -54,8 +50,7 @@ import java.security.cert.Certificate;
import java.security.cert.CertificateException; import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory; import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate; import java.security.cert.X509Certificate;
import java.time.LocalDateTime; import java.time.Instant;
import java.time.ZoneOffset;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -135,7 +130,7 @@ public class SignatureProvider {
@SneakyThrows @SneakyThrows
public String requestSign(String tenantId, String method, String canonicalUrl, String body) { public String requestSign(String tenantId, String method, String canonicalUrl, String body) {
long timestamp = LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8")); long timestamp = Instant.now().getEpochSecond();
String nonceStr = nonceStrGenerator.generateId() String nonceStr = nonceStrGenerator.generateId()
.toString() .toString()
.replaceAll("-", ""); .replaceAll("-", "");
@@ -175,7 +170,6 @@ public class SignatureProvider {
* @param params the params * @param params the params
* @return the boolean * @return the boolean
*/ */
@SneakyThrows
public boolean responseSignVerify(ResponseSignVerifyParams params) { public boolean responseSignVerify(ResponseSignVerifyParams params) {
String wechatpaySerial = params.getWechatpaySerial(); String wechatpaySerial = params.getWechatpaySerial();
@@ -190,13 +184,15 @@ public class SignatureProvider {
.orElseThrow(() -> new PayException("cannot obtain the certificate")); .orElseThrow(() -> new PayException("cannot obtain the certificate"));
}); });
try {
final String signatureStr = createSign(params.getWechatpayTimestamp(), params.getWechatpayNonce(), params.getBody()); final String signatureStr = createSign(params.getWechatpayTimestamp(), params.getWechatpayNonce(), params.getBody());
Signature signer = Signature.getInstance("SHA256withRSA", BC_PROVIDER); Signature signer = Signature.getInstance("SHA256withRSA", BC_PROVIDER);
signer.initVerify(certificate.getX509Certificate()); signer.initVerify(certificate.getX509Certificate());
signer.update(signatureStr.getBytes(StandardCharsets.UTF_8)); signer.update(signatureStr.getBytes(StandardCharsets.UTF_8));
return signer.verify(Base64Utils.decodeFromString(params.getWechatpaySignature()));
return signer.verify(Base64Utils.decodeFromString(params.getWechatpaySignature())); }catch (Exception e){
throw new PayException("An exception occurred during the response verification, the cause: "+e.getMessage());
}
} }

View File

@@ -140,6 +140,17 @@ public class WechatApiProvider {
return new WechatMarketingPartnershipApi(this.wechatPayClient, tenantId); return new WechatMarketingPartnershipApi(this.wechatPayClient, tenantId);
} }
/**
* 支付有礼-直连商户
*
* @param tenantId the tenant id
* @return the wechat marketing pay gift activity api
* @since 1.0.19.RELEASE
*/
public WechatMarketingPayGiftActivityApi marketingPayGiftActivityApi(String tenantId) {
return new WechatMarketingPayGiftActivityApi(this.wechatPayClient, tenantId);
}
/** /**
* 批量转账到零钱. * 批量转账到零钱.
* <p> * <p>

View File

@@ -0,0 +1,232 @@
/*
* 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.v3;
import cn.felord.payment.wechat.enumeration.WeChatServer;
import cn.felord.payment.wechat.enumeration.WechatPayV3Type;
import cn.felord.payment.wechat.v3.model.paygiftactivity.ActivitiesListPageRequest;
import cn.felord.payment.wechat.v3.model.paygiftactivity.ActivitiesPageRequest;
import cn.felord.payment.wechat.v3.model.paygiftactivity.DeleteActivityMchRequest;
import cn.felord.payment.wechat.v3.model.paygiftactivity.GiftActivityParams;
import cn.felord.payment.wechat.v3.model.paygiftactivity.NewActivityMchRequest;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.springframework.web.util.UriComponentsBuilder;
import java.net.URI;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
/**
* 支付有礼
*
* @author dax
* @since 1.0.19.RELEASE
*/
public class WechatMarketingPayGiftActivityApi extends AbstractApi {
/**
* Instantiates a new Abstract api.
*
* @param wechatPayClient the wechat pay client
* @param tenantId the tenant id
*/
public WechatMarketingPayGiftActivityApi(WechatPayClient wechatPayClient, String tenantId) {
super(wechatPayClient, tenantId);
}
/**
* 创建全场满额送活动API
*
* @param params the params
* @return the wechat response entity
*/
public WechatResponseEntity<ObjectNode> create(GiftActivityParams params) {
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
this.client().withType(WechatPayV3Type.MARKETING_PAYGIFTACTIVITY, params)
.function((type, activityParams) -> {
URI uri = UriComponentsBuilder.fromHttpUrl(type.uri(WeChatServer.CHINA))
.build()
.toUri();
return Post(uri, activityParams);
})
.consumer(wechatResponseEntity::convert)
.request();
return wechatResponseEntity;
}
/**
* 查询活动详情接口API
*
* @param activityId the activity id
* @return the wechat response entity
*/
public WechatResponseEntity<ObjectNode> details(String activityId) {
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
this.client().withType(WechatPayV3Type.MARKETING_PAYGIFTACTIVITY_DETAIL, activityId)
.function((type, param) -> {
URI uri = UriComponentsBuilder.fromHttpUrl(type.uri(WeChatServer.CHINA))
.build()
.expand(param)
.toUri();
return Get(uri);
})
.consumer(wechatResponseEntity::convert)
.request();
return wechatResponseEntity;
}
/**
* 查询活动发券商户号API
*
* @param request the request
* @return the wechat response entity
*/
public WechatResponseEntity<ObjectNode> merchants(ActivitiesPageRequest request) {
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
this.client().withType(WechatPayV3Type.MARKETING_PAYGIFTACTIVITY_MCH, request)
.function((type, params) -> {
URI uri = UriComponentsBuilder.fromHttpUrl(type.uri(WeChatServer.CHINA))
.queryParam("offset", params.getOffset())
.queryParam("limit", params.getLimit())
.build()
.expand(params.getActivityId())
.toUri();
return Get(uri);
})
.consumer(wechatResponseEntity::convert)
.request();
return wechatResponseEntity;
}
/**
* 查询活动指定商品列表API
*
* @param request the request
* @return the wechat response entity
*/
public WechatResponseEntity<ObjectNode> goods(ActivitiesPageRequest request) {
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
this.client().withType(WechatPayV3Type.MARKETING_PAYGIFTACTIVITY_GOODS, request)
.function((type, params) -> {
URI uri = UriComponentsBuilder.fromHttpUrl(type.uri(WeChatServer.CHINA))
.queryParam("offset", params.getOffset())
.queryParam("limit", params.getLimit())
.build()
.expand(params.getActivityId())
.toUri();
return Get(uri);
})
.consumer(wechatResponseEntity::convert)
.request();
return wechatResponseEntity;
}
/**
* 终止活动API
*
* @param activityId the activity id
* @return the wechat response entity
*/
public WechatResponseEntity<ObjectNode> terminate(String activityId) {
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
this.client().withType(WechatPayV3Type.MARKETING_PAYGIFTACTIVITY_TERMINATE, activityId)
.function((type, param) -> {
URI uri = UriComponentsBuilder.fromHttpUrl(type.uri(WeChatServer.CHINA))
.build()
.expand(param)
.toUri();
return Post(uri, Collections.emptyMap());
})
.consumer(wechatResponseEntity::convert)
.request();
return wechatResponseEntity;
}
/**
* 新增活动发券商户号API
*
* @param request the request
* @return the wechat response entity
*/
public WechatResponseEntity<ObjectNode> addMches(NewActivityMchRequest request) {
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
this.client().withType(WechatPayV3Type.MARKETING_PAYGIFTACTIVITY_MCH_ADD, request)
.function((type, params) -> {
URI uri = UriComponentsBuilder.fromHttpUrl(type.uri(WeChatServer.CHINA))
.build()
.expand(params.getActivityId())
.toUri();
Map<String, Object> body = new HashMap<>();
body.put("merchant_id_list", params.getMerchantIdList());
body.put("add_request_no", params.getAddRequestNo());
return Post(uri, body);
})
.consumer(wechatResponseEntity::convert)
.request();
return wechatResponseEntity;
}
/**
* 获取支付有礼活动列表API
*
* @param request the request
* @return the wechat response entity
*/
public WechatResponseEntity<ObjectNode> page(ActivitiesListPageRequest request) {
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
this.client().withType(WechatPayV3Type.MARKETING_PAYGIFTACTIVITY_ACTIVITIES, request)
.function((type, params) -> {
URI uri = UriComponentsBuilder.fromHttpUrl(type.uri(WeChatServer.CHINA))
.queryParam("offset", params.getOffset())
.queryParam("limit", params.getLimit())
.queryParam("activity_name", params.getActivityName())
.queryParam("activity_status", params.getActivityStatus())
.queryParam("award_type", params.getAwardType())
.build()
.toUri();
return Get(uri);
})
.consumer(wechatResponseEntity::convert)
.request();
return wechatResponseEntity;
}
/**
* 删除活动发券商户号API
*
* @param request the request
* @return the wechat response entity
*/
public WechatResponseEntity<ObjectNode> deleteMch(DeleteActivityMchRequest request) {
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();
this.client().withType(WechatPayV3Type.MARKETING_PAYGIFTACTIVITY_MCH_DEL, request)
.function((type, params) -> {
URI uri = UriComponentsBuilder.fromHttpUrl(type.uri(WeChatServer.CHINA))
.build()
.expand(params.getActivityId())
.toUri();
Map<String, Object> body = new HashMap<>();
body.put("merchant_id_list", params.getMerchantIdList());
body.put("delete_request_no", params.getDeleteRequestNo());
return Post(uri, body);
})
.consumer(wechatResponseEntity::convert)
.request();
return wechatResponseEntity;
}
}

View File

@@ -17,9 +17,15 @@
package cn.felord.payment.wechat.v3; package cn.felord.payment.wechat.v3;
import java.util.*; import cn.felord.payment.wechat.WechatTenantService;
import lombok.AllArgsConstructor;
import java.util.Collection;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentSkipListSet; import java.util.stream.Collectors;
/** /**
* 配置容器 * 配置容器
@@ -27,10 +33,10 @@ import java.util.concurrent.ConcurrentSkipListSet;
* @author felord.cn * @author felord.cn
* @since 1.0.0.RELEASE * @since 1.0.0.RELEASE
*/ */
@AllArgsConstructor
public class WechatMetaContainer { public class WechatMetaContainer {
private final Map<String, WechatMetaBean> wechatMetaBeanMap = new ConcurrentHashMap<>(); private final Map<String, WechatMetaBean> wechatMetaBeanMap = new ConcurrentHashMap<>();
private final Set<String> tenantIds = new ConcurrentSkipListSet<>(); private final WechatTenantService wechatTenantService;
/** /**
* Add wechat metas. * Add wechat metas.
@@ -43,22 +49,9 @@ public class WechatMetaContainer {
private void addMeta(WechatMetaBean wechatMetaBean) { private void addMeta(WechatMetaBean wechatMetaBean) {
String tenantId = wechatMetaBean.getTenantId(); String tenantId = wechatMetaBean.getTenantId();
tenantIds.add(tenantId);
wechatMetaBeanMap.put(tenantId, wechatMetaBean); wechatMetaBeanMap.put(tenantId, wechatMetaBean);
} }
/**
* Remove wechat meta wechat meta bean.
*
* @param tenantId the tenantId
* @return the wechat meta bean
*/
public WechatMetaBean removeWechatMeta(String tenantId) {
tenantIds.remove(tenantId);
return this.wechatMetaBeanMap.remove(tenantId);
}
/** /**
* Gets wechat meta. * Gets wechat meta.
* *
@@ -66,7 +59,14 @@ public class WechatMetaContainer {
* @return the wechat meta * @return the wechat meta
*/ */
public WechatMetaBean getWechatMeta(String tenantId) { 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);
}
} }
/** /**
@@ -75,6 +75,9 @@ public class WechatMetaContainer {
* @return the properties keys * @return the properties keys
*/ */
public Set<String> getTenantIds() { public Set<String> getTenantIds() {
return tenantIds; return wechatTenantService.loadTenants()
.stream()
.map(WechatMetaBean::getTenantId)
.collect(Collectors.toSet());
} }
} }

View File

@@ -80,7 +80,7 @@ public class WechatPartnerPayApi extends AbstractApi {
WechatMetaBean wechatMetaBean = wechatMetaContainer.getWechatMeta(tenantId()); WechatMetaBean wechatMetaBean = wechatMetaContainer.getWechatMeta(tenantId());
PrivateKey privateKey = wechatMetaBean.getKeyPair().getPrivate(); PrivateKey privateKey = wechatMetaBean.getKeyPair().getPrivate();
String subAppid = partnerPayParams.getSubAppid(); String spAppid = partnerPayParams.getSpAppid();
long epochSecond = LocalDateTime.now() long epochSecond = LocalDateTime.now()
.toEpochSecond(ZoneOffset.of("+8")); .toEpochSecond(ZoneOffset.of("+8"));
String timestamp = String.valueOf(epochSecond); String timestamp = String.valueOf(epochSecond);
@@ -89,9 +89,8 @@ public class WechatPartnerPayApi 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, subAppid, timestamp, nonceStr, prepayId); String paySign = signatureProvider.doRequestSign(privateKey, spAppid, timestamp, nonceStr, prepayId);
body.put("appid", spAppid);
body.put("appid", subAppid);
body.put("partnerid", partnerPayParams.getSubMchid()); body.put("partnerid", partnerPayParams.getSubMchid());
body.put("prepayid", prepayId); body.put("prepayid", prepayId);
body.put("package", "Sign=WXPay"); body.put("package", "Sign=WXPay");
@@ -129,7 +128,7 @@ public class WechatPartnerPayApi extends AbstractApi {
WechatMetaBean wechatMetaBean = wechatMetaContainer.getWechatMeta(tenantId()); WechatMetaBean wechatMetaBean = wechatMetaContainer.getWechatMeta(tenantId());
PrivateKey privateKey = wechatMetaBean.getKeyPair().getPrivate(); PrivateKey privateKey = wechatMetaBean.getKeyPair().getPrivate();
String subAppid = partnerPayParams.getSubAppid(); String spAppid = partnerPayParams.getSpAppid();
long epochSecond = LocalDateTime.now() long epochSecond = LocalDateTime.now()
.toEpochSecond(ZoneOffset.of("+8")); .toEpochSecond(ZoneOffset.of("+8"));
String timestamp = String.valueOf(epochSecond); String timestamp = String.valueOf(epochSecond);
@@ -138,9 +137,8 @@ public class WechatPartnerPayApi 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, subAppid, timestamp, nonceStr, packageStr); String paySign = signatureProvider.doRequestSign(privateKey, spAppid, timestamp, nonceStr, packageStr);
body.put("appid", spAppid);
body.put("appId", subAppid);
body.put("timeStamp", timestamp); body.put("timeStamp", timestamp);
body.put("nonceStr", nonceStr); body.put("nonceStr", nonceStr);
body.put("package", packageStr); body.put("package", packageStr);

View File

@@ -0,0 +1,122 @@
/*
* 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.v3.client;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import okhttp3.ConnectionPool;
import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava3.RxJava3CallAdapterFactory;
import retrofit2.converter.jackson.JacksonConverterFactory;
import java.util.concurrent.TimeUnit;
/**
* The type Retrofit factory.
*
* @author dax
* @since 2023 /5/21
*/
public final class RetrofitFactory {
/**
* The constant JACKSON_CONVERTER_FACTORY.
*/
public static final JacksonConverterFactory JACKSON_CONVERTER_FACTORY = JacksonConverterFactoryBuilder.build();
/**
* Create retrofit.
*
* @param baseUrl the base url
* @return the retrofit
*/
public static Retrofit create(String baseUrl) {
return create(baseUrl, new ConnectionPool());
}
/**
* Create retrofit.
*
* @param baseUrl the base url
* @param connectionPool the connection pool
* @return the retrofit
*/
public static Retrofit create(String baseUrl, ConnectionPool connectionPool) {
return create(baseUrl, connectionPool, HttpLoggingInterceptor.Level.NONE);
}
/**
* Create retrofit.
*
* @param baseUrl the base url
* @param connectionPool the connection pool
* @param level the level
* @return the retrofit
*/
public static Retrofit create(String baseUrl, ConnectionPool connectionPool, HttpLoggingInterceptor.Level level) {
return new Retrofit.Builder()
.baseUrl(baseUrl)
.client(okHttpClient(connectionPool, level))
.addCallAdapterFactory(RxJava3CallAdapterFactory.create())
.addConverterFactory(JACKSON_CONVERTER_FACTORY)
.build();
}
private static OkHttpClient okHttpClient(ConnectionPool connectionPool, HttpLoggingInterceptor.Level level) {
HttpLoggingInterceptor httpLoggingInterceptor = new HttpLoggingInterceptor();
httpLoggingInterceptor.level(level);
return new OkHttpClient.Builder()
.connectionPool(connectionPool)
.addInterceptor(httpLoggingInterceptor)
.retryOnConnectionFailure(true)
.connectTimeout(30, TimeUnit.SECONDS)
.readTimeout(30, TimeUnit.SECONDS)
.writeTimeout(30, TimeUnit.SECONDS)
.build();
}
/**
* The type Jackson converter factory builder.
*/
static final class JacksonConverterFactoryBuilder {
private JacksonConverterFactoryBuilder() {
}
/**
* Build jackson converter factory.
*
* @return the jackson converter factory
*/
public static JacksonConverterFactory build() {
ObjectMapper objectMapper = new ObjectMapper().setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE)
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
// empty string error
.configure(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT, true)
.setSerializationInclusion(JsonInclude.Include.NON_NULL)
.registerModule(new JavaTimeModule());
return JacksonConverterFactory.create(objectMapper);
}
}
}

View File

@@ -31,7 +31,7 @@ public class PatternInfo {
/** /**
* 背景色 * 背景色
*/ */
private CouponBgColor backgroundColor; private String backgroundColor;
/** /**
* 券详情图片 * 券详情图片
*/ */
@@ -49,4 +49,16 @@ public class PatternInfo {
*/ */
private String merchantName; private String merchantName;
/**
* Sets background color.
*
* @param backgroundColor the background color
*/
public void setBackgroundColor(CouponBgColor backgroundColor) {
this.backgroundColor = backgroundColor.name();
}
private void setBackgroundColor(String backgroundColor) {
this.backgroundColor = backgroundColor;
}
} }

View File

@@ -17,7 +17,7 @@
package cn.felord.payment.wechat.v3.model.busifavor; package cn.felord.payment.wechat.v3.model.busifavor;
import cn.felord.payment.wechat.enumeration.CouponBgColor; import cn.felord.payment.wechat.enumeration.CouponBgColor;
import cn.felord.payment.wechat.v3.WechatMarketingFavorApi; import cn.felord.payment.wechat.v3.WechatMediaApi;
import lombok.Data; import lombok.Data;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@@ -33,7 +33,7 @@ public class DisplayPatternInfo {
/** /**
* 背景颜色 * 背景颜色
*/ */
private CouponBgColor backgroundColor; private String backgroundColor;
/** /**
* 商户logo * 商户logo
* <ol> * <ol>
@@ -42,7 +42,7 @@ public class DisplayPatternInfo {
* </ol> * </ol>
* 仅支持通过 <a target= "_blank" href= "https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/marketing/chapter3_1.shtml">图片上传API</a> 接口获取的图片URL地址。 * 仅支持通过 <a target= "_blank" href= "https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/marketing/chapter3_1.shtml">图片上传API</a> 接口获取的图片URL地址。
* *
* @see WechatMarketingFavorApi#marketingImageUpload(MultipartFile) * @see WechatMediaApi#marketingImageUpload(MultipartFile)
*/ */
private String merchantLogoUrl; private String merchantLogoUrl;
/** /**
@@ -54,7 +54,7 @@ public class DisplayPatternInfo {
* </ol> * </ol>
* 仅支持通过 <a target= "_blank" href= "https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/marketing/chapter3_1.shtml">图片上传API</a> 接口获取的图片URL地址。 * 仅支持通过 <a target= "_blank" href= "https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/marketing/chapter3_1.shtml">图片上传API</a> 接口获取的图片URL地址。
* *
* @see WechatMarketingFavorApi#marketingImageUpload(MultipartFile) * @see WechatMediaApi#marketingImageUpload(MultipartFile)
*/ */
private String couponImageUrl; private String couponImageUrl;
/** /**
@@ -69,4 +69,17 @@ public class DisplayPatternInfo {
* 商户名称,字数上限为16个 * 商户名称,字数上限为16个
*/ */
private String merchantName; private String merchantName;
/**
* Sets background color.
*
* @param backgroundColor the background color
*/
public void setBackgroundColor(CouponBgColor backgroundColor) {
this.backgroundColor = backgroundColor.getValue();
}
private void setBackgroundColor(String backgroundColor) {
this.backgroundColor = backgroundColor;
}
} }

View File

@@ -20,6 +20,9 @@ import cn.felord.payment.wechat.enumeration.ContactType;
import cn.felord.payment.wechat.enumeration.IdDocType; import cn.felord.payment.wechat.enumeration.IdDocType;
import cn.felord.payment.wechat.v3.model.specmch.FinanceInstitutionInfo; import cn.felord.payment.wechat.v3.model.specmch.FinanceInstitutionInfo;
import lombok.Data; import lombok.Data;
import java.util.List;
/** /**
* 二级商户进件申请API请求参数 * 二级商户进件申请API请求参数
* *
@@ -41,6 +44,7 @@ public class EcommerceApplymentParams{
private Boolean owner; private Boolean owner;
private UboInfo uboInfo; private UboInfo uboInfo;
private Boolean needAccountInfo; private Boolean needAccountInfo;
private List<UboInfoListItem> uboInfoList;
private EcommerceAccountInfo accountInfo; private EcommerceAccountInfo accountInfo;
private EcommerceContactInfo contactInfo; private EcommerceContactInfo contactInfo;
private SalesSceneInfo salesSceneInfo; private SalesSceneInfo salesSceneInfo;

View File

@@ -0,0 +1,35 @@
/*
* 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.v3.model.ecommerce;
import cn.felord.payment.wechat.enumeration.IdDocType;
import lombok.Data;
import java.time.LocalDate;
@Data
public class UboInfoListItem {
private IdDocType uboIdDocType;
private String uboIdDocCopy;
private String uboIdDocCopyBack;
private String uboIdDocName;
private String uboIdDocNumber;
private String uboIdDocAddress;
private LocalDate uboIdDocPeriodBegin;
private LocalDate uboIdDocPeriodEnd;
}

View File

@@ -0,0 +1,35 @@
/*
* 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.v3.model.paygiftactivity;
import cn.felord.payment.wechat.enumeration.ActivityStatus;
import cn.felord.payment.wechat.enumeration.AwardType;
import lombok.Data;
/**
* @author dax
* @since 1.0.19.RELEASE
*/
@Data
public class ActivitiesListPageRequest {
private final long offset;
private final long limit;
private String activityName;
private ActivityStatus activityStatus;
private AwardType awardType;
}

View File

@@ -0,0 +1,31 @@
/*
* 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.v3.model.paygiftactivity;
import lombok.Data;
/**
* @author dax
* @since 1.0.19.RELEASE
*/
@Data
public class ActivitiesPageRequest {
private final String activityId;
private Long offset;
private Long limit;
}

View File

@@ -0,0 +1,66 @@
/*
* 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.v3.model.paygiftactivity;
import cn.felord.payment.wechat.enumeration.CouponBgColor;
import cn.felord.payment.wechat.enumeration.DeliveryPurpose;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.time.OffsetDateTime;
/**
* The type Activity base info.
*
* @author dax
* @since 1.0.19.RELEASE
*/
@Data
public class ActivityBaseInfo {
private String activityName;
private String activitySecondTitle;
private String merchantLogoUrl;
private String backgroundColor;
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ssXXX")
private OffsetDateTime beginTime;
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ssXXX")
private OffsetDateTime endTime;
private AvailablePeriods availablePeriods;
private String outRequestNo;
private DeliveryPurpose deliveryPurpose;
private String miniProgramsPath;
/**
* Sets background color.
*
* @param backgroundColor the background color
*/
void setBackgroundColor(String backgroundColor) {
this.backgroundColor = backgroundColor;
}
/**
* Sets background color.
*
* @param backgroundColor the background color
*/
public void setBackgroundColor(CouponBgColor backgroundColor) {
this.backgroundColor = backgroundColor.getValue();
}
}

View File

@@ -14,30 +14,21 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package cn.felord.payment.wechat.v2.model;
package cn.felord.payment.wechat.v3.model.paygiftactivity;
import cn.felord.payment.wechat.enumeration.DeliveryUserCategory;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Set;
/** /**
* @author felord.cn * @author dax
* @since 1.0.4.RELEASE * @since 1.0.19.RELEASE
*/ */
@EqualsAndHashCode(callSuper = true)
@Data @Data
public class RefundModel extends BaseModel { public class AdvancedSetting {
private DeliveryUserCategory deliveryUserCategory;
private String appid; private String merchantMemberAppid;
private String mchId; private Set<String> goodsTags;
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;
} }

View File

@@ -0,0 +1,34 @@
/*
* 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.v3.model.paygiftactivity;
import lombok.Data;
import java.util.List;
/**
* The type Available periods.
*
* @author dax
* @since 1.0.19.RELEASE
*/
@Data
public class AvailablePeriods {
private List<OffsetDateTimePeriods> availableTime;
private List<LocalTimePeriods> availableDayTime;
}

View File

@@ -0,0 +1,31 @@
/*
* 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.v3.model.paygiftactivity;
import lombok.Data;
/**
* @author dax
* @since 1.0.19.RELEASE
*/
@Data
public class AwardItem {
private final String stock_id;
private final String original_image_url;
private String thumbnail_url;
}

View File

@@ -0,0 +1,40 @@
/*
* 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.v3.model.paygiftactivity;
import cn.felord.payment.wechat.enumeration.AwardType;
import cn.felord.payment.wechat.enumeration.SendContent;
import lombok.Data;
import java.util.List;
/**
* 满送活动规则
*
* @author dax
* @since 1.0.19.RELEASE
*/
@Data
public class AwardSendRule {
private final int transactionAmountMinimum;
private final SendContent sendContent;
private final AwardType awardType;
private final List<AwardItem> awardList;
private final String merchantOption;
private final List<String> merchantIdList;
}

View File

@@ -0,0 +1,33 @@
/*
* 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.v3.model.paygiftactivity;
import lombok.Data;
import java.util.List;
/**
* @author dax
* @since 1.0.19.RELEASE
*/
@Data
public class DeleteActivityMchRequest {
private final String activityId;
private String deleteRequestNo;
private List<String> merchantIdList;
}

View File

@@ -0,0 +1,31 @@
/*
* 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.v3.model.paygiftactivity;
import lombok.Data;
/**
* @author dax
* @since 1.0.19.RELEASE
*/
@Data
public class GiftActivityParams {
private final ActivityBaseInfo activityBaseInfo;
private final AwardSendRule awardSendRule;
private AdvancedSetting advancedSetting;
}

View File

@@ -0,0 +1,35 @@
/*
* 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.v3.model.paygiftactivity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.time.OffsetDateTime;
/**
* @author dax
* @since 1.0.19.RELEASE
*/
@Data
public class LocalTimePeriods {
@JsonFormat(pattern = "HHmmss")
private final OffsetDateTime beginDayTime;
@JsonFormat(pattern = "HHmmss")
private final OffsetDateTime endDayTime;
}

View File

@@ -0,0 +1,33 @@
/*
* 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.v3.model.paygiftactivity;
import lombok.Data;
import java.util.List;
/**
* @author dax
* @since 1.0.19.RELEASE
*/
@Data
public class NewActivityMchRequest {
private final String activityId;
private final String addRequestNo;
private List<String> merchantIdList;
}

View File

@@ -0,0 +1,37 @@
/*
* 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.v3.model.paygiftactivity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.time.OffsetDateTime;
/**
* The type Time periods.
*
* @author dax
* @since 1.0.19.RELEASE
*/
@Data
public class OffsetDateTimePeriods {
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ssXXX")
private final OffsetDateTime beginTime;
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ssXXX")
private final OffsetDateTime endTime;
}

View File

@@ -1,3 +1,20 @@
/*
* 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.v3.model.profitsharing; package cn.felord.payment.wechat.v3.model.profitsharing;
import lombok.Data; import lombok.Data;
@@ -5,7 +22,7 @@ import lombok.Data;
import java.util.List; import java.util.List;
/** /**
* @author xiafang * @author dax
* @since 2023/1/3 10:27 * @since 2023/1/3 10:27
*/ */
@Data @Data

View File

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

82
pom.xml
View File

@@ -21,7 +21,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.17.RELEASE</version> <version>1.0.19.RELEASE</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@@ -47,7 +47,7 @@
</developers> </developers>
<scm> <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> <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>
@@ -91,6 +91,11 @@
<spring-boot.version>2.7.7</spring-boot.version> <spring-boot.version>2.7.7</spring-boot.version>
<alipay-sdk.version>4.31.7.ALL</alipay-sdk.version> <alipay-sdk.version>4.31.7.ALL</alipay-sdk.version>
<bcprov.version>1.69</bcprov.version> <bcprov.version>1.69</bcprov.version>
<retrofit.version>2.9.0</retrofit.version>
<okhttp3.version>4.10.0</okhttp3.version>
<lombok.version>1.18.26</lombok.version>
<jackson.version>2.13.5</jackson.version>
<slf4j.version>2.0.7</slf4j.version>
</properties> </properties>
<distributionManagement> <distributionManagement>
@@ -116,7 +121,6 @@
<type>pom</type> <type>pom</type>
<scope>import</scope> <scope>import</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.alipay.sdk</groupId> <groupId>com.alipay.sdk</groupId>
<artifactId>alipay-sdk-java</artifactId> <artifactId>alipay-sdk-java</artifactId>
@@ -132,6 +136,78 @@
<artifactId>payment-spring-boot-autoconfigure</artifactId> <artifactId>payment-spring-boot-autoconfigure</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency>
<groupId>com.squareup.retrofit2</groupId>
<artifactId>retrofit</artifactId>
<version>${retrofit.version}</version>
<exclusions>
<exclusion>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.squareup.retrofit2</groupId>
<artifactId>adapter-rxjava3</artifactId>
<version>${retrofit.version}</version>
</dependency>
<dependency>
<groupId>com.squareup.retrofit2</groupId>
<artifactId>converter-jaxb</artifactId>
<version>${retrofit.version}</version>
</dependency>
<dependency>
<groupId>com.squareup.retrofit2</groupId>
<artifactId>converter-jackson</artifactId>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</exclusion>
</exclusions>
<version>${retrofit.version}</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>${okhttp3.version}</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>logging-interceptor</artifactId>
<version>${okhttp3.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jdk8</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-parameter-names</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>