fix(acceptance): select booking agents by carrier

This commit is contained in:
2026-09-02 16:38:44 +08:00
parent 1b1f2718b3
commit a8c71fef12
5 changed files with 35 additions and 17 deletions
@@ -1,7 +1,7 @@
const MODULE = 'ocean-bookings'
const OPTIONS = { scenario: 'ocean-booking-lifecycle', deploymentBlocker: true }
const BASE = '/api/platform/v1/ocean-bookings'
import { oceanBookingDraft, resolveOceanBookingMaster } from './ocean-booking-fixture.mjs'
import { oceanBookingDraft, resolveOceanBookingAgent, resolveOceanBookingMaster } from './ocean-booking-fixture.mjs'
import { oceanBookingFieldGaps } from './fulfillment-list-field-contract.mjs'
import { ensureMatsonCarrierPartner } from './carrier-partner-fixture.mjs'
@@ -46,14 +46,12 @@ export async function run(context) {
const master = await resolveOceanBookingMaster(context, MODULE)
if (!master) return
const suffix = context.marker.replace(/\D/g, '').slice(-10) || 'BOOKING'
const agentResponse = await request(context, 'GET', '/api/platform/v1/suppliers?tenantId=0&category=BOOKING&status=ACTIVE&page=1&size=20')
const agentPage = payload(agentResponse)
const agent = agentPage?.records?.find?.((item) => item?.category === 'BOOKING' && item?.status === 'ACTIVE')
step(context, '使用 ACTIVE BOOKING 订舱代理事实源', agentResponse, Boolean(agent?.id && agent?.name),
`supplierId=${id(agent?.id) || 'missing'}, scope=${agent?.scope || 'not-exposed'}`)
const agent = await resolveOceanBookingAgent(context, MODULE, 'MATSON', OPTIONS)
step(context, '使用 ACTIVE BOOKING 订舱代理事实源', null, Boolean(agent?.id && agent?.name),
`supplierId=${id(agent?.id) || 'missing'}`)
if (!agent?.id || !agent?.name) return
const carrier = await ensureMatsonCarrierPartner(context, MODULE, OPTIONS)
step(context, '使用 ACTIVE CARRIER 船公司事实源', agentResponse,
step(context, '使用 ACTIVE CARRIER 船公司事实源', null,
Boolean(carrier?.id && carrier?.carrierCode === 'MATSON'), `partnerId=${id(carrier?.id) || 'missing'}`)
if (!carrier?.id) return
const data = fullDraft(context, suffix, master, {