修正发货回调流程
This commit is contained in:
@@ -32,7 +32,7 @@ export const paymentStatusTable: ParamSpec[] = [
|
||||
{ name: 'cancelled', type: 'payment_status', desc: '已取消' },
|
||||
]
|
||||
|
||||
// 订单对象公共字段说明,下单/查询/取消/回传响应共用。
|
||||
// 订单对象公共字段说明,下单/查询/取消响应共用。
|
||||
const orderFields: ParamSpec[] = [
|
||||
{ name: 'order_no', type: 'string', required: true, desc: '平台订单号' },
|
||||
{ name: 'client_order_no', type: 'string', required: true, desc: '调用方传入的幂等单号' },
|
||||
@@ -50,8 +50,8 @@ const orderFields: ParamSpec[] = [
|
||||
{ name: 'currency', type: 'string', desc: '货币,默认 POINT' },
|
||||
{ name: 'buyer_reference', type: 'string', desc: '买家标识/备注' },
|
||||
{ name: 'data', type: 'object', desc: '下单时透传的请求数据(原样回显)' },
|
||||
{ name: 'result', type: 'object', desc: '履约器回传的结果数据(原样回显)' },
|
||||
{ name: 'provider_order_no', type: 'string', desc: '履约器侧单号' },
|
||||
{ name: 'result', type: 'object', desc: '发货平台回调的结果数据(原样回显)' },
|
||||
{ name: 'provider_order_no', type: 'string', desc: '发货平台侧单号' },
|
||||
{ name: 'failure_reason', type: 'string', desc: '最近一次失败原因' },
|
||||
{ name: 'created_at', type: 'datetime', desc: '创建时间' },
|
||||
{ name: 'delivered_at', type: 'datetime', desc: '履约成功时间' },
|
||||
@@ -200,32 +200,6 @@ export const endpoints: EndpointSpec[] = [
|
||||
'已进入 processing/succeeded 的订单不可取消,返回 400。',
|
||||
],
|
||||
},
|
||||
{
|
||||
key: 'ship-notify',
|
||||
method: 'POST',
|
||||
path: '/api/client/v1/orders/{order_no}/ship-notify',
|
||||
summary: '履约器回传履约结果(processing/success/failed)',
|
||||
scope: 'fulfillment:write',
|
||||
pathParams: [{ name: 'order_no', type: 'string', required: true, desc: '平台订单号', example: 'FO20260730000123' }],
|
||||
bodyParams: [
|
||||
{ name: 'ship_status', type: 'enum(processing|success|failed)', required: true, desc: '履约结果', example: 'success' },
|
||||
{ name: 'provider_order_no', type: 'string', desc: '履约器侧单号', example: 'SRC20260720001' },
|
||||
{ name: 'fail_reason', type: 'string', desc: '失败原因(failed 时建议填)' },
|
||||
{ name: 'result', type: 'object', desc: '履约结果数据,原样存储并回显' },
|
||||
],
|
||||
requestExample: `{
|
||||
"ship_status": "success",
|
||||
"provider_order_no": "SRC20260720001",
|
||||
"result": { "delivered_at": "2026-07-30T10:05:00+08:00" }
|
||||
}`,
|
||||
responseExample: orderResponseExample,
|
||||
responseFields: orderFields,
|
||||
notes: [
|
||||
'processing → fulfillment_status=processing;success → succeeded;failed → failed(可重试)。',
|
||||
'已 succeeded 的订单再推 success 仍返回成功,不重复处理(幂等)。',
|
||||
'已 succeeded 推 failed、或 cancelled 订单推送 → 返回 400 拒绝。',
|
||||
],
|
||||
},
|
||||
{
|
||||
key: 'get-wallet',
|
||||
method: 'GET',
|
||||
|
||||
@@ -67,7 +67,6 @@ const scopeOptions = [
|
||||
{ value: 'orders:read', label: '订单读取' },
|
||||
{ value: 'orders:write', label: '订单写入' },
|
||||
{ value: 'fulfillment:read', label: '履约读取' },
|
||||
{ value: 'fulfillment:write', label: '履约写入' },
|
||||
{ value: 'wallet:read', label: '钱包读取' },
|
||||
]
|
||||
|
||||
|
||||
@@ -35,9 +35,9 @@ export default function OpenApiDocs() {
|
||||
开放接口
|
||||
</Title>
|
||||
<Paragraph type="secondary">
|
||||
面向商户系统、履约器和外部平台调用的通用开放 API。凭证在「商户中心 / API 客户端」创建,
|
||||
面向商户系统调用的开放 API。凭证在「商户中心 / API 客户端」创建,
|
||||
采用 <Text code>X-App-Key</Text> + HMAC-SHA256 签名鉴权。
|
||||
原 <Text code>/api/open/v1</Text> 保留给上游发货对接,不在本页展示。
|
||||
<Text code>/api/open/v1</Text> 仅保留给发货平台查询与回传,不在本页展示。
|
||||
</Paragraph>
|
||||
|
||||
<Tabs
|
||||
@@ -80,7 +80,7 @@ function OverviewTab() {
|
||||
<li>在「商户中心 / API 客户端」创建凭证,获得 <Text code>AppKey</Text> 与 <Text code>AppSecret</Text>。</li>
|
||||
<li>每次请求携带 <Text code>X-App-Key / X-Timestamp / X-Nonce / X-Sign</Text> 四个鉴权头。</li>
|
||||
<li>调用「商品列表」拿到可售 <Text code>sku</Text>,调用「下单」创建订单并扣款。</li>
|
||||
<li>履约器通过「发货回传」回写 processing/success/failed,状态可由「查询订单」轮询。</li>
|
||||
<li>拿到 <Text code>order_no</Text> 后进入发货链接;订单状态由发货平台回调更新,可通过「查询订单」轮询。</li>
|
||||
</ol>
|
||||
}
|
||||
/>
|
||||
@@ -234,13 +234,13 @@ function StatusTab() {
|
||||
↓
|
||||
POST /orders 下单(幂等,Idempotency-Key = client_order_no)
|
||||
↓
|
||||
(履约器)POST /orders/{order_no}/ship-notify ship_status=processing
|
||||
拿响应里的 order_no 进入发货平台链接
|
||||
↓
|
||||
按 product.sku 发货
|
||||
发货平台查询订单并执行发货
|
||||
↓
|
||||
POST /orders/{order_no}/ship-notify ship_status=success 或 failed
|
||||
发货平台通过上游回调更新 fulfillment_status
|
||||
↓
|
||||
(可选)GET /orders/{order_no} 轮询确认 fulfillment_status=succeeded`}</pre>
|
||||
GET /orders/{order_no} 轮询,或接收 order.fulfillment.updated 回调`}</pre>
|
||||
}
|
||||
/>
|
||||
</Space>
|
||||
|
||||
Reference in New Issue
Block a user