From acba3c273bf887642d71fa7c6c8fa4955a4cbaed Mon Sep 17 00:00:00 2001 From: "andrey.galochkin" Date: Tue, 26 Nov 2024 19:00:40 +0400 Subject: [PATCH 1/6] ECWID-153267 - added `lang` parameter to `FetchedOrder` and `UpdatedOrder` models --- src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedOrder.kt | 1 + .../com/ecwid/apiclient/v3/dto/order/request/UpdatedOrder.kt | 1 + .../com/ecwid/apiclient/v3/dto/order/result/FetchedOrder.kt | 1 + 3 files changed, 3 insertions(+) diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedOrder.kt b/src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedOrder.kt index 76af5e35..117b83c6 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedOrder.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedOrder.kt @@ -93,6 +93,7 @@ fun FetchedOrder.toUpdated(): UpdatedOrder { paymentReference = paymentReference, loyalty = loyalty?.toUpdated(), customerFiscalCode = customerFiscalCode, + lang = lang, ) } diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/order/request/UpdatedOrder.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/order/request/UpdatedOrder.kt index cdca867a..f2ad6c9c 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/dto/order/request/UpdatedOrder.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/order/request/UpdatedOrder.kt @@ -97,6 +97,7 @@ data class UpdatedOrder( val paymentReference: String? = null, val loyalty: Loyalty? = null, val customerFiscalCode: String? = null, + val lang: String? = null, ) : ApiUpdatedDTO { diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/order/result/FetchedOrder.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/order/result/FetchedOrder.kt index db85e017..1418ff11 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/dto/order/result/FetchedOrder.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/order/result/FetchedOrder.kt @@ -119,6 +119,7 @@ data class FetchedOrder( val shippingLabelAvailableForShipment: Boolean = false, val loyalty: Loyalty? = null, val customerFiscalCode: String? = null, + var lang: String? = null, ) : ApiFetchedDTO, ApiResultDTO { From 3330c05ae2af733a43686effd22fe2bf102683ff Mon Sep 17 00:00:00 2001 From: "andrey.galochkin" Date: Tue, 26 Nov 2024 19:14:02 +0400 Subject: [PATCH 2/6] ECWID-153267 - added `lang` parameter to `fetchedOrderNullablePropertyRules` --- .../apiclient/v3/rule/nullablepropertyrules/FetchedOrderRules.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedOrderRules.kt b/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedOrderRules.kt index b50d999c..9c37b0c7 100644 --- a/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedOrderRules.kt +++ b/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedOrderRules.kt @@ -321,4 +321,5 @@ val fetchedOrderNullablePropertyRules: List> = listOf AllowNullable(FetchedOrder.LoyaltyRedemption::amount), AllowNullable(FetchedOrder.LoyaltyRedemption::cancelled), AllowNullable(FetchedOrder::customerFiscalCode), + AllowNullable(FetchedOrder::lang), ) From ae4b874202e0bc8838ff8974065071f0f7772cbb Mon Sep 17 00:00:00 2001 From: "andrey.galochkin" Date: Tue, 26 Nov 2024 20:01:49 +0400 Subject: [PATCH 3/6] ECWID-153267 - added `lang` parameter to `generateTestOrder` --- src/test/kotlin/com/ecwid/apiclient/v3/util/OrderUtils.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/kotlin/com/ecwid/apiclient/v3/util/OrderUtils.kt b/src/test/kotlin/com/ecwid/apiclient/v3/util/OrderUtils.kt index f1ba2b1d..7942d0c6 100644 --- a/src/test/kotlin/com/ecwid/apiclient/v3/util/OrderUtils.kt +++ b/src/test/kotlin/com/ecwid/apiclient/v3/util/OrderUtils.kt @@ -137,6 +137,7 @@ fun generateTestOrder(): UpdatedOrder { ), refererChannel = "Referer channel " + randomAlphanumeric(8), ), + lang = "en", orderExtraFields = listOf( UpdatedOrder.OrderExtraFields( customerInputType = "TEXT", From 88bb9611c4e393fd7a8374d3bf53dd07b80161a5 Mon Sep 17 00:00:00 2001 From: "andrey.galochkin" Date: Wed, 27 Nov 2024 12:14:38 +0400 Subject: [PATCH 4/6] ECWID-153267 - tests fix --- .../com/ecwid/apiclient/v3/dto/order/result/FetchedOrder.kt | 2 +- src/test/kotlin/com/ecwid/apiclient/v3/entity/OrdersTest.kt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/order/result/FetchedOrder.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/order/result/FetchedOrder.kt index 1418ff11..d6daea41 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/dto/order/result/FetchedOrder.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/order/result/FetchedOrder.kt @@ -119,7 +119,7 @@ data class FetchedOrder( val shippingLabelAvailableForShipment: Boolean = false, val loyalty: Loyalty? = null, val customerFiscalCode: String? = null, - var lang: String? = null, + val lang: String? = null, ) : ApiFetchedDTO, ApiResultDTO { diff --git a/src/test/kotlin/com/ecwid/apiclient/v3/entity/OrdersTest.kt b/src/test/kotlin/com/ecwid/apiclient/v3/entity/OrdersTest.kt index 34a52968..3264cfe3 100644 --- a/src/test/kotlin/com/ecwid/apiclient/v3/entity/OrdersTest.kt +++ b/src/test/kotlin/com/ecwid/apiclient/v3/entity/OrdersTest.kt @@ -437,7 +437,8 @@ private fun UpdatedOrder.cleanupForComparison(order: UpdatedOrder): UpdatedOrder it.copy( appliesToItems = null ) - } + }, + lang = order.lang ) } From 048c62341371825dee3bd9015e20f50fdea8b356 Mon Sep 17 00:00:00 2001 From: "andrey.galochkin" Date: Wed, 27 Nov 2024 15:10:20 +0400 Subject: [PATCH 5/6] ECWID-153267 - tests fix --- src/test/kotlin/com/ecwid/apiclient/v3/entity/CartsTest.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/test/kotlin/com/ecwid/apiclient/v3/entity/CartsTest.kt b/src/test/kotlin/com/ecwid/apiclient/v3/entity/CartsTest.kt index 71f89015..12ddec1b 100644 --- a/src/test/kotlin/com/ecwid/apiclient/v3/entity/CartsTest.kt +++ b/src/test/kotlin/com/ecwid/apiclient/v3/entity/CartsTest.kt @@ -3,6 +3,7 @@ package com.ecwid.apiclient.v3.entity import com.ecwid.apiclient.v3.converter.toUpdated import com.ecwid.apiclient.v3.dto.cart.request.* import com.ecwid.apiclient.v3.dto.cart.result.CalculateOrderDetailsResult +import com.ecwid.apiclient.v3.dto.cart.result.CalculateOrderDetailsResult.DiscountInfo import com.ecwid.apiclient.v3.dto.order.enums.* import com.ecwid.apiclient.v3.dto.order.request.OrderCreateRequest import com.ecwid.apiclient.v3.dto.order.request.OrderDetailsRequest @@ -352,7 +353,7 @@ class CartsTest : BaseEntityTest() { checkPersonsEquals(orderForCalculate.billingPerson, calculatedOrder.billingPerson) checkPersonsEquals(orderForCalculate.shippingPerson, calculatedOrder.shippingPerson) assertEquals( - null, + emptyList(), calculatedOrder.discountInfo ) // TODO Discover why after each calculation this field resets to null } From 95db5b0e3ac261762a63f05e94c69322c4546523 Mon Sep 17 00:00:00 2001 From: "andrey.galochkin" Date: Wed, 27 Nov 2024 15:44:15 +0400 Subject: [PATCH 6/6] ECWID-153267 - tests fix --- src/test/kotlin/com/ecwid/apiclient/v3/entity/CartsTest.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/test/kotlin/com/ecwid/apiclient/v3/entity/CartsTest.kt b/src/test/kotlin/com/ecwid/apiclient/v3/entity/CartsTest.kt index 12ddec1b..eba8613d 100644 --- a/src/test/kotlin/com/ecwid/apiclient/v3/entity/CartsTest.kt +++ b/src/test/kotlin/com/ecwid/apiclient/v3/entity/CartsTest.kt @@ -710,6 +710,7 @@ private fun UpdatedOrder.cleanupForComparison(order: UpdatedOrder): UpdatedOrder it.copy( appliesToItems = null ) - } + }, + lang = order.lang ) }