Files
baiyue-firstleg/lastleg-service/src/main/resources/openapi/order-budgets-v1.yaml
T

76 lines
4.4 KiB
YAML
Raw Normal View History

2026-10-29 13:36:38 +08:00
openapi: 3.0.3
info:
title: 海外客户下单预估资金校验
version: 1.0.0
2026-11-06 13:33:37 +08:00
description: 客户订单先原子落库并进入资金处理中,资金冻结通过Outbox异步执行。冻结成功后进入待审核,失败进入资金失败并可在原订单上重试;平台仅可审核待审核订单。余额优先、授信补足及不足判断由Finance原子执行;本服务不自行修改钱包。预算预占、订单和冻结指令在同一事务内写入,审核通过立即申请释放原预算,取消、驳回或终态同样释放;释放失败自动重试。散板冻结成功进入PENDING_ACCEPTANCE,失败进入FUNDING_FAILED。
2026-10-29 13:36:38 +08:00
security:
- bearerAuth: []
paths:
/api/merchant/v1/last-leg/order-budgets/{kind}/{key}:
parameters:
2026-11-06 13:33:37 +08:00
- {name: kind, in: path, required: true, schema: {type: string, enum: [procurement, trucking, looseboard]}}
2026-10-29 13:36:38 +08:00
- {name: key, in: path, required: true, schema: {type: string, minLength: 1, maxLength: 128}}
post:
2026-10-30 17:59:12 +08:00
summary: 兼容接口:发起或读取预算冻结请求
2026-11-06 13:33:37 +08:00
description: 客户身份仅来自认证。procurement需要merchant:cross-border:procurement:create,trucking需要merchant:cross-border:domestic-trucking:create,looseboard需要merchant:cross-border:pallet-shipping:create;权限不能交叉使用。采购金额是预算单价乘采购数量,免费样品零金额不发资金指令;卡车金额必须大于0。重试禁止更改金额或币种。
2026-10-29 13:36:38 +08:00
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [amount, currency]
properties:
amount: {type: number, minimum: 0, multipleOf: 0.01}
currency: {type: string, enum: [CNY, USD]}
responses:
'200': {$ref: '#/components/responses/Result'}
'403': {description: 身份或业务创建权限不足}
get:
summary: 读取当前客户本次下单的权威资金回执
2026-10-30 17:59:12 +08:00
description: 与POST相同创建权限;该接口保留用于旧客户端兼容。新客户端应直接创建订单,并通过订单资金状态接口读取异步结果。
2026-10-29 13:36:38 +08:00
responses:
'200': {$ref: '#/components/responses/Result'}
'403': {description: 身份或业务创建权限不足}
2026-10-30 17:59:12 +08:00
/api/merchant/v1/last-leg/order-budgets/{kind}/orders/{orderNo}:
parameters:
2026-11-06 13:33:37 +08:00
- {name: kind, in: path, required: true, schema: {type: string, enum: [procurement, trucking, looseboard]}}
2026-10-30 17:59:12 +08:00
- {name: orderNo, in: path, required: true, schema: {type: string, minLength: 1, maxLength: 128}}
get:
summary: 读取订单资金状态
2026-11-06 13:33:37 +08:00
description: 仅当前客户可读。FUNDING_PENDING期间客户端可短暂轮询;FUNDING_FAILED展示失败原因并允许重试。采购和卡车只有PENDING_REVIEW、散板只有PENDING_ACCEPTANCE且资金已冻结才允许平台审核。读取订单资金状态分别要求对应业务list权限,重试要求对应create权限。
2026-10-30 17:59:12 +08:00
responses:
'200': {$ref: '#/components/responses/Result'}
/api/merchant/v1/last-leg/order-budgets/{kind}/orders/{orderNo}/retry:
parameters:
2026-11-06 13:33:37 +08:00
- {name: kind, in: path, required: true, schema: {type: string, enum: [procurement, trucking, looseboard]}}
2026-10-30 17:59:12 +08:00
- {name: orderNo, in: path, required: true, schema: {type: string, minLength: 1, maxLength: 128}}
post:
summary: 重试订单资金冻结
description: 仅当前客户可重试FUNDING_FAILED订单,沿用原金额和币种;重复请求幂等。
responses:
'200': {$ref: '#/components/responses/Result'}
2026-10-29 13:36:38 +08:00
components:
securitySchemes:
bearerAuth: {type: http, scheme: bearer, bearerFormat: JWT}
responses:
Result:
description: 统一业务响应;code为字符串200表示查询或发起成功,不等于资金冻结成功。
content:
application/json:
schema:
type: object
properties:
code: {type: string}
message: {type: string}
data:
type: object
required: [status, amountCny, message, usable]
properties:
status: {type: string, enum: [FREEZE_PENDING, FROZEN, FAILED, RELEASE_PENDING, RELEASE_FAILED, RELEASED]}
amountCny: {type: number, minimum: 0}
message: {type: string}
orderNo: {type: string, nullable: true}
usable: {type: boolean}