fix: deliver actual destuff pallet fees

This commit is contained in:
2026-09-09 20:00:44 +08:00
parent b3e0ea9199
commit 71604c9c39
4 changed files with 14 additions and 4 deletions
@@ -7,11 +7,19 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
class DestuffingPalletCostServiceTest {
@Test void publishesDestuffingReceivableAsOverseasContainerBusiness() {
assertThat(DestuffingPalletCostService.DESTUFF_BUSINESS_TYPE).isEqualTo("OVERSEAS_CONTAINER");
}
@Test void newestCompletedBookingsAreNotStarvedByOldUnbillableRows() {
assertThat(DestuffingPalletCostService.READY_BOOKINGS_SQL)
.contains("ORDER BY MAX(t.completed_at) DESC LIMIT 50")
.doesNotContain("ORDER BY MIN(t.completed_at)");
}
@Test void chargesOnlyPalletsWithPositiveReceivedPackagesAndVolume() {
assertThat(DestuffingPalletCostService.RECEIVED_PALLET_IDS_SQL)
.contains("pp.actual_package_count>0")
.contains("pp.actual_volume_cbm>0");
}
@Test void preservesTotalAndLetsFinalCustomerAbsorbRoundingRemainder() {
List<BigDecimal> result = DestuffingPalletCostService.allocate(new BigDecimal("10.00"),
List.of(new BigDecimal("1"), new BigDecimal("1"), new BigDecimal("1")));