Skip to content

Commit 39cea92

Browse files
committed
🎨 微信支付分相关接口代码重构规范化
1 parent 8709a9c commit 39cea92

File tree

17 files changed

+586
-545
lines changed

17 files changed

+586
-545
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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public WxPayService wxPayService() {
5555
payConfig.setPrivateKeyPath(StringUtils.trimToNull(this.properties.getPrivateKeyPath()));
5656
payConfig.setPrivateCertPath(StringUtils.trimToNull(this.properties.getPrivateCertPath()));
5757
payConfig.setCertSerialNo(StringUtils.trimToNull(this.properties.getCertSerialNo()));
58-
payConfig.setApiv3Key(StringUtils.trimToNull(this.properties.getApiv3Key()));
58+
payConfig.setApiV3Key(StringUtils.trimToNull(this.properties.getApiv3Key()));
5959

6060
wxPayService.setConfig(payConfig);
6161
return wxPayService;

weixin-java-pay/pom.xml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -82,19 +82,10 @@
8282
<groupId>org.projectlombok</groupId>
8383
<artifactId>lombok</artifactId>
8484
</dependency>
85-
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
8685
<dependency>
87-
<groupId>com.fasterxml.jackson.core</groupId>
88-
<artifactId>jackson-databind</artifactId>
89-
<version>2.9.7</version>
86+
<groupId>com.google.code.gson</groupId>
87+
<artifactId>gson</artifactId>
9088
</dependency>
91-
<dependency>
92-
<groupId>com.alibaba</groupId>
93-
<artifactId>fastjson</artifactId>
94-
<version>1.2.58</version>
95-
</dependency>
96-
97-
9889
</dependencies>
9990

10091
<profiles>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package com.github.binarywang.wxpay.bean.payscore;
2+
3+
import com.google.gson.annotations.SerializedName;
4+
import lombok.Data;
5+
import lombok.NoArgsConstructor;
6+
7+
import java.io.Serializable;
8+
9+
/**
10+
* 明细.
11+
*
12+
* @author doger.wang
13+
* @date 2020-05-19
14+
*/
15+
@Data
16+
@NoArgsConstructor
17+
public class Detail implements Serializable {
18+
private static final long serialVersionUID = -3901373259400050385L;
19+
/**
20+
* seq : 1
21+
* amount : 900
22+
* paid_type : NEWTON
23+
* paid_time : 20091225091210
24+
* transaction_id : 15646546545165651651
25+
*/
26+
@SerializedName("seq")
27+
private int seq;
28+
@SerializedName("amount")
29+
private int amount;
30+
@SerializedName("paid_type")
31+
private String paidType;
32+
@SerializedName("paid_time")
33+
private String paidTime;
34+
@SerializedName("transaction_id")
35+
private String transactionId;
36+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package com.github.binarywang.wxpay.bean.payscore;
2+
3+
import com.google.gson.annotations.SerializedName;
4+
import lombok.Data;
5+
import lombok.NoArgsConstructor;
6+
7+
import java.io.Serializable;
8+
9+
/**
10+
* 服务位置信息.
11+
*
12+
* @author doger.wang
13+
* @date 2020-05-19
14+
*/
15+
@Data
16+
@NoArgsConstructor
17+
public class Location implements Serializable {
18+
private static final long serialVersionUID = -4510224826631515344L;
19+
/**
20+
* start_location : 嗨客时尚主题展餐厅
21+
* end_location : 嗨客时尚主题展餐厅
22+
*/
23+
@SerializedName("start_location")
24+
private String startLocation;
25+
@SerializedName("end_location")
26+
private String endLocation;
27+
}

weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/payscore/NotifyData.java

Lines changed: 0 additions & 45 deletions
This file was deleted.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
package com.github.binarywang.wxpay.bean.payscore;
2+
3+
import com.google.gson.annotations.SerializedName;
4+
import lombok.Data;
5+
import lombok.NoArgsConstructor;
6+
7+
import java.io.Serializable;
8+
9+
/**
10+
* 微信支付分确认订单跟支付回调对象
11+
*
12+
* @author doger.wang
13+
* @date 2020/5/14 12:18
14+
*/
15+
@NoArgsConstructor
16+
@Data
17+
public class PayScoreNotifyData implements Serializable {
18+
private static final long serialVersionUID = -8538014389773390989L;
19+
20+
/**
21+
* id : EV-2018022511223320873
22+
* create_time : 20180225112233
23+
* resource_type : encrypt-resource
24+
* event_type : PAYSCORE.USER_CONFIRM
25+
* resource : {"algorithm":"AEAD_AES_256_GCM","ciphertext":"...","nonce":"...","associated_data":""}
26+
*/
27+
@SerializedName("id")
28+
private String id;
29+
@SerializedName("create_time")
30+
private String createTime;
31+
@SerializedName("resource_type")
32+
private String resourceType;
33+
@SerializedName("event_type")
34+
private String eventType;
35+
@SerializedName("resource")
36+
private Resource resource;
37+
38+
@Data
39+
public static class Resource implements Serializable {
40+
private static final long serialVersionUID = 8530711804335261449L;
41+
/**
42+
* algorithm : AEAD_AES_256_GCM
43+
* ciphertext : ...
44+
* nonce : ...
45+
* associated_data :
46+
*/
47+
@SerializedName("algorithm")
48+
private String algorithm;
49+
@SerializedName("ciphertext")
50+
private String cipherText;
51+
@SerializedName("nonce")
52+
private String nonce;
53+
@SerializedName("associated_data")
54+
private String associatedData;
55+
}
56+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package com.github.binarywang.wxpay.bean.payscore;
2+
3+
import com.google.gson.annotations.SerializedName;
4+
import lombok.Data;
5+
import lombok.NoArgsConstructor;
6+
7+
import java.io.Serializable;
8+
9+
/**
10+
* 后付费商户优惠.
11+
*
12+
* @author doger.wang
13+
* @date 2020-05-19
14+
*/
15+
@Data
16+
@NoArgsConstructor
17+
public class PostDiscount implements Serializable {
18+
private static final long serialVersionUID = 2764537888242763379L;
19+
/**
20+
* name : 满20减1元
21+
* description : 不与其他优惠叠加
22+
*/
23+
@SerializedName("name")
24+
private String name;
25+
@SerializedName("description")
26+
private String description;
27+
@SerializedName("count")
28+
private int count;
29+
@SerializedName("amount")
30+
private int amount;
31+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package com.github.binarywang.wxpay.bean.payscore;
2+
3+
import com.google.gson.annotations.SerializedName;
4+
import lombok.Data;
5+
import lombok.NoArgsConstructor;
6+
7+
import java.io.Serializable;
8+
9+
/**
10+
* 后付费项目.
11+
*
12+
* @author doger.wang
13+
* @date 2020-05-19
14+
*/
15+
@Data
16+
@NoArgsConstructor
17+
public class PostPayment implements Serializable {
18+
private static final long serialVersionUID = 2007722927556382895L;
19+
/**
20+
* name : 就餐费用服务费
21+
* amount : 4000
22+
* description : 就餐人均100元服务费:100/小时
23+
* count : 1
24+
*/
25+
@SerializedName("name")
26+
private String name;
27+
@SerializedName("amount")
28+
private int amount;
29+
@SerializedName("description")
30+
private String description;
31+
@SerializedName("count")
32+
private int count;
33+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package com.github.binarywang.wxpay.bean.payscore;
2+
3+
import com.google.gson.annotations.SerializedName;
4+
import lombok.Data;
5+
import lombok.NoArgsConstructor;
6+
7+
import java.io.Serializable;
8+
9+
/**
10+
* 订单风险金信息.
11+
*
12+
* @author doger.wang
13+
* @date 2020-05-19
14+
*/
15+
@Data
16+
@NoArgsConstructor
17+
public class RiskFund implements Serializable {
18+
private static final long serialVersionUID = -3583406084396059152L;
19+
/**
20+
* name : ESTIMATE_ORDER_COST
21+
* amount : 10000
22+
* description : 就餐的预估费用
23+
*/
24+
@SerializedName("name")
25+
private String name;
26+
@SerializedName("amount")
27+
private int amount;
28+
@SerializedName("description")
29+
private String description;
30+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package com.github.binarywang.wxpay.bean.payscore;
2+
3+
import com.google.gson.annotations.SerializedName;
4+
import lombok.Data;
5+
import lombok.NoArgsConstructor;
6+
7+
import java.io.Serializable;
8+
9+
/**
10+
* 服务时间范围.
11+
*
12+
* @author doger.wang
13+
* @date 2020-05-19
14+
*/
15+
@Data
16+
@NoArgsConstructor
17+
public class TimeRange implements Serializable {
18+
private static final long serialVersionUID = 8169562173656314930L;
19+
/**
20+
* start_time : 20091225091010
21+
* end_time : 20091225121010
22+
*/
23+
@SerializedName("start_time")
24+
private String startTime;
25+
@SerializedName("end_time")
26+
private String endTime;
27+
}

0 commit comments

Comments
 (0)