feat(client): show inbound business relationships

This commit is contained in:
2026-08-30 17:35:52 +08:00
parent 545a0f23ed
commit da92b75ae1
11 changed files with 288 additions and 30 deletions
@@ -0,0 +1,19 @@
import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import test from 'node:test'
const source = readFileSync(new URL('./inboundCodeAssociations.ts', import.meta.url), 'utf8')
test('queries the customer-scoped inbound-code association without browser-selected customer scope', () => {
assert.match(source, /method: 'GET'/)
assert.match(source, /`\/merchant\/v1\/orders\/first-leg\/inbound-code-associations\/\$\{encodeURIComponent\(inboundCode\.trim\(\)\)\}`/)
assert.doesNotMatch(source, /params:[\s\S]*customerId/)
})
test('keeps internal association identifiers as strings without making them display keys', () => {
for (const field of ['orderId', 'customerId']) assert.match(source, new RegExp(`${field}: string`))
assert.match(source, /destinationWarehouseId: string \| null/)
for (const field of ['inboundCode', 'orderNo', 'customerName', 'destinationWarehouseCode', 'destinationWarehouseName']) {
assert.match(source, new RegExp(`${field}: string`))
}
})
@@ -0,0 +1,22 @@
import { apiRequest } from '@/api/http'
export interface MerchantInboundCodeAssociation {
inboundCode: string
orderNo: string
orderStatus: string
orderId: string
customerId: string
customerName: string
destinationType: string
destinationCountryCode: string | null
destinationWarehouseId: string | null
destinationWarehouseCode: string | null
destinationWarehouseName: string | null
}
export function getMerchantInboundCodeAssociation(inboundCode: string) {
return apiRequest<MerchantInboundCodeAssociation>({
method: 'GET',
url: `/merchant/v1/orders/first-leg/inbound-code-associations/${encodeURIComponent(inboundCode.trim())}`,
})
}