Skip to content

Commit 8709a9c

Browse files
authored
🆕 #1090 增加微信支付分和免押租借相关接口
1 parent 0bc2cf9 commit 8709a9c

26 files changed

+1762
-12
lines changed

spring-boot-starters/wx-java-pay-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/pay/config/WxPayAutoConfiguration.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@ public WxPayService wxPayService() {
4949
payConfig.setSubAppId(StringUtils.trimToNull(this.properties.getSubAppId()));
5050
payConfig.setSubMchId(StringUtils.trimToNull(this.properties.getSubMchId()));
5151
payConfig.setKeyPath(StringUtils.trimToNull(this.properties.getKeyPath()));
52+
//以下是apiv3以及支付分相关
53+
payConfig.setServiceId(StringUtils.trimToNull(this.properties.getServiceId()));
54+
payConfig.setPayScoreNotifyUrl(StringUtils.trimToNull(this.properties.getPayScoreNotifyUrl()));
55+
payConfig.setPrivateKeyPath(StringUtils.trimToNull(this.properties.getPrivateKeyPath()));
56+
payConfig.setPrivateCertPath(StringUtils.trimToNull(this.properties.getPrivateCertPath()));
57+
payConfig.setCertSerialNo(StringUtils.trimToNull(this.properties.getCertSerialNo()));
58+
payConfig.setApiv3Key(StringUtils.trimToNull(this.properties.getApiv3Key()));
5259

5360
wxPayService.setConfig(payConfig);
5461
return wxPayService;

spring-boot-starters/wx-java-pay-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/pay/properties/WxPayProperties.java

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,35 @@ public class WxPayProperties {
4343
* apiclient_cert.p12文件的绝对路径,或者如果放在项目中,请以classpath:开头指定.
4444
*/
4545
private String keyPath;
46+
47+
/**
48+
* 微信支付分serviceId
49+
*/
50+
private String serviceId;
51+
52+
/**
53+
* 证书序列号
54+
*/
55+
private String certSerialNo;
56+
57+
/**
58+
* apiV3秘钥
59+
*/
60+
private String apiv3Key;
61+
62+
/**
63+
* 微信支付分回调地址
64+
*/
65+
private String payScoreNotifyUrl;
66+
67+
/**
68+
* apiv3 商户apiclient_key.pem
69+
*/
70+
private String privateKeyPath;
71+
72+
/**
73+
* apiv3 商户apiclient_cert.pem
74+
*/
75+
private String privateCertPath;
76+
4677
}

weixin-java-pay/pom.xml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,18 @@
1212
<artifactId>weixin-java-pay</artifactId>
1313
<name>WxJava - PAY Java SDK</name>
1414
<description>微信支付 Java SDK</description>
15+
<build>
16+
<plugins>
17+
<plugin>
18+
<groupId>org.apache.maven.plugins</groupId>
19+
<artifactId>maven-compiler-plugin</artifactId>
20+
<configuration>
21+
<source>8</source>
22+
<target>8</target>
23+
</configuration>
24+
</plugin>
25+
</plugins>
26+
</build>
1527

1628
<dependencies>
1729
<dependency>
@@ -70,6 +82,19 @@
7082
<groupId>org.projectlombok</groupId>
7183
<artifactId>lombok</artifactId>
7284
</dependency>
85+
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
86+
<dependency>
87+
<groupId>com.fasterxml.jackson.core</groupId>
88+
<artifactId>jackson-databind</artifactId>
89+
<version>2.9.7</version>
90+
</dependency>
91+
<dependency>
92+
<groupId>com.alibaba</groupId>
93+
<artifactId>fastjson</artifactId>
94+
<version>1.2.58</version>
95+
</dependency>
96+
97+
7398
</dependencies>
7499

75100
<profiles>
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
package com.github.binarywang.wxpay.bean.payscore;
2+
3+
import lombok.Data;
4+
import lombok.NoArgsConstructor;
5+
6+
/**
7+
* 微信支付分确认订单跟支付回调对象
8+
* @author doger.wang
9+
* @date 2020/5/14 12:18
10+
*/
11+
@NoArgsConstructor
12+
@Data
13+
public class NotifyData {
14+
15+
16+
/**
17+
* id : EV-2018022511223320873
18+
* create_time : 20180225112233
19+
* resource_type : encrypt-resource
20+
* event_type : PAYSCORE.USER_CONFIRM
21+
* resource : {"algorithm":"AEAD_AES_256_GCM","ciphertext":"...","nonce":"...","associated_data":""}
22+
*/
23+
24+
private String id;
25+
private String create_time;
26+
private String resource_type;
27+
private String event_type;
28+
private Resource resource;
29+
30+
@NoArgsConstructor
31+
@Data
32+
public static class Resource {
33+
/**
34+
* algorithm : AEAD_AES_256_GCM
35+
* ciphertext : ...
36+
* nonce : ...
37+
* associated_data :
38+
*/
39+
40+
private String algorithm;
41+
private String ciphertext;
42+
private String nonce;
43+
private String associated_data;
44+
}
45+
}
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
package com.github.binarywang.wxpay.bean.payscore;
2+
3+
import lombok.Data;
4+
import lombok.NoArgsConstructor;
5+
6+
import java.io.Serializable;
7+
import java.util.List;
8+
9+
/**
10+
* @author doger.wang
11+
* @date 2020/5/12 16:36
12+
*/
13+
@NoArgsConstructor
14+
@Data
15+
public class WxPayScoreRequest implements Serializable {
16+
17+
18+
private static final long serialVersionUID = 364764508076146082L;
19+
/**
20+
* out_order_no : 1234323JKHDFE1243252
21+
* appid : wxd678efh567hg6787
22+
* service_id : 500001
23+
* service_introduction : 某某酒店
24+
* post_payments : [{"name":"就餐费用服务费","amount":4000,"description":"就餐人均100元服务费:100/小时","count":1}]
25+
* post_discounts : [{"name":"满20减1元","description":"不与其他优惠叠加"}]
26+
* time_range : {"start_time":"20091225091010","end_time":"20091225121010"}
27+
* location : {"start_location":"嗨客时尚主题展餐厅","end_location":"嗨客时尚主题展餐厅"}
28+
* risk_fund : {"name":"ESTIMATE_ORDER_COST","amount":10000,"description":"就餐的预估费用"}
29+
* attach : Easdfowealsdkjfnlaksjdlfkwqoi&wl3l2sald
30+
* notify_url : https://api.test.com
31+
* openid : oUpF8uMuAJO_M2pxb1Q9zNjWeS6o
32+
* need_user_confirm : true
33+
*/
34+
35+
private String out_order_no;
36+
private String appid;
37+
private String service_id;
38+
private String service_introduction;
39+
private TimeRange time_range;
40+
private Location location;
41+
private RiskFund risk_fund;
42+
private String attach;
43+
private String notify_url;
44+
private String openid;
45+
private boolean need_user_confirm;
46+
private boolean profit_sharing;
47+
private List<PostPayments> post_payments;
48+
private List<PostDiscounts> post_discounts;
49+
private int total_amount;
50+
private String reason;
51+
private String goods_tag;
52+
private String type;
53+
private Detail detail;
54+
55+
@NoArgsConstructor
56+
@Data
57+
public static class Detail {
58+
private String paid_time;
59+
}
60+
61+
62+
63+
@NoArgsConstructor
64+
@Data
65+
public static class TimeRange {
66+
/**
67+
* start_time : 20091225091010
68+
* end_time : 20091225121010
69+
*/
70+
71+
private String start_time;
72+
private String end_time;
73+
}
74+
75+
@NoArgsConstructor
76+
@Data
77+
public static class Location {
78+
/**
79+
* start_location : 嗨客时尚主题展餐厅
80+
* end_location : 嗨客时尚主题展餐厅
81+
*/
82+
83+
private String start_location;
84+
private String end_location;
85+
}
86+
87+
@NoArgsConstructor
88+
@Data
89+
public static class RiskFund {
90+
/**
91+
* name : ESTIMATE_ORDER_COST
92+
* amount : 10000
93+
* description : 就餐的预估费用
94+
*/
95+
96+
private String name;
97+
private int amount;
98+
private String description;
99+
}
100+
101+
@NoArgsConstructor
102+
@Data
103+
public static class PostPayments {
104+
/**
105+
* name : 就餐费用服务费
106+
* amount : 4000
107+
* description : 就餐人均100元服务费:100/小时
108+
* count : 1
109+
*/
110+
111+
private String name;
112+
private int amount;
113+
private String description;
114+
private int count;
115+
}
116+
117+
@NoArgsConstructor
118+
@Data
119+
public static class PostDiscounts {
120+
/**
121+
* name : 满20减1元
122+
* description : 不与其他优惠叠加
123+
*/
124+
125+
private String name;
126+
private String description;
127+
private int count;
128+
private int amount;
129+
}
130+
}

0 commit comments

Comments
 (0)