fix: finish received transfers after relabel settlement

This commit is contained in:
2026-10-23 00:44:42 +08:00
parent 40d1b06312
commit 0fd523e740
2 changed files with 20 additions and 1 deletions
@@ -1164,6 +1164,24 @@ class RelabelApplicationServiceTest {
verify(inventoryCommands, never()).release(any(), any(), any());
}
@Test
void receivedTransferAfterPdaSettlementCompletesWithoutDuplicateFinancialCommands() {
RelabelApplication app = transferCompletionFixture();
for (String walletStatus : List.of("SETTLE_PENDING", "SETTLED")) {
app.setStatus(RelabelApplicationService.READY_FOR_OUTBOUND); app.setFulfillmentStatus("OUTBOUNDED");
app.setWalletStatus(walletStatus);
service.completeWarehouseTransferFulfillment("10001", app.getRelabelNo(), 91L, "operator-1");
service.completeWarehouseTransferFulfillment("10001", app.getRelabelNo(), 91L, "operator-1");
assertEquals("COMPLETED", app.getStatus()); assertEquals("COMPLETED", app.getFulfillmentStatus());
assertEquals(walletStatus, app.getWalletStatus());
}
verify(histories, times(2)).insert(any(RelabelStatusHistory.class));
verify(feeSources, never()).publishApproved(any(), any(), any());
verify(walletCommands, never()).publish(any(), anyLong(), any(), any(), any(), any(), anyLong());
verify(inventoryCommands, never()).release(any(), any(), any());
verify(inventoryCommands, never()).releaseTransferRelabel(any(), any(), any(), any(), any());
}
@Test
void transferCompletionRejectsWrongLinkUnreceivedStockMissingConfirmationOrFailedFreeze() {
RelabelApplication app = transferCompletionFixture();