feat(v2.6.0): authentic 4-courier cancellation, 3-column docs and AI connector fixes
This commit is contained in:
@@ -352,4 +352,41 @@ export class PathaoAdapter implements CourierAdapter {
|
||||
})),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Authentic Upstream Pathao Cancellation
|
||||
* Endpoint: POST /aladdin/api/v1/orders/{consignment_id}/cancel
|
||||
*/
|
||||
async cancelParcel(consignmentId: string, reason?: string): Promise<{ success: boolean; courier: SupportedCourier; consignment_id: string; message: string; raw_response?: any }> {
|
||||
if (!this.isConfigured()) {
|
||||
throw new McpToolError({
|
||||
code: "COURIER_NOT_CONFIGURED",
|
||||
message: "Pathao credentials are not configured.",
|
||||
courier: "pathao",
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
const client = await this.getClient();
|
||||
const response = await client.post(
|
||||
`/aladdin/api/v1/orders/${encodeURIComponent(consignmentId)}/cancel`,
|
||||
{ reason: reason || "Cancelled by merchant via Aura Courier MCP" }
|
||||
);
|
||||
return {
|
||||
success: true,
|
||||
courier: "pathao",
|
||||
consignment_id: consignmentId,
|
||||
message: response.data?.message || "Parcel successfully cancelled in Pathao Courier.",
|
||||
raw_response: response.data,
|
||||
};
|
||||
} catch (err: any) {
|
||||
const msg = err.response?.data?.message || err.message;
|
||||
throw new McpToolError({
|
||||
code: "COURIER_UPSTREAM_ERROR",
|
||||
message: `Pathao cancellation failed: ${msg}`,
|
||||
courier: "pathao",
|
||||
retryable: false,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user