Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd52e225

Browse files
authored
🎨#3633【微信支付】创建支付分订单接口请求参数里增加设备信息字段
1 parent686dff6 commitd52e225

File tree

4 files changed

+111
-34
lines changed

4 files changed

+111
-34
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
packagecom.github.binarywang.wxpay.bean.payscore;
2+
3+
importcom.google.gson.annotations.SerializedName;
4+
importlombok.AllArgsConstructor;
5+
importlombok.Data;
6+
importlombok.NoArgsConstructor;
7+
8+
importjava.io.Serializable;
9+
10+
/**
11+
* 设备信息
12+
**/
13+
@Data
14+
@NoArgsConstructor
15+
@AllArgsConstructor
16+
publicclassDeviceimplementsSerializable {
17+
18+
privatestaticfinallongserialVersionUID = -4510224826631515321L;
19+
20+
21+
/**
22+
* 服务开始的设备ID
23+
*/
24+
@SerializedName("start_device_id")
25+
privateStringstartDeviceId;
26+
27+
/**
28+
* 服务结束的设备ID
29+
*/
30+
@SerializedName("end_device_id")
31+
privateStringendDeviceId;
32+
33+
/**
34+
* 物料编码
35+
*/
36+
@SerializedName("materiel_no")
37+
privateStringmaterielNo;
38+
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public String toJson() {
4242
* openid : oUpF8uMuAJO_M2pxb1Q9zNjWeS6o
4343
* need_user_confirm : true
4444
* profitSharing : false:不分账,默认:false,true:分账
45+
* device : {"start_device_id":"202501","end_device_id":"202502","materiel_no":"212323232"}
4546
*/
4647
@SerializedName("out_order_no")
4748
privateStringoutOrderNo;
@@ -95,4 +96,6 @@ public String toJson() {
9596
*/
9697
@SerializedName("complete_time")
9798
privateStringcompleteTime;
99+
@SerializedName("device")
100+
privateDevicedevice;
98101
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
packagecom.github.binarywang.wxpay.bean.payscore;
2+
3+
importorg.testng.annotations.Test;
4+
5+
importstaticorg.assertj.core.api.Assertions.assertThat;
6+
7+
/**
8+
* @author <a href="https://github.com/binarywang">Binary Wang</a>
9+
* created on 2020-07-11
10+
*/
11+
publicclassWxPartnerPayScoreRequestTest {
12+
13+
@Test
14+
publicvoidtestToJson() {
15+
WxPartnerPayScoreRequestrequest =WxPartnerPayScoreRequest.builder()
16+
.outOrderNo("QLS202005201058000201")
17+
.appid("123")
18+
.serviceId("345")
19+
.serviceIntroduction("租借服务")
20+
.timeRange(newTimeRange("20230901011023","20230930235959","开始时间","结束时间"))
21+
.device(newDevice("deviceId","deviceId","212323232"))
22+
.build();
23+
System.out.println(request.toJson());
24+
StringexpectedJson =
25+
"{\"out_order_no\":\"QLS202005201058000201\",\"appid\":\"123\",\"service_id\":\"345\",\"service_introduction\":\"租借服务\",\"time_range\":{\"start_time\":\"20230901011023\",\"end_time\":\"20230930235959\",\"start_time_remark\":\"开始时间\",\"end_time_remark\":\"结束时间\"},\"device\":{\"start_device_id\":\"deviceId\",\"end_device_id\":\"deviceId\",\"materiel_no\":\"212323232\"}}";
26+
assertThat(request.toJson()).isEqualTo(expectedJson);
27+
// {
28+
// "out_order_no": "QLS202005201058000201",
29+
// "appid": "123",
30+
// "service_id": "345",
31+
// "service_introduction": "租借服务",
32+
// "time_range": {
33+
// "start_time": "20230901011023",
34+
// "end_time": "20230930235959",
35+
// "start_time_remark": "开始时间",
36+
// "end_time_remark": "结束时间"
37+
// },
38+
// "device": {
39+
// "start_device_id": "deviceId",
40+
// "end_device_id": "deviceId",
41+
// "materiel_no": "212323232"
42+
// }
43+
// }
44+
}
45+
}

‎weixin-java-pay/src/test/java/com/github/binarywang/wxpay/bean/payscore/WxPayScoreRequestTest.java

Lines changed: 25 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
importorg.testng.annotations.Test;
44

5+
importstaticorg.assertj.core.api.Assertions.assertThat;
6+
57
/**
68
* @author <a href="https://github.com/binarywang">Binary Wang</a>
79
* created on 2020-07-11
@@ -15,40 +17,29 @@ public void testToJson() {
1517
.serviceId("345")
1618
.serviceIntroduction("租借服务")
1719
.timeRange(newTimeRange("20230901011023","20230930235959","开始时间","结束时间"))
20+
.device(newDevice("deviceId","deviceId","212323232"))
1821
.build();
19-
System.out.println(request.toJson());
20-
/* {
21-
"out_order_no":"QLS202005201058000201",
22-
"appid":"123",
23-
"service_id":"345",
24-
"service_introduction":"租借服务",
25-
"time_range":{
26-
"start_time":"OnAccept",
27-
"end_time":"20200520225840"
28-
},
29-
"location":{
30-
"start_location":"山",
31-
"end_location":"山"
32-
},
33-
"risk_fund":{
34-
"name":"DEPOSIT",
35-
"amount":200,
36-
"description":"丢失偿还费用2元/台"
37-
},
38-
"attach":"",
39-
"notify_url":"/pay/notify/payScore",
40-
"openid":"",
41-
"need_user_confirm":true,
42-
"profit_sharing":false,
43-
"post_payments":[
44-
{
45-
"name":"租借服务",
46-
"amount":100,
47-
"description":"服务费:1元/台",
48-
"count":1
49-
}
50-
],
51-
"total_amount":0
52-
}*/
22+
Stringjson =request.toJson();
23+
System.out.println(json);
24+
25+
StringexpectedJson ="{\"out_order_no\":\"QLS202005201058000201\",\"appid\":\"123\",\"service_id\":\"345\",\"service_introduction\":\"租借服务\",\"time_range\":{\"start_time\":\"20230901011023\",\"end_time\":\"20230930235959\",\"start_time_remark\":\"开始时间\",\"end_time_remark\":\"结束时间\"},\"device\":{\"start_device_id\":\"deviceId\",\"end_device_id\":\"deviceId\",\"materiel_no\":\"212323232\"}}";
26+
assertThat(request.toJson()).isEqualTo(expectedJson);
27+
// {
28+
// "out_order_no": "QLS202005201058000201",
29+
// "appid": "123",
30+
// "service_id": "345",
31+
// "service_introduction": "租借服务",
32+
// "time_range": {
33+
// "start_time": "20230901011023",
34+
// "end_time": "20230930235959",
35+
// "start_time_remark": "开始时间",
36+
// "end_time_remark": "结束时间"
37+
// },
38+
// "device": {
39+
// "start_device_id": "deviceId",
40+
// "end_device_id": "deviceId",
41+
// "materiel_no": "212323232"
42+
// }
43+
// }
5344
}
5445
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp