test(firstleg): bind channel change hash to full payload
This commit is contained in:
+16
@@ -96,6 +96,22 @@ class OrderChannelChangePricingServiceTest {
|
||||
verify(repository, never()).applyOrderChannelChange(any(), any(), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
void sameOrderVersionRejectsDifferentChannelNamePayload() {
|
||||
InboundPricingEntity inbound = inbound("UNPRICED");
|
||||
InboundPricingIdempotencyEntity token = token(4L, "COMPLETED");
|
||||
token.setRequestHash(requestHash(request(4)));
|
||||
when(repository.findInboundByOrderForUpdate(10001L, 77L)).thenReturn(inbound);
|
||||
when(repository.findIdempotency(10001L, 0L, "ORDER_CHANNEL_CHANGE", "77:4")).thenReturn(token);
|
||||
Request changedName = new Request(10001L, 77L, 4L, 9L, "MATSON_NEW", "伪造名称",
|
||||
"FBA", 501L, "ONT8", "TAX_INCLUDED");
|
||||
|
||||
assertThatThrownBy(() -> service.apply(changedName))
|
||||
.isInstanceOf(BizException.class)
|
||||
.hasMessageContaining("同一订单版本已用于不同渠道变更");
|
||||
verify(estimator, never()).estimate(any());
|
||||
}
|
||||
|
||||
@Test
|
||||
void rejectsOlderOrderVersionAfterNewerVersionWasApplied() {
|
||||
InboundPricingEntity inbound = inbound("UNPRICED");
|
||||
|
||||
Reference in New Issue
Block a user