Browse Source
沃尔玛官方 spec 里这两条路由都不存在,原实现会 404:
- GET /v3/returns/{returnOrderId}:Returns spec 只有 GET /v3/returns 与 POST .../refund
- GET /v3/orders/{id}/shipping:Orders spec 里该路径只有 POST(标发)
【改动】
- getReturn 改走列表接口 GET /v3/returns?returnOrderId=xxx&limit=1;
平台不保证过滤生效(沙箱 mock 就不生效),本地再按单号筛一次,
避免把别的退货单混进来
- getShipping 改读订单详情 GET /v3/orders/{id},从
orderLines[].orderLineStatuses[].trackingInfo 抽行级发货记录;
数据与「发货信息」完全一致
- 两个方法的对外签名不变,调用方无需改动
- 删除不再使用的 WalmartShipmentDtos 与 orders/shipping.json、
returns/detail.json 两个夹具
【顺带修复】
- markShipped 解析响应改用 parseQuietly:平台只回受理结果或空体时
返回最小结果而不是抛异常,避免成功的发货被幂等层记成 FAILED 后重试重复发货
【测试】158 个;新增「平台返回多条退货单时本地只保留目标单」
「无 trackingInfo 时返回空列表」等用例。
Co-Authored-By: Claude Code <noreply@anthropic.com>
7 changed files with 206 additions and 344 deletions
@ -1,134 +0,0 @@ |
|||||||
package common.ecommerce.walmart.dto; |
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty; |
|
||||||
|
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
/** |
|
||||||
* 沃尔玛报文结构:查询发货信息({@code GET /v3/orders/{purchaseOrderId}/shipping})。 |
|
||||||
* |
|
||||||
* <p>响应结构与标发请求体同形:{@code orderShipment.orderLines.orderLine[]}, |
|
||||||
* 每个行状态里带 {@code trackingInfo}。</p> |
|
||||||
* |
|
||||||
* <p>⚠ 沙箱实测该路由 404(mock 未实现)。若生产环境也不可用,可直接读订单详情 |
|
||||||
* {@code orderLines[].orderLineStatuses[].trackingInfo}——两种方式数据一致。</p> |
|
||||||
*/ |
|
||||||
public final class WalmartShipmentDtos { |
|
||||||
|
|
||||||
private WalmartShipmentDtos() { |
|
||||||
} |
|
||||||
|
|
||||||
/** 发货信息响应。 */ |
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true) |
|
||||||
public static final class ShipmentResponse { |
|
||||||
|
|
||||||
/** 发货单容器。 */ |
|
||||||
@JsonProperty("orderShipment") |
|
||||||
public OrderShipment orderShipment; |
|
||||||
} |
|
||||||
|
|
||||||
/** 发货单:行数组。 */ |
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true) |
|
||||||
public static final class OrderShipment { |
|
||||||
|
|
||||||
/** 行容器。 */ |
|
||||||
@JsonProperty("orderLines") |
|
||||||
public OrderLines orderLines; |
|
||||||
} |
|
||||||
|
|
||||||
/** 行容器。 */ |
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true) |
|
||||||
public static final class OrderLines { |
|
||||||
|
|
||||||
/** 发货行数组。 */ |
|
||||||
@JsonProperty("orderLine") |
|
||||||
public List<OrderLine> orderLine; |
|
||||||
} |
|
||||||
|
|
||||||
/** 发货行。 */ |
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true) |
|
||||||
public static final class OrderLine { |
|
||||||
|
|
||||||
/** 订单行号。 */ |
|
||||||
@JsonProperty("lineNumber") |
|
||||||
public String lineNumber; |
|
||||||
|
|
||||||
/** 行状态容器(发货记录在 {@code status=Shipped} 的那条里)。 */ |
|
||||||
@JsonProperty("orderLineStatuses") |
|
||||||
public OrderLineStatuses orderLineStatuses; |
|
||||||
} |
|
||||||
|
|
||||||
/** 行状态容器。 */ |
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true) |
|
||||||
public static final class OrderLineStatuses { |
|
||||||
|
|
||||||
/** 行状态数组。 */ |
|
||||||
@JsonProperty("orderLineStatus") |
|
||||||
public List<OrderLineStatus> orderLineStatus; |
|
||||||
} |
|
||||||
|
|
||||||
/** 行状态:发货记录就挂在这里。 */ |
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true) |
|
||||||
public static final class OrderLineStatus { |
|
||||||
|
|
||||||
/** 状态:{@code Shipped} / {@code Delivered} 等。 */ |
|
||||||
@JsonProperty("status") |
|
||||||
public String status; |
|
||||||
|
|
||||||
/** 该状态对应数量。 */ |
|
||||||
@JsonProperty("statusQuantity") |
|
||||||
public Quantity statusQuantity; |
|
||||||
|
|
||||||
/** 物流信息。 */ |
|
||||||
@JsonProperty("trackingInfo") |
|
||||||
public TrackingInfo trackingInfo; |
|
||||||
} |
|
||||||
|
|
||||||
/** 数量:与订单接口同形,{@code amount} 是字符串。 */ |
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true) |
|
||||||
public static final class Quantity { |
|
||||||
|
|
||||||
/** 计量单位。 */ |
|
||||||
@JsonProperty("unitOfMeasurement") |
|
||||||
public String unitOfMeasurement; |
|
||||||
|
|
||||||
/** 数量(字符串)。 */ |
|
||||||
@JsonProperty("amount") |
|
||||||
public String amount; |
|
||||||
} |
|
||||||
|
|
||||||
/** 物流信息。 */ |
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true) |
|
||||||
public static final class TrackingInfo { |
|
||||||
|
|
||||||
/** 发货时间,ISO-8601。 */ |
|
||||||
@JsonProperty("shipDateTime") |
|
||||||
public String shipDateTime; |
|
||||||
|
|
||||||
/** 承运商。 */ |
|
||||||
@JsonProperty("carrierName") |
|
||||||
public CarrierName carrierName; |
|
||||||
|
|
||||||
/** 运输方式编码。 */ |
|
||||||
@JsonProperty("methodCode") |
|
||||||
public String methodCode; |
|
||||||
|
|
||||||
/** 跟踪号。 */ |
|
||||||
@JsonProperty("trackingNumber") |
|
||||||
public String trackingNumber; |
|
||||||
} |
|
||||||
|
|
||||||
/** 承运商:{@code carrier} 与 {@code otherCarrier} 二选一。 */ |
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true) |
|
||||||
public static final class CarrierName { |
|
||||||
|
|
||||||
/** 标准承运商编码,如 {@code UPS}、{@code FedEx}。 */ |
|
||||||
@JsonProperty("carrier") |
|
||||||
public String carrier; |
|
||||||
|
|
||||||
/** 非标准承运商名称。 */ |
|
||||||
@JsonProperty("otherCarrier") |
|
||||||
public String otherCarrier; |
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,59 +0,0 @@ |
|||||||
{ |
|
||||||
"orderShipment": { |
|
||||||
"orderLines": { |
|
||||||
"orderLine": [ |
|
||||||
{ |
|
||||||
"lineNumber": "1", |
|
||||||
"orderLineStatuses": { |
|
||||||
"orderLineStatus": [ |
|
||||||
{ |
|
||||||
"status": "Created", |
|
||||||
"statusQuantity": { "unitOfMeasurement": "EACH", "amount": "1" }, |
|
||||||
"trackingInfo": null |
|
||||||
}, |
|
||||||
{ |
|
||||||
"status": "Shipped", |
|
||||||
"statusQuantity": { "unitOfMeasurement": "EACH", "amount": "1" }, |
|
||||||
"trackingInfo": { |
|
||||||
"shipDateTime": "2026-11-16T07:00:00.000Z", |
|
||||||
"carrierName": { "carrier": "UPS" }, |
|
||||||
"methodCode": "Standard", |
|
||||||
"trackingNumber": "1Z999AA10123456784" |
|
||||||
} |
|
||||||
} |
|
||||||
] |
|
||||||
} |
|
||||||
}, |
|
||||||
{ |
|
||||||
"lineNumber": "2", |
|
||||||
"orderLineStatuses": { |
|
||||||
"orderLineStatus": [ |
|
||||||
{ |
|
||||||
"status": "Created", |
|
||||||
"statusQuantity": { "unitOfMeasurement": "EACH", "amount": "1" }, |
|
||||||
"trackingInfo": null |
|
||||||
} |
|
||||||
] |
|
||||||
} |
|
||||||
}, |
|
||||||
{ |
|
||||||
"lineNumber": "3", |
|
||||||
"orderLineStatuses": { |
|
||||||
"orderLineStatus": [ |
|
||||||
{ |
|
||||||
"status": "Shipped", |
|
||||||
"statusQuantity": { "unitOfMeasurement": "EACH", "amount": "1" }, |
|
||||||
"trackingInfo": { |
|
||||||
"shipDateTime": "2026-11-16T08:00:00.000Z", |
|
||||||
"carrierName": { "otherCarrier": "Local Courier" }, |
|
||||||
"methodCode": "Freight", |
|
||||||
"trackingNumber": "LC-0001" |
|
||||||
} |
|
||||||
} |
|
||||||
] |
|
||||||
} |
|
||||||
} |
|
||||||
] |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,52 +0,0 @@ |
|||||||
{ |
|
||||||
"returnOrderId": "103738048909818825", |
|
||||||
"customerEmailId": "emailID123456@relay.walmart.com", |
|
||||||
"customerName": { "firstName": "Jane", "lastName": "Doe" }, |
|
||||||
"customerOrderId": "1234567891234", |
|
||||||
"refundMode": "POST_DELIVERY", |
|
||||||
"returnOrderDate": "2019-02-21T01:01:08.000Z", |
|
||||||
"returnType": "RETURN", |
|
||||||
"returnByDate": "2019-03-23T01:01:06.000Z", |
|
||||||
"totalRefundAmount": { "currencyAmount": 127.45, "currencyUnit": "USD" }, |
|
||||||
"returnChannel": { "channelName": "ONLINE" }, |
|
||||||
"returnLineGroups": [ |
|
||||||
{ |
|
||||||
"groupNo": 1, |
|
||||||
"returnLines": [ { "returnOrderLineNumber": 1 } ], |
|
||||||
"labels": [ |
|
||||||
{ |
|
||||||
"labelImageURL": "https://i5.walmartimages.com/asr/label.png", |
|
||||||
"carrierInfoList": [ |
|
||||||
{ |
|
||||||
"carrierId": "11", |
|
||||||
"carrierName": "FEDEX", |
|
||||||
"serviceType": "FedEx Ground", |
|
||||||
"trackingNo": "785611449666" |
|
||||||
} |
|
||||||
] |
|
||||||
} |
|
||||||
], |
|
||||||
"returnExpectedFlag": true |
|
||||||
} |
|
||||||
], |
|
||||||
"returnOrderLines": [ |
|
||||||
{ |
|
||||||
"returnOrderLineNumber": 1, |
|
||||||
"salesOrderLineNumber": 1, |
|
||||||
"returnReason": "DAMAGED", |
|
||||||
"purchaseOrderId": "4790210558890", |
|
||||||
"item": { |
|
||||||
"sku": "ANTL_GDL-0700", |
|
||||||
"productName": "Antlion Audio ModMic" |
|
||||||
}, |
|
||||||
"quantity": { "unitOfMeasure": "EACH", "measurementValue": 2 }, |
|
||||||
"unitPrice": { "currencyAmount": 119.95, "currencyUnit": "USD" }, |
|
||||||
"chargeTotals": [ { "name": "lineTotal", "value": 239.9 } ], |
|
||||||
"currentDeliveryStatus": "IN_TRANSIT", |
|
||||||
"currentRefundStatus": "REFUND_PROCESSED", |
|
||||||
"refundedQty": 2, |
|
||||||
"status": "IN_TRANSIT", |
|
||||||
"statusTime": "2019-03-05T00:00:00.000Z" |
|
||||||
} |
|
||||||
] |
|
||||||
} |
|
||||||
Loading…
Reference in new issue