新增 affiliate_dash 履约 executor(阶段 2)
- executor 常量/守卫 + affiliate-dash-executor(preparePaidTask/resolveDeliveryLink) - 履约业务实现:prepareAffiliateDashTask(幂等建单, client_order_no=task_no, data 透传 91单号/game_account) + syncAffiliateDashTaskStatus(状态合并: delivering→redeeming / delivered→核销→redeemed / ship_failed→retry_pending / cancelled→closed) - registry 注册 + 测试(212 全绿) - 真实建单联调通过(线上 skin.khhao.com,幂等不重复扣款) - 修复 POST /orders 响应 data.order 映射层级
This commit is contained in:
@@ -2,7 +2,10 @@ import type { JsonObject } from '../../../types/json.js'
|
||||
|
||||
import { affiliateDashRequest } from './http-client.js'
|
||||
|
||||
export type AffiliateDashOrder = ReturnType<typeof mapAffiliateDashOrder>
|
||||
export type AffiliateDashOrder = ReturnType<typeof mapAffiliateDashOrder> & {
|
||||
/** 命中幂等(200 + idempotent=true)时为 true,仅创建订单响应存在 */
|
||||
idempotent?: boolean
|
||||
}
|
||||
export type AffiliateDashDeliveryInfo = ReturnType<typeof mapAffiliateDashDeliveryInfo>
|
||||
export type AffiliateDashBindResult = ReturnType<typeof mapAffiliateDashBindResult>
|
||||
export type AffiliateDashWallet = ReturnType<typeof mapAffiliateDashWallet>
|
||||
@@ -35,7 +38,12 @@ export async function createAffiliateDashOrder(input: {
|
||||
pathname: ORDERS_PATH,
|
||||
payload,
|
||||
})
|
||||
return mapAffiliateDashOrder(json.data)
|
||||
const data = asJsonObject(json.data)
|
||||
const order = mapAffiliateDashOrder(data.order)
|
||||
return {
|
||||
...order,
|
||||
idempotent: Boolean(data.idempotent),
|
||||
}
|
||||
}
|
||||
|
||||
export async function getAffiliateDashOrder(orderNo: string) {
|
||||
@@ -137,6 +145,7 @@ export function mapAffiliateDashOrder(value: unknown) {
|
||||
createdAt: asString(source.created_at),
|
||||
deliveredAt: asString(source.delivered_at),
|
||||
cancelledAt: asString(source.cancelled_at),
|
||||
raw: isJsonObject(source) ? source : {},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user