fix(firstleg): align merchant billing with sent fees

This commit is contained in:
2026-08-29 11:13:35 +08:00
parent b4db37392d
commit de101621dd
5 changed files with 13 additions and 13 deletions
@@ -34,7 +34,7 @@ class MerchantInboundBillingControllerContractTest {
assertThat(method.getAnnotation(PreAuthorize.class).value())
.isEqualTo("hasAuthority('merchant:order:view')");
assertThat(method.getAnnotation(Operation.class).description())
.contains("WAIT_SPLIT", "LOADING", "LOADED", "DELIVERED", "APPROVED + CONFIRMED", "已发布入库运费明细");
.contains("WAIT_SPLIT", "LOADING", "LOADED", "DELIVERED", "APPROVED + SENT", "已发布入库运费明细");
assertThat(MerchantInboundBillingController.class.getDeclaredMethods())
.noneMatch(candidate -> candidate.getName().toLowerCase().contains("confirm"));
@@ -42,7 +42,7 @@ class MerchantInboundBillingControllerContractTest {
.getContentAsString(StandardCharsets.UTF_8);
assertThat(openapi).contains("/api/merchant/v1/first-leg/orders/{orderId}/inbound-billing:")
.contains("WAIT_SPLIT", "LOADING、LOADED、DELIVERED", "measureReviewStatus=APPROVED",
"feeStatus=CONFIRMED", "PUBLISHED 入库运费明细");
"feeStatus=SENT", "PUBLISHED 入库运费明细", "CONFIRMED 只表示发送前确认完成");
}
@Test
@@ -39,7 +39,7 @@ class MerchantInboundBillingServiceTest {
@ParameterizedTest
@ValueSource(strings = {"WAIT_SPLIT", "LOADING", "LOADED", "DELIVERED"})
void shouldKeepPublishedBillingVisibleAfterFulfillmentProgresses(String processStatus) {
InboundOrderEntity inbound = inbound(processStatus, "APPROVED", "CONFIRMED");
InboundOrderEntity inbound = inbound(processStatus, "APPROVED", "SENT");
InboundOrderDetail detail = new InboundOrderDetail(mock(com.baiyue.firstleg.dto.InboundOrderSummary.class),
"客户备注", List.of(), List.of(
new InboundOrderDetail.FileSummary(1L, "RELATED", "public.pdf", "PUBLIC", 1, 1L, null),
@@ -86,7 +86,7 @@ class MerchantInboundBillingServiceTest {
@Test
void shouldHandleCase02() {
InboundOrderEntity inbound = inbound("WAIT_SPLIT", "PENDING", "CONFIRMED");
InboundOrderEntity inbound = inbound("WAIT_SPLIT", "PENDING", "SENT");
when(orders.findByOrderId(10001L, 77L)).thenReturn(inbound);
assertThatThrownBy(() -> service.find(10001L, 77L))
@@ -107,7 +107,7 @@ class MerchantInboundBillingServiceTest {
@Test
void shouldHandleCase04() {
InboundOrderEntity inbound = inbound("WAIT_SPLIT", "APPROVED", "CONFIRMED");
InboundOrderEntity inbound = inbound("WAIT_SPLIT", "APPROVED", "SENT");
InboundMeasurementResponses.Detail measurement = mock(InboundMeasurementResponses.Detail.class);
InboundMeasurementResponses.Item item = mock(InboundMeasurementResponses.Item.class);
when(item.intelligentImageFileId()).thenReturn(41L);
@@ -130,7 +130,7 @@ class MerchantInboundBillingServiceTest {
@Test
void shouldHandleCase05() {
InboundOrderEntity inbound = inbound("WAIT_SPLIT", "APPROVED", "CONFIRMED");
InboundOrderEntity inbound = inbound("WAIT_SPLIT", "APPROVED", "SENT");
InboundMeasurementResponses.Detail measurement = mock(InboundMeasurementResponses.Detail.class);
when(measurement.items()).thenReturn(List.of());
when(measurement.weightResults()).thenReturn(List.of());
@@ -144,8 +144,8 @@ class MerchantInboundBillingServiceTest {
}
@Test
void shouldRejectHistoricalPublishedStatusCombination() {
InboundOrderEntity inbound = inbound("WAIT_SPLIT", "APPROVED", "SENT");
void shouldRejectConfirmedFeeBeforeItIsSentAndPublished() {
InboundOrderEntity inbound = inbound("WAIT_SPLIT", "APPROVED", "CONFIRMED");
when(orders.findByOrderId(10001L, 77L)).thenReturn(inbound);
assertThatThrownBy(() -> service.find(10001L, 77L))
@@ -157,7 +157,7 @@ class MerchantInboundBillingServiceTest {
@ParameterizedTest
@ValueSource(strings = {"FEE_CONFIRMING", "VOIDED"})
void shouldRejectProcessStatusesOutsidePublishedFulfillmentLifecycle(String processStatus) {
InboundOrderEntity inbound = inbound(processStatus, "APPROVED", "CONFIRMED");
InboundOrderEntity inbound = inbound(processStatus, "APPROVED", "SENT");
when(orders.findByOrderId(10001L, 77L)).thenReturn(inbound);
assertThatThrownBy(() -> service.find(10001L, 77L))
@@ -168,7 +168,7 @@ class MerchantInboundBillingServiceTest {
@Test
void shouldRequirePublishedFreightDetailAfterLoadingCompletes() {
InboundOrderEntity inbound = inbound("LOADED", "APPROVED", "CONFIRMED");
InboundOrderEntity inbound = inbound("LOADED", "APPROVED", "SENT");
when(orders.findByOrderId(10001L, 77L)).thenReturn(inbound);
when(feeDetails.publishedFreight(10001L, 88L))
.thenThrow(new BizException(com.baiyue.common.core.api.ResultCode.NOT_FOUND,