18 Commits

Author SHA1 Message Date
felord.cn
d95d9de0f1 Merge pull request #124 from dromara/1.0.20
1.0.20
2024-04-29 13:41:35 +08:00
xiafang
5b8850b980 enhance: 1.0.20 2024-04-29 13:41:07 +08:00
xiafang
85621edace Merge branch 'release' into 1.0.20
# Conflicts:
#	payment-spring-boot-autoconfigure/src/main/java/cn/felord/payment/wechat/v3/model/ecommerce/EcommerceContactInfo.java
2024-04-29 13:38:43 +08:00
xiafang
56995088d1 enhance: 发放代金券中制券商户号用户可自定义
Closes #122
2024-04-29 13:30:39 +08:00
xiafang
6e2b6decf4 enhance: 发起商家转账增加回调通知
Closes #123
2024-04-29 12:50:12 +08:00
xiafang
d068734422 enhance: 优化逻辑 2024-01-15 15:53:52 +08:00
xiafang
57e794280f fix: 微信支付分停车GET请求车牌号省份汉字encode问题
Closes  #113
2023-11-28 14:08:34 +08:00
xiafang
56bf43f04f #109 2023-11-28 13:50:53 +08:00
felord.cn
87257fc8b1 Merge pull request #109 from lgxisbb/20230703_media_api
20230703 ecommerce api
2023-11-28 13:37:23 +08:00
felord.cn
616ea0cede Merge pull request #110 from dromara/dependabot/maven/org.bouncycastle-bcprov-jdk15to18-1.74
build(deps): bump bcprov-jdk15to18 from 1.69 to 1.74
2023-11-28 13:36:57 +08:00
xiafang
f4615b02b3 修复时间序列化问题 2023-11-28 13:30:26 +08:00
dependabot[bot]
4e27958ace build(deps): bump bcprov-jdk15to18 from 1.69 to 1.74
Bumps [bcprov-jdk15to18](https://github.com/bcgit/bc-java) from 1.69 to 1.74.
- [Changelog](https://github.com/bcgit/bc-java/blob/main/docs/releasenotes.html)
- [Commits](https://github.com/bcgit/bc-java/commits)

---
updated-dependencies:
- dependency-name: org.bouncycastle:bcprov-jdk15to18
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-06 15:41:12 +00:00
fourier
aaad20b78a feat: 电商收付通二级商户进件接口联系人手机号码加密 2023-07-04 10:33:41 +08:00
fourier
10b09ac4bb feat: 电商收付通二级商户进件接口联系人信息增加字段 2023-07-04 10:26:54 +08:00
xiafang
62ecc5b700 Merge remote-tracking branch 'origin/1.0.20' into 1.0.20 2023-07-01 09:27:04 +08:00
xiafang
8168097427 enhance: 电商收付通二级商户进件申请参数
Closes #108
2023-07-01 09:26:28 +08:00
xiafang
9645d20b33 enhance: 电商收付通二级商户进件申请参数 2023-07-01 09:25:12 +08:00
xiafang
c42f6d9d5e - 电商二级商户进件补充最终受益人列表 2023-06-27 14:02:07 +08:00
16 changed files with 163 additions and 33 deletions

View File

@@ -45,7 +45,7 @@ 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.19.RELEASE</version> <version>1.0.20.RELEASE</version>
</dependency> </dependency>
``` ```

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.19.RELEASE</version> <version>1.0.20.RELEASE</version>
</dependency> </dependency>
``` ```
## 采用技术 ## 采用技术
@@ -51,4 +51,4 @@
## **免责声明** ## **免责声明**
**<span style="color:red;">本项目涉及到资金交易开发,开发者需要经严格测试后方能用于生产环境,本项目不对使用者的行为负责。</span>** **<span style="color:red;">本项目涉及到资金交易开发,开发者需要经严格测试后方能用于生产环境,本项目不对使用者的行为负责。</span>**

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.19.RELEASE</version> <version>1.0.20.RELEASE</version>
</dependency> </dependency>
``` ```
> 基于 **Spring Boot 2.x** > 基于 **Spring Boot 2.x**
@@ -174,4 +174,4 @@ public class PayConfig {
System.out.println("execute = " + execute.getBody()); System.out.println("execute = " + execute.getBody());
} }
``` ```

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.19.RELEASE</version> <version>1.0.20.RELEASE</version>
</parent> </parent>
<artifactId>payment-spring-boot-autoconfigure</artifactId> <artifactId>payment-spring-boot-autoconfigure</artifactId>
<version>1.0.19.RELEASE</version> <version>1.0.20.RELEASE</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@@ -92,4 +92,4 @@
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
</project> </project>

View File

@@ -0,0 +1,71 @@
/*
* 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 Business cert type.
*
* @author dax
* @since 2023 /7/1 8:34
*/
public enum BusinessCertType {
/**
* 事业单位法人证书
*/
CERTIFICATE_TYPE_2388,
/**
* 统一社会信用代码证书
*/
CERTIFICATE_TYPE_2389,
/**
* 社会团体法人登记证书
*/
CERTIFICATE_TYPE_2394,
/**
* 民办非企业单位登记证书
*/
CERTIFICATE_TYPE_2395,
/**
* 基金会法人登记证书
*/
CERTIFICATE_TYPE_2396,
/**
* 宗教活动场所登记证
*/
CERTIFICATE_TYPE_2399,
/**
* 政府部门下发的其他有效证明文件
*/
CERTIFICATE_TYPE_2400,
/**
* 执业许可证/执业证
*/
CERTIFICATE_TYPE_2520,
/**
* 基层群众性自治组织特别法人统一社会信用代码证
*/
CERTIFICATE_TYPE_2521,
/**
* 农村集体经济组织登记证
*/
CERTIFICATE_TYPE_2522
}

View File

@@ -31,6 +31,9 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.PropertyNamingStrategy; import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.node.ObjectNode;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
import org.springframework.http.ContentDisposition; import org.springframework.http.ContentDisposition;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
@@ -44,6 +47,8 @@ import org.springframework.web.util.UriComponentsBuilder;
import java.net.URI; import java.net.URI;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.Objects; import java.util.Objects;
import java.util.Optional; import java.util.Optional;
@@ -92,12 +97,16 @@ public abstract class AbstractApi {
* @param mapper the mapper * @param mapper the mapper
*/ */
private void applyObjectMapper(ObjectMapper mapper) { private void applyObjectMapper(ObjectMapper mapper) {
JavaTimeModule javaTimeModule = new JavaTimeModule();
javaTimeModule.addSerializer(LocalDate.class, new LocalDateSerializer(DateTimeFormatter.ISO_LOCAL_DATE));
javaTimeModule.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(DateTimeFormatter.ISO_LOCAL_DATE_TIME));
javaTimeModule.addSerializer(LocalTime.class, new LocalTimeSerializer(DateTimeFormatter.ISO_LOCAL_TIME));
mapper.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE) mapper.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE)
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
// empty string error // empty string error
.configure(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT, true) .configure(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT, true)
.setSerializationInclusion(JsonInclude.Include.NON_NULL) .setSerializationInclusion(JsonInclude.Include.NON_NULL)
.registerModule(new JavaTimeModule()); .registerModule(javaTimeModule);
} }

View File

@@ -184,15 +184,15 @@ public class SignatureProvider {
.orElseThrow(() -> new PayException("cannot obtain the certificate")); .orElseThrow(() -> new PayException("cannot obtain the certificate"));
}); });
try { 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){ } catch (Exception e) {
throw new PayException("An exception occurred during the response verification, the cause: "+e.getMessage()); throw new PayException("An exception occurred during the response verification, the cause: " + e.getMessage());
} }
} }
@@ -230,12 +230,9 @@ public class SignatureProvider {
throw new PayException("cant obtain the response body"); throw new PayException("cant obtain the response body");
} }
ArrayNode certificates = bodyObjectNode.withArray("data"); ArrayNode certificates = bodyObjectNode.withArray("data");
if (certificates.isArray() && certificates.size() > 0) { if (certificates.isArray() && !certificates.isEmpty()) {
CERTIFICATE_SET.forEach(x509WechatCertificateInfo -> { CERTIFICATE_SET.removeIf(x509WechatCertificateInfo ->
if (Objects.equals(tenantId, x509WechatCertificateInfo.getTenantId())) { Objects.equals(tenantId, x509WechatCertificateInfo.getTenantId()));
CERTIFICATE_SET.remove(x509WechatCertificateInfo);
}
});
final CertificateFactory certificateFactory = CertificateFactory.getInstance("X509", BC_PROVIDER); final CertificateFactory certificateFactory = CertificateFactory.getInstance("X509", BC_PROVIDER);
certificates.forEach(objectNode -> { certificates.forEach(objectNode -> {
JsonNode encryptCertificate = objectNode.get("encrypt_certificate"); JsonNode encryptCertificate = objectNode.get("encrypt_certificate");

View File

@@ -158,7 +158,9 @@ public class WechatMarketingFavorApi extends AbstractApi {
WechatPayProperties.V3 v3 = this.wechatMetaBean().getV3(); WechatPayProperties.V3 v3 = this.wechatMetaBean().getV3();
params.setAppid(v3.getAppId()); params.setAppid(v3.getAppId());
params.setStockCreatorMchid(v3.getMchId()); if (StringUtils.hasText(params.getStockCreatorMchid())){
params.setStockCreatorMchid(v3.getMchId());
}
URI uri = UriComponentsBuilder.fromHttpUrl(type.uri(WeChatServer.CHINA)) URI uri = UriComponentsBuilder.fromHttpUrl(type.uri(WeChatServer.CHINA))
.build() .build()
.expand(params.getOpenid()) .expand(params.getOpenid())

View File

@@ -76,6 +76,7 @@ public class WechatPayScoreParkingApi extends AbstractApi {
URI uri = UriComponentsBuilder.fromHttpUrl(wechatPayV3Type.uri(WeChatServer.CHINA)) URI uri = UriComponentsBuilder.fromHttpUrl(wechatPayV3Type.uri(WeChatServer.CHINA))
.queryParams(queryParams) .queryParams(queryParams)
.encode()
.build() .build()
.toUri(); .toUri();
return Get(uri); return Get(uri);

View File

@@ -178,6 +178,7 @@ public class ApplymentApi extends AbstractApi {
EcommerceContactInfo contactInfo = applymentParams.getContactInfo(); EcommerceContactInfo contactInfo = applymentParams.getContactInfo();
contactInfo.setContactName(signatureProvider.encryptRequestMessage(contactInfo.getContactName(), x509Certificate)); contactInfo.setContactName(signatureProvider.encryptRequestMessage(contactInfo.getContactName(), x509Certificate));
contactInfo.setContactIdCardNumber(signatureProvider.encryptRequestMessage(contactInfo.getContactIdCardNumber(), x509Certificate)); contactInfo.setContactIdCardNumber(signatureProvider.encryptRequestMessage(contactInfo.getContactIdCardNumber(), x509Certificate));
contactInfo.setMobilePhone(signatureProvider.encryptRequestMessage(contactInfo.getMobilePhone(), x509Certificate));
String contactEmail = contactInfo.getContactEmail(); String contactEmail = contactInfo.getContactEmail();
if (contactEmail != null) { if (contactEmail != null) {
contactInfo.setContactEmail(signatureProvider.encryptRequestMessage(contactEmail, x509Certificate)); contactInfo.setContactEmail(signatureProvider.encryptRequestMessage(contactEmail, x509Certificate));

View File

@@ -61,6 +61,11 @@ public class CreateBatchTransferParams {
* 指定该笔转账使用的转账场景ID * 指定该笔转账使用的转账场景ID
*/ */
private String transferSceneId; private String transferSceneId;
/**
* 回调通知
* @since 1.0.20
*/
private String notifyUrl;
/** /**
* 转账明细. * 转账明细.
@@ -96,4 +101,4 @@ public class CreateBatchTransferParams {
*/ */
private String userIdCard; private String userIdCard;
} }
} }

View File

@@ -17,6 +17,7 @@
package cn.felord.payment.wechat.v3.model.ecommerce; package cn.felord.payment.wechat.v3.model.ecommerce;
import cn.felord.payment.wechat.enumeration.BusinessCertType;
import lombok.Data; import lombok.Data;
/** /**
@@ -25,6 +26,7 @@ import lombok.Data;
*/ */
@Data @Data
public class EcommerceBusinessLicenseInfo { public class EcommerceBusinessLicenseInfo {
private BusinessCertType certType;
private String businessLicenseCopy; private String businessLicenseCopy;
private String businessLicenseNumber; private String businessLicenseNumber;
private String merchantName; private String merchantName;

View File

@@ -17,13 +17,20 @@
package cn.felord.payment.wechat.v3.model.ecommerce; package cn.felord.payment.wechat.v3.model.ecommerce;
import cn.felord.payment.wechat.enumeration.IdDocType;
import lombok.Data; import lombok.Data;
@Data @Data
public class EcommerceContactInfo { public class EcommerceContactInfo {
private String contactType; private String contactType;
private String contactName; private String contactName;
private IdDocType contactIdDocType;
private String contactIdCardNumber; private String contactIdCardNumber;
private String contactIdDocCopy;
private String contactIdDocCopyBack;
private String contactIdDocPeriodEnd;
private String businessAuthorizationLetter;
private String contactIdDocPeriodBegin;
private String mobilePhone; private String mobilePhone;
private String contactEmail; private String contactEmail;
} }

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 String uboIdDocPeriodEnd;
}

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.19.RELEASE</version> <version>1.0.20.RELEASE</version>
</parent> </parent>
<artifactId>payment-spring-boot-starter</artifactId> <artifactId>payment-spring-boot-starter</artifactId>
<version>1.0.19.RELEASE</version> <version>1.0.20.RELEASE</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@@ -62,4 +62,4 @@
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>

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.19.RELEASE</version> <version>1.0.20.RELEASE</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@@ -90,7 +90,7 @@
<java.version>1.8</java.version> <java.version>1.8</java.version>
<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.74</bcprov.version>
</properties> </properties>
<distributionManagement> <distributionManagement>
@@ -212,4 +212,4 @@
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
</project> </project>