fix: support id-only overseas destinations

This commit is contained in:
2026-08-24 22:51:33 +08:00
parent 0e73a79479
commit 1e8d85c714
6 changed files with 39 additions and 13 deletions
@@ -92,6 +92,22 @@ class InventoryCommandServiceTest {
verify(ledgers).insert(any(InventoryLedger.class));
}
@Test
void registersIdOnlyOverseasDestinationWithoutInventingAWarehouseCode() {
when(balances.lockDimension("100", "WH-1", "", 101L, "IN-CODE-1")).thenReturn(null);
InventoryCommandRequests.InTransit request = new InventoryCommandRequests.InTransit(
"Customer 100", "WH-1", "WH1", "Warehouse 1", "DEST-OVERSEAS", null,
"New York warehouse", 101L, "IN-1", "IN-CODE-1", "SKU-1", "Product 1", null,
1, "ORD-1", "EVT-1", "transit-id-only", null);
service.registerInTransit("100", "SYSTEM", request);
ArgumentCaptor<InventoryBalance> inserted = ArgumentCaptor.forClass(InventoryBalance.class);
verify(balances).insert(inserted.capture());
assertEquals("DEST-OVERSEAS", inserted.getValue().getDestinationWarehouseId());
assertEquals("", inserted.getValue().getDestinationWarehouseCode());
}
@Test
void stockInTransfersPackagesFromInTransitToAvailable() {
InventoryBalance balance = balance(200L, 0);