fix(优惠券中心):携程个测试用例调试优化
This commit is contained in:
@@ -0,0 +1,92 @@
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 携程核销优惠券通知接口测试
|
||||
* 参考文档:https://open.trip.com/apiplatform/order.jsp#operation/OrderConsumedNotice
|
||||
*/
|
||||
public class test_consumed_notice_interface {
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println("=== 携程核销优惠券通知接口测试 ===");
|
||||
|
||||
// 测试请求示例
|
||||
String testRequest = """
|
||||
{
|
||||
"header": {
|
||||
"accountId": "xiecheng",
|
||||
"serviceName": "OrderConsumedNotice",
|
||||
"requestTime": "2017-01-05 10:00:00",
|
||||
"version": "1.0",
|
||||
"sign": "374d95774f17c3e354e73f7aaf21b5ec"
|
||||
},
|
||||
"body": {
|
||||
"sequenceId": "2017-10-10abcd95774f17c3e354e73f7aaf21b5ec",
|
||||
"otaOrderId": "123456",
|
||||
"supplierOrderId": "100001",
|
||||
"items": [
|
||||
{
|
||||
"itemId": "123456",
|
||||
"useStartDate": "2017-02-04",
|
||||
"useEndDate": "2017-02-04",
|
||||
"quantity": 1,
|
||||
"useQuantity": 1,
|
||||
"passengers": [
|
||||
{
|
||||
"passengerId": "123456"
|
||||
}
|
||||
],
|
||||
"vouchers": [
|
||||
{
|
||||
"voucherId": "123456"
|
||||
}
|
||||
],
|
||||
"remark": "备注信息",
|
||||
"discount": {
|
||||
"policyList": [
|
||||
{
|
||||
"date": "2018-01-16",
|
||||
"quantity": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"lostAmount": 500,
|
||||
"lostAmountCurrency": "CNY"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
""";
|
||||
|
||||
System.out.println("测试请求:");
|
||||
System.out.println(testRequest);
|
||||
|
||||
// 测试响应示例
|
||||
String testResponse = """
|
||||
{
|
||||
"header": {
|
||||
"resultCode": "0000",
|
||||
"resultMessage": "操作成功"
|
||||
}
|
||||
}
|
||||
""";
|
||||
|
||||
System.out.println("\n期望响应:");
|
||||
System.out.println(testResponse);
|
||||
|
||||
System.out.println("\n=== 接口功能说明 ===");
|
||||
System.out.println("1. 接收携程发送的核销通知");
|
||||
System.out.println("2. 验证请求头和请求体的完整性");
|
||||
System.out.println("3. 检查订单是否存在");
|
||||
System.out.println("4. 防止重复处理(基于sequenceId)");
|
||||
System.out.println("5. 保存核销记录到数据库");
|
||||
System.out.println("6. 更新订单状态为已使用(状态8)");
|
||||
System.out.println("7. 返回处理结果");
|
||||
|
||||
System.out.println("\n=== 错误码说明 ===");
|
||||
System.out.println("0000: 操作成功");
|
||||
System.out.println("0001: 请求头验证失败");
|
||||
System.out.println("0002: 请求体验证失败");
|
||||
System.out.println("0003: 处理异常");
|
||||
System.out.println("4001: 订单不存在");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user