优化
This commit is contained in:
@@ -91,24 +91,23 @@ 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);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("平台公共渠道计费允许业务客户快照为空")
|
||||
void calculatesWithoutOptionalBusinessCustomerSnapshot() {
|
||||
@DisplayName("缺少订单客户归属时拒绝生成对客费用")
|
||||
void rejectsMissingOrderCustomerOwnership() {
|
||||
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", "14.300000", "2860.00", "0.00"));
|
||||
|
||||
FeeSnapshotResponse response = service.calculate(TENANT, OPERATOR, INBOUND, NOW, "calc-no-customer");
|
||||
|
||||
assertThat(response.totalAmount()).isEqualByComparingTo("2860.00");
|
||||
ArgumentCaptor<InboundFeeEntity> fee = ArgumentCaptor.forClass(InboundFeeEntity.class);
|
||||
verify(repository).insertFee(fee.capture());
|
||||
assertThat(fee.getValue().getCustomerId()).isNull();
|
||||
assertThatThrownBy(() -> service.calculate(
|
||||
TENANT, OPERATOR, INBOUND, NOW, "calc-no-customer"))
|
||||
.isInstanceOf(BizException.class)
|
||||
.hasMessageContaining("缺少订单客户归属");
|
||||
verify(priceBookEstimator, never()).estimate(any());
|
||||
verify(repository, never()).insertFee(any());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -144,6 +143,7 @@ class FbaPricingServiceTest {
|
||||
assertThat(response.nextProcessStatus()).isEqualTo("WAIT_SPLIT");
|
||||
verify(repository).markInboundCalculated(TENANT, INBOUND, "WAIT_SPLIT", "KG",
|
||||
new BigDecimal("167.000"));
|
||||
verify(financeOutbox, never()).publishInbound(any(), anyLong(), anyLong(), anyLong(), anyInt(), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user