优化
This commit is contained in:
+6
-1
@@ -51,7 +51,8 @@ class OrderDeclarationUpdateContractTest {
|
||||
assertThat(map(row.get("actualVolumeCbm")).get("description").toString()).contains("仅 Firstleg 实测");
|
||||
assertThat(source).contains("ORDER_DECLARATION_UPDATED_V1", "platform:order:declaration:edit", "A0409",
|
||||
"/internal/firstleg/v1/inbounds/order-channel-changes/validate",
|
||||
"/internal/firstleg/v1/pricing/order-channel-changes/validate");
|
||||
"/internal/firstleg/v1/pricing/order-channel-changes/validate",
|
||||
"/internal/firstleg/v1/pricing/order-channel-changes/apply");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -60,10 +61,14 @@ class OrderDeclarationUpdateContractTest {
|
||||
String.class, FirstlegInboundClient.OrderChannelChangeValidationRequest.class);
|
||||
var pricing = FirstlegPricingClient.class.getDeclaredMethod("validateOrderChannelChange",
|
||||
String.class, FirstlegPricingClient.OrderChannelChangeRequest.class);
|
||||
var applyPricing = FirstlegPricingClient.class.getDeclaredMethod("applyOrderChannelChange",
|
||||
String.class, FirstlegPricingClient.OrderChannelChangeRequest.class);
|
||||
assertThat(fulfillment.getAnnotation(PostMapping.class).value())
|
||||
.containsExactly("/order-channel-changes/validate");
|
||||
assertThat(pricing.getAnnotation(PostMapping.class).value())
|
||||
.containsExactly("/order-channel-changes/validate");
|
||||
assertThat(applyPricing.getAnnotation(PostMapping.class).value())
|
||||
.containsExactly("/order-channel-changes/apply");
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@@ -171,6 +171,25 @@ class OrderInboundOutboxPublisherTest {
|
||||
verify(fixture.repository).markOutboxPublished(eq(11L), eq(41L), any(LocalDateTime.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
void channelPricingApplyFailureKeepsOutboxPendingAndDoesNotAdvanceFulfillmentSnapshot() {
|
||||
String payload = "{\"schemaVersion\":1,\"eventId\":\"evt-3\",\"tenantId\":11,"
|
||||
+ "\"orderId\":21,\"orderNo\":\"ORD-21\",\"inboundCode\":\"RK-21\","
|
||||
+ "\"version\":4,\"operatorId\":7,\"channelCode\":\"SEA\","
|
||||
+ "\"channelName\":\"海运\",\"channelChanged\":true,\"cargoes\":[],"
|
||||
+ "\"changes\":[{\"field\":\"channelName\",\"beforeValue\":\"旧渠道\",\"afterValue\":\"海运\"}]}";
|
||||
Fixture fixture = fixture(event("ORDER_DECLARATION_UPDATED_V1", 11L, 21L, payload));
|
||||
when(fixture.pricingClient.applyOrderChannelChange(eq("internal-token"), any())).thenReturn(
|
||||
ApiResponse.failure(com.baiyue.common.core.api.ResultCode.CONFLICT,
|
||||
"费用已确认或已发布,渠道不可变更", null, null));
|
||||
|
||||
fixture.publisher.publishApprovedOrders();
|
||||
|
||||
verify(fixture.repository).markOutboxRetry(eq(11L), eq(41L), any(LocalDateTime.class));
|
||||
verify(fixture.client, never()).updateDeclaration(any(), any());
|
||||
verify(fixture.repository, never()).markOutboxPublished(anyLong(), anyLong(), any());
|
||||
}
|
||||
|
||||
private Fixture fixture(OutboxEventEntity event) {
|
||||
return fixture(event, "BUY_DECLARATION");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user