修改提交

This commit is contained in:
2026-09-04 11:50:01 +08:00
parent 55cad93be3
commit 6f32971d79
6 changed files with 23 additions and 28 deletions
@@ -98,7 +98,7 @@ class FbaPricingServiceTest {
assertThat(fee.getValue().getPricingTaxMode()).isEqualTo("TAX_INCLUDED");
assertThat(fee.getValue().getChargeRuleId()).isNull();
assertThat(fee.getValue().getCarrierId()).isNull();
assertThat(fee.getValue().getCustomerId()).isEqualTo(11L);
assertThat(fee.getValue().getCustomerId()).isEqualTo(TENANT);
assertThat(fee.getValue().getConversionFactor()).isEqualByComparingTo("167");
assertThat(fee.getValue().getRoundingScale()).isEqualTo(6);
assertThat(fee.getValue().getRoundingMode()).isEqualTo("HALF_UP");
@@ -151,19 +151,20 @@ class FbaPricingServiceTest {
}
@Test
@DisplayName("缺少订单客户归属时拒绝生成对客费用")
void rejectsMissingOrderCustomerOwnership() {
@DisplayName("订单客户字段为空时使用租户归属生成对客费用")
void usesTenantOwnershipWhenOrderCustomerIsMissing() {
readyRepository();
InboundPricingEntity inbound = inbound("200.000", "0.2000");
inbound.setCustomerId(null);
when(repository.findInbound(TENANT, INBOUND)).thenReturn(inbound);
when(priceBookEstimator.estimate(any())).thenReturn(
estimate("KG", "200.000", "2.000000", "400.00", "0.00"));
assertThatThrownBy(() -> service.calculate(
TENANT, OPERATOR, INBOUND, NOW, "calc-no-customer"))
.isInstanceOf(BizException.class)
.hasMessageContaining("缺少订单客户归属");
verify(priceBookEstimator, never()).estimate(any());
verify(repository, never()).insertFee(any());
assertThat(service.calculate(TENANT, OPERATOR, INBOUND, NOW, "calc-no-customer"))
.isNotNull();
ArgumentCaptor<InboundFeeEntity> fee = ArgumentCaptor.forClass(InboundFeeEntity.class);
verify(repository).insertFee(fee.capture());
assertThat(fee.getValue().getCustomerId()).isEqualTo(TENANT);
}
@Test