mirror of
https://github.com/dromara/payment-spring-boot.git
synced 2026-03-14 05:43:46 +08:00
feat: 日常维护
- 支付宝增加证书路径的选择方式 - 微信支付 《支付通知API》新增优惠功能(promotion_detail)字段
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
<dependency>
|
||||
<groupId>cn.felord</groupId>
|
||||
<artifactId>payment-spring-boot-starter</artifactId>
|
||||
<version>1.0.10.RELEASE</version>
|
||||
<version>1.0.11.RELEASE</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
<dependency>
|
||||
<groupId>cn.felord</groupId>
|
||||
<artifactId>payment-spring-boot-starter</artifactId>
|
||||
<version>1.0.10.RELEASE</version>
|
||||
<version>1.0.11.RELEASE</version>
|
||||
</dependency>
|
||||
```
|
||||
## 采用技术
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<dependency>
|
||||
<groupId>cn.felord</groupId>
|
||||
<artifactId>payment-spring-boot-starter</artifactId>
|
||||
<version>1.0.10.RELEASE</version>
|
||||
<version>1.0.11.RELEASE</version>
|
||||
</dependency>
|
||||
```
|
||||
> 基于 **Spring Boot 2.x**
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
<parent>
|
||||
<groupId>cn.felord</groupId>
|
||||
<artifactId>payment-spring-boot</artifactId>
|
||||
<version>1.0.10.RELEASE</version>
|
||||
<version>1.0.11.RELEASE</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>payment-spring-boot-autoconfigure</artifactId>
|
||||
<version>1.0.10.RELEASE</version>
|
||||
<version>1.0.11.RELEASE</version>
|
||||
<packaging>jar</packaging>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -33,9 +33,9 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* @author felord.cn
|
||||
@@ -56,34 +56,33 @@ public class AliPayConfiguration {
|
||||
CertAlipayRequest certAlipayRequest = new CertAlipayRequest();
|
||||
propertyMapper.from(v1::getServerUrl).to(certAlipayRequest::setServerUrl);
|
||||
propertyMapper.from(v1::getAppId).to(certAlipayRequest::setAppId);
|
||||
propertyMapper.from(v1::getAppPrivateKeyPath).as(this::appRSAPrivateKey).to(certAlipayRequest::setPrivateKey);
|
||||
propertyMapper.from(v1::getAppPrivateKeyPath)
|
||||
.as(this::loadFile)
|
||||
.to(certAlipayRequest::setPrivateKey);
|
||||
|
||||
propertyMapper.from(v1::getFormat).to(certAlipayRequest::setFormat);
|
||||
propertyMapper.from(v1::getCharset).to(certAlipayRequest::setCharset);
|
||||
propertyMapper.from(v1::getSignType).to(certAlipayRequest::setSignType);
|
||||
propertyMapper.from(v1::getAppCertPublicKeyPath).as(this::getContentFromClassPath).to(certAlipayRequest::setCertContent);
|
||||
propertyMapper.from(v1::getAlipayPublicCertPath).as(this::getContentFromClassPath).to(certAlipayRequest::setAlipayPublicCertContent);
|
||||
propertyMapper.from(v1::getAlipayRootCertPath).as(this::getContentFromClassPath).to(certAlipayRequest::setRootCertContent);
|
||||
|
||||
Function<String,String> certStrategyFunc = v1.isClasspathUsed()?this::loadFile:s -> s;
|
||||
|
||||
propertyMapper.from(v1::getAppCertPublicKeyPath)
|
||||
.as(certStrategyFunc)
|
||||
.to(certAlipayRequest::setCertContent);
|
||||
propertyMapper.from(v1::getAlipayPublicCertPath)
|
||||
.as(certStrategyFunc)
|
||||
.to(certAlipayRequest::setAlipayPublicCertContent);
|
||||
propertyMapper.from(v1::getAlipayRootCertPath)
|
||||
.as(certStrategyFunc)
|
||||
.to(certAlipayRequest::setRootCertContent);
|
||||
return new DefaultAlipayClient(certAlipayRequest);
|
||||
}
|
||||
|
||||
|
||||
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 loadFile(String classPath) {
|
||||
ClassPathResource resource = new ClassPathResource(classPath);
|
||||
try (InputStreamReader inputStreamReader = new InputStreamReader(resource.getInputStream())) {
|
||||
try (BufferedReader bufferedReader = new BufferedReader(inputStreamReader)) {
|
||||
return bufferedReader.readLine();
|
||||
}
|
||||
return IOUtils.toString(inputStreamReader);
|
||||
} catch (IOException e) {
|
||||
log.error("ali pay app private key is required ,{}", e.getMessage());
|
||||
throw new PayException("ali pay app private key is required");
|
||||
|
||||
@@ -70,6 +70,10 @@ public class AliPayProperties {
|
||||
* charset default utf-8
|
||||
*/
|
||||
private String charset = "utf-8";
|
||||
/**
|
||||
* use classpath or not ,default true
|
||||
*/
|
||||
private boolean classpathUsed = true;
|
||||
/**
|
||||
* alipay public cert path
|
||||
*/
|
||||
|
||||
@@ -19,6 +19,7 @@ package cn.felord.payment.wechat.v3.model.combine;
|
||||
|
||||
import cn.felord.payment.wechat.enumeration.TradeState;
|
||||
import cn.felord.payment.wechat.enumeration.TradeType;
|
||||
import cn.felord.payment.wechat.v3.model.PromotionDetail;
|
||||
import cn.felord.payment.wechat.v3.model.SceneInfo;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -125,6 +126,13 @@ public class CombineTransactionConsumeData {
|
||||
*/
|
||||
private String transactionId;
|
||||
|
||||
/**
|
||||
* 优惠功能,子单有核销优惠券时有返回
|
||||
*
|
||||
* @since 1.0.11.RELEASE
|
||||
*/
|
||||
private List<PromotionDetail> promotionDetail;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
<parent>
|
||||
<groupId>cn.felord</groupId>
|
||||
<artifactId>payment-spring-boot</artifactId>
|
||||
<version>1.0.10.RELEASE</version>
|
||||
<version>1.0.11.RELEASE</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>payment-spring-boot-starter</artifactId>
|
||||
<version>1.0.10.RELEASE</version>
|
||||
<version>1.0.11.RELEASE</version>
|
||||
<packaging>jar</packaging>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
4
pom.xml
4
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">
|
||||
<groupId>cn.felord</groupId>
|
||||
<artifactId>payment-spring-boot</artifactId>
|
||||
<version>1.0.10.RELEASE</version>
|
||||
<version>1.0.11.RELEASE</version>
|
||||
<packaging>pom</packaging>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
<oss-starter.version>1.0.0.RELEASE</oss-starter.version>
|
||||
<lombok.verison>1.18.12</lombok.verison>
|
||||
<jackson.version>2.9.10</jackson.version>
|
||||
<bcprov.version>1.66</bcprov.version>
|
||||
<bcprov.version>1.67</bcprov.version>
|
||||
<jackson.version>2.11.4</jackson.version>
|
||||
<httpclient.version>4.5.13</httpclient.version>
|
||||
</properties>
|
||||
|
||||
Reference in New Issue
Block a user