test(acceptance): reuse fixed customers and align native fulfillment flows
This commit is contained in:
@@ -314,6 +314,14 @@ export function requestedOrderDestinationType(context) {
|
||||
const value = String(context?.context?.orderDestinationType || 'FBA').trim().toUpperCase()
|
||||
return ['FBA', 'OVERSEAS', 'PRIVATE'].includes(value) ? value : 'FBA'
|
||||
}
|
||||
export function restrictOrderDestinations(destinations, route) {
|
||||
const codes = values => new Set((values || []).map(value => String(value).trim().toUpperCase()).filter(Boolean))
|
||||
const included = codes(route.includeDestinationCodes), excluded = codes(route.excludeDestinationCodes)
|
||||
return destinations.filter(value => {
|
||||
const code = String(value.warehouseCode || '').trim().toUpperCase()
|
||||
return (!included.size || included.has(code)) && !excluded.has(code)
|
||||
})
|
||||
}
|
||||
export function eligibleOrderDestinations(values, destinationType) {
|
||||
const active = (Array.isArray(values) ? values : []).filter((warehouse) => warehouse?.status === 'ACTIVE')
|
||||
return destinationType === 'FBA'
|
||||
@@ -633,8 +641,7 @@ async function loadMasterData(context, merchantToken) {
|
||||
// a producer intended for the second FBA destination can silently reuse ABE4.
|
||||
if (destinationType !== 'PRIVATE') {
|
||||
destinations = [...new Map(destinations.map(value => [String(value.warehouseCode).trim().toUpperCase(), value])).values()]
|
||||
const excluded = new Set((fixedRoute.excludeDestinationCodes || []).map(value => String(value).trim().toUpperCase()).filter(Boolean))
|
||||
if (excluded.size) destinations = destinations.filter(value => !excluded.has(String(value.warehouseCode).trim().toUpperCase()))
|
||||
destinations = restrictOrderDestinations(destinations, fixedRoute)
|
||||
}
|
||||
|
||||
let pricingResult
|
||||
|
||||
Reference in New Issue
Block a user