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:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user