mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-10-07 23:24:39 +08:00
🎨 #3633【微信支付】创建支付分订单接口请求参数里增加设备信息字段
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
package com.github.binarywang.wxpay.bean.payscore;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 设备信息
|
||||
**/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Device implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -4510224826631515321L;
|
||||
|
||||
|
||||
/**
|
||||
* 服务开始的设备ID
|
||||
*/
|
||||
@SerializedName("start_device_id")
|
||||
private String startDeviceId;
|
||||
|
||||
/**
|
||||
* 服务结束的设备ID
|
||||
*/
|
||||
@SerializedName("end_device_id")
|
||||
private String endDeviceId;
|
||||
|
||||
/**
|
||||
* 物料编码
|
||||
*/
|
||||
@SerializedName("materiel_no")
|
||||
private String materielNo;
|
||||
}
|
@@ -42,6 +42,7 @@ public class WxPayScoreRequest implements Serializable {
|
||||
* openid : oUpF8uMuAJO_M2pxb1Q9zNjWeS6o
|
||||
* need_user_confirm : true
|
||||
* profitSharing : false:不分账,默认:false,true:分账
|
||||
* device : {"start_device_id":"202501","end_device_id":"202502","materiel_no":"212323232"}
|
||||
*/
|
||||
@SerializedName("out_order_no")
|
||||
private String outOrderNo;
|
||||
@@ -95,4 +96,6 @@ public class WxPayScoreRequest implements Serializable {
|
||||
*/
|
||||
@SerializedName("complete_time")
|
||||
private String completeTime;
|
||||
@SerializedName("device")
|
||||
private Device device;
|
||||
}
|
||||
|
@@ -0,0 +1,45 @@
|
||||
package com.github.binarywang.wxpay.bean.payscore;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
* created on 2020-07-11
|
||||
*/
|
||||
public class WxPartnerPayScoreRequestTest {
|
||||
|
||||
@Test
|
||||
public void testToJson() {
|
||||
WxPartnerPayScoreRequest request = WxPartnerPayScoreRequest.builder()
|
||||
.outOrderNo("QLS202005201058000201")
|
||||
.appid("123")
|
||||
.serviceId("345")
|
||||
.serviceIntroduction("租借服务")
|
||||
.timeRange(new TimeRange("20230901011023", "20230930235959","开始时间","结束时间"))
|
||||
.device(new Device("deviceId","deviceId","212323232"))
|
||||
.build();
|
||||
System.out.println(request.toJson());
|
||||
String expectedJson =
|
||||
"{\"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\"}}";
|
||||
assertThat(request.toJson()).isEqualTo(expectedJson);
|
||||
// {
|
||||
// "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"
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
@@ -2,6 +2,8 @@ package com.github.binarywang.wxpay.bean.payscore;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
* created on 2020-07-11
|
||||
@@ -15,40 +17,29 @@ public class WxPayScoreRequestTest {
|
||||
.serviceId("345")
|
||||
.serviceIntroduction("租借服务")
|
||||
.timeRange(new TimeRange("20230901011023", "20230930235959","开始时间","结束时间"))
|
||||
.device(new Device("deviceId","deviceId","212323232"))
|
||||
.build();
|
||||
System.out.println(request.toJson());
|
||||
/* {
|
||||
"out_order_no":"QLS202005201058000201",
|
||||
"appid":"123",
|
||||
"service_id":"345",
|
||||
"service_introduction":"租借服务",
|
||||
"time_range":{
|
||||
"start_time":"OnAccept",
|
||||
"end_time":"20200520225840"
|
||||
},
|
||||
"location":{
|
||||
"start_location":"山",
|
||||
"end_location":"山"
|
||||
},
|
||||
"risk_fund":{
|
||||
"name":"DEPOSIT",
|
||||
"amount":200,
|
||||
"description":"丢失偿还费用2元/台"
|
||||
},
|
||||
"attach":"",
|
||||
"notify_url":"/pay/notify/payScore",
|
||||
"openid":"",
|
||||
"need_user_confirm":true,
|
||||
"profit_sharing":false,
|
||||
"post_payments":[
|
||||
{
|
||||
"name":"租借服务",
|
||||
"amount":100,
|
||||
"description":"服务费:1元/台",
|
||||
"count":1
|
||||
}
|
||||
],
|
||||
"total_amount":0
|
||||
}*/
|
||||
String json = request.toJson();
|
||||
System.out.println(json);
|
||||
|
||||
String expectedJson = "{\"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\"}}";
|
||||
assertThat(request.toJson()).isEqualTo(expectedJson);
|
||||
// {
|
||||
// "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"
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user