|
|
|
|
@ -10,6 +10,7 @@ import common.ecommerce.warehouse.model.ShipTo;
@@ -10,6 +10,7 @@ import common.ecommerce.warehouse.model.ShipTo;
|
|
|
|
|
import org.junit.jupiter.api.Test; |
|
|
|
|
|
|
|
|
|
import java.time.Instant; |
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
import static org.junit.jupiter.api.Assertions.assertEquals; |
|
|
|
|
import static org.junit.jupiter.api.Assertions.assertNull; |
|
|
|
|
@ -171,4 +172,68 @@ class EdayunOrderTest {
@@ -171,4 +172,68 @@ class EdayunOrderTest {
|
|
|
|
|
|
|
|
|
|
assertNull(EdayunOrderMapper.toCreateRequest(base().build(), "2").addService); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** 任意商品行带保价金额 → 整单开保价(addService 是订单级开关)。 */ |
|
|
|
|
@Test |
|
|
|
|
void insuredLineMapsToInsuranceService() { |
|
|
|
|
OutboundCommand insured = OutboundCommand.builder() |
|
|
|
|
.outboundRequestNo("OB-3") |
|
|
|
|
.salesPlatform(Platform.AMAZON_SC) |
|
|
|
|
.shipTo(ShipTo.builder().name("a").phone("p") |
|
|
|
|
.countryCode("US").stateOrProvince("CA").city("c") |
|
|
|
|
.addressLine1("a1").postalCode("1").build()) |
|
|
|
|
.line(OutboundLine.builder().lineNo("1").omsSku("S").quantity(1) |
|
|
|
|
.insuredAmount(Money.of("100.00", "USD")).build()) |
|
|
|
|
.build(); |
|
|
|
|
|
|
|
|
|
EdayunCreateOrderDtos.CreateOrderRequest req = |
|
|
|
|
EdayunOrderMapper.toCreateRequest(insured, "2"); |
|
|
|
|
|
|
|
|
|
assertEquals(1, req.addService.size()); |
|
|
|
|
assertEquals("is_insurance", req.addService.get(0)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** 签收 + 保价可同时下发。 */ |
|
|
|
|
@Test |
|
|
|
|
void signatureAndInsuranceCanCoexist() { |
|
|
|
|
OutboundCommand both = OutboundCommand.builder() |
|
|
|
|
.outboundRequestNo("OB-4") |
|
|
|
|
.salesPlatform(Platform.AMAZON_SC) |
|
|
|
|
.signatureRequired(true) |
|
|
|
|
.shipTo(ShipTo.builder().name("a").phone("p") |
|
|
|
|
.countryCode("US").stateOrProvince("CA").city("c") |
|
|
|
|
.addressLine1("a1").postalCode("1").build()) |
|
|
|
|
.line(OutboundLine.builder().lineNo("1").omsSku("S").quantity(1) |
|
|
|
|
.insuredAmount(Money.of("50.00", "USD")).build()) |
|
|
|
|
.build(); |
|
|
|
|
|
|
|
|
|
List<String> services = EdayunOrderMapper.toCreateRequest(both, "2").addService; |
|
|
|
|
|
|
|
|
|
assertEquals(2, services.size()); |
|
|
|
|
assertTrue(services.contains("is_signature")); |
|
|
|
|
assertTrue(services.contains("is_insurance")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** 增补:平台单号同时带 eBay Transaction ID 与商品级 itemId。 */ |
|
|
|
|
@Test |
|
|
|
|
void ebayIdsAreNotMappedYet() { |
|
|
|
|
// 标准模型没有 ebayTransactionId / ebayItemId;
|
|
|
|
|
// 商品级的 platformOrderItemIds 目前只映射到 platformItemId(亚马逊口径)
|
|
|
|
|
OutboundCommand cmd = OutboundCommand.builder() |
|
|
|
|
.outboundRequestNo("OB-5") |
|
|
|
|
.salesPlatform(Platform.EBAY) |
|
|
|
|
.shipTo(ShipTo.builder().name("a").phone("p") |
|
|
|
|
.countryCode("US").stateOrProvince("CA").city("c") |
|
|
|
|
.addressLine1("a1").postalCode("1").build()) |
|
|
|
|
.line(OutboundLine.builder().lineNo("1").omsSku("S").quantity(1) |
|
|
|
|
.platformOrderItemId("EBAY-ITEM-1").build()) |
|
|
|
|
.build(); |
|
|
|
|
|
|
|
|
|
EdayunCreateOrderDtos.CreateOrderRequest req = |
|
|
|
|
EdayunOrderMapper.toCreateRequest(cmd, "2"); |
|
|
|
|
|
|
|
|
|
assertEquals("eBay", req.channelName); |
|
|
|
|
assertNull(req.ebayTransactionId); |
|
|
|
|
assertEquals("EBAY-ITEM-1", req.productItemVOList.get(0).platformItemId); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|