fix(courier): parse XFX form-urlencoded track callbacks and raw ACK

Enable urlencoded body parser, return XFX {code,message} without API envelope, and harden callback payload parsing.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-06 17:51:00 +08:00
parent 83b1b0e5f6
commit 571959900b
4 changed files with 31 additions and 9 deletions
@@ -47,12 +47,14 @@ export class DeliveryCallbackService {
const payload = this.xiaofeixiaProvider.parseTrackCallback(body);
if (!payload) {
const response = this.courier.buildTrackCallbackResponse(false);
await logCourierCall(this.prisma, {
...baseLog,
responseBody: response,
status: 'FAILED',
errorMessage: '回调体解析失败',
});
return this.courier.buildTrackCallbackResponse(false);
return response;
}
const order = payload.outNumber
@@ -64,13 +66,15 @@ export class DeliveryCallbackService {
: null;
if (!order) {
const response = this.courier.buildTrackCallbackResponse(false);
await logCourierCall(this.prisma, {
...baseLog,
responseBody: response,
status: 'FAILED',
errorMessage: '订单不存在',
externalNo: payload.outNumber || payload.trackingNumber,
});
return this.courier.buildTrackCallbackResponse(false);
return response;
}
const targetStatus = this.xiaofeixiaProvider.mapTrackStatus(