test(acceptance): reuse fixed customers and align native fulfillment flows
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
const MODULE = 'firstleg-container-fee-allocation'
|
||||
const OPTIONS = { scenario: 'firstleg-container-fee-allocation-http', deploymentBlocker: true }
|
||||
|
||||
import { run as createMerchant } from './merchant-qualification-fixture.mjs'
|
||||
import { run as createMerchant, requireFixedSecondaryCustomer } from './merchant-qualification-fixture.mjs'
|
||||
import { channelGroup } from './smart-loading-channel-group.mjs'
|
||||
|
||||
function id(value) { return value == null ? '' : String(value) }
|
||||
@@ -105,7 +105,7 @@ async function createCustomerWaitSplit(context, suffix, fixedRoute = null) {
|
||||
const runMarker = context.marker
|
||||
context.marker = `${runMarker}-${suffix}`
|
||||
if (fixedRoute) context.context.waitSplitRoute = fixedRoute
|
||||
await createMerchant(context)
|
||||
await createMerchant(context, { publishEnvironment: false, requireDistinctCustomer: suffix === 'ALLOC-B' })
|
||||
const orders = await import(new URL(`./orders.mjs?allocation=${encodeURIComponent(suffix)}-${Date.now()}`, import.meta.url))
|
||||
const measurementModule = await import(new URL(`./inbound-measurement.mjs?allocation=${encodeURIComponent(suffix)}-${Date.now()}`, import.meta.url))
|
||||
await orders.run(context)
|
||||
@@ -122,12 +122,14 @@ async function createCustomerWaitSplit(context, suffix, fixedRoute = null) {
|
||||
}
|
||||
|
||||
async function provisionCrossCustomerPlan(context) {
|
||||
if (context.options?.fixedCustomerId) throw new Error('缺少第二个固定客户,停止跨客户柜费造数')
|
||||
if (context.options?.fixedCustomerId && !context.options.fixedSecondaryCustomer) throw new Error('缺少第二个固定客户,停止跨客户柜费造数')
|
||||
if (context.options?.fixedCustomerId) requireFixedSecondaryCustomer(context.options)
|
||||
const originalMarker = context.marker
|
||||
const originalUsername = process.env.MERCHANT_TEST_USERNAME
|
||||
const originalPassword = process.env.MERCHANT_TEST_PASSWORD
|
||||
const originalRoute = context.context.waitSplitRoute
|
||||
const originalMerchant = context.context.merchantQualificationFixture
|
||||
const originalCustomerId = context.context.customerId
|
||||
try {
|
||||
const first = await createCustomerWaitSplit(context, 'ALLOC-A')
|
||||
const route = {
|
||||
@@ -173,6 +175,8 @@ async function provisionCrossCustomerPlan(context) {
|
||||
context.marker = originalMarker
|
||||
context.context.waitSplitRoute = originalRoute
|
||||
context.context.merchantQualificationFixture = originalMerchant
|
||||
if (originalCustomerId === undefined) delete context.context.customerId
|
||||
else context.context.customerId = originalCustomerId
|
||||
if (originalUsername === undefined) delete process.env.MERCHANT_TEST_USERNAME
|
||||
else process.env.MERCHANT_TEST_USERNAME = originalUsername
|
||||
if (originalPassword === undefined) delete process.env.MERCHANT_TEST_PASSWORD
|
||||
|
||||
Reference in New Issue
Block a user