From de6838d84f0acb5b47e4721780f3208ddb883228 Mon Sep 17 00:00:00 2001 From: zont Date: Thu, 2 Nov 2023 15:12:07 +0400 Subject: [PATCH 1/7] ECWID-126274 OE2: The discount Based on Customer Groups is deducted from the gift card: added isGiftCard into order and cart --- .../kotlin/com/ecwid/apiclient/v3/converter/FetchedOrder.kt | 2 +- .../ecwid/apiclient/v3/dto/cart/request/OrderForCalculate.kt | 1 + .../apiclient/v3/dto/cart/result/CalculateOrderDetailsResult.kt | 1 + .../com/ecwid/apiclient/v3/dto/cart/result/FetchedCart.kt | 1 + src/test/kotlin/com/ecwid/apiclient/v3/entity/CartsTest.kt | 2 ++ .../apiclient/v3/rule/nullablepropertyrules/FetchedCartRules.kt | 1 + .../v3/rule/nullablepropertyrules/OrderForCalculateRules.kt | 1 + src/test/kotlin/com/ecwid/apiclient/v3/util/OrderUtils.kt | 1 + 8 files changed, 9 insertions(+), 1 deletion(-) 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 4ba3aba2..7f8219b6 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedOrder.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedOrder.kt @@ -145,10 +145,10 @@ fun FetchedOrder.OrderItem.toUpdated(): UpdatedOrder.OrderItem { fixedShippingRateOnly = fixedShippingRateOnly, digital = digital, couponApplied = couponApplied, + isGiftCard = isGiftCard, discountsAllowed = discountsAllowed, isCustomerSetPrice = isCustomerSetPrice, - isGiftCard = isGiftCard, nameTranslated = nameTranslated, selectedPrice = selectedPrice?.toUpdated(), shortDescriptionTranslated = shortDescriptionTranslated, diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/cart/request/OrderForCalculate.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/cart/request/OrderForCalculate.kt index d50cab05..26f1206a 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/dto/cart/request/OrderForCalculate.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/cart/request/OrderForCalculate.kt @@ -91,6 +91,7 @@ data class OrderForCalculate( val fixedShippingRateOnly: Boolean? = null, val digital: Boolean? = null, val couponApplied: Boolean? = null, + var isGiftCard: Boolean? = null, val selectedOptions: List? = null, val combinationId: Int? = null, diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/cart/result/CalculateOrderDetailsResult.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/cart/result/CalculateOrderDetailsResult.kt index 35370183..42200adb 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/dto/cart/result/CalculateOrderDetailsResult.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/cart/result/CalculateOrderDetailsResult.kt @@ -148,6 +148,7 @@ data class CalculateOrderDetailsResult( val fixedShippingRateOnly: Boolean? = null, val digital: Boolean? = null, val couponApplied: Boolean? = null, + var isGiftCard: Boolean? = null, val selectedOptions: List? = null, val combinationId: Int? = null, diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/cart/result/FetchedCart.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/cart/result/FetchedCart.kt index b59baaa9..dc3167d7 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/dto/cart/result/FetchedCart.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/cart/result/FetchedCart.kt @@ -141,6 +141,7 @@ data class FetchedCart( val fixedShippingRateOnly: Boolean? = null, val digital: Boolean? = null, val couponApplied: Boolean? = null, + var isGiftCard: Boolean? = null, val selectedOptions: List? = null, val combinationId: Int? = null, 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 9741f02a..ce9fd342 100644 --- a/src/test/kotlin/com/ecwid/apiclient/v3/entity/CartsTest.kt +++ b/src/test/kotlin/com/ecwid/apiclient/v3/entity/CartsTest.kt @@ -98,6 +98,7 @@ class CartsTest : BaseEntityTest() { assertEquals(orderItem.fixedShippingRateOnly, cartItem.fixedShippingRateOnly) assertEquals(orderItem.digital, cartItem.digital) assertEquals(orderItem.couponApplied, cartItem.couponApplied) + assertEquals(orderItem.isGiftCard, cartItem.isGiftCard) assertEquals(orderItem.dimensions?.length, cartItem.dimensions?.length) assertEquals(orderItem.dimensions?.width, cartItem.dimensions?.width) @@ -485,6 +486,7 @@ class CartsTest : BaseEntityTest() { fixedShippingRateOnly = true, digital = true, couponApplied = true, + isGiftCard = false, selectedOptions = listOf( generateChoiceSelectedOption(), generateChoicesSelectedOption(), diff --git a/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedCartRules.kt b/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedCartRules.kt index a841f928..ff40d543 100644 --- a/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedCartRules.kt +++ b/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedCartRules.kt @@ -81,6 +81,7 @@ val fetchedCartNullablePropertyRules: List> = listOf( IgnoreNullable(FetchedCart.OrderItem::categoryId), IgnoreNullable(FetchedCart.OrderItem::couponAmount), IgnoreNullable(FetchedCart.OrderItem::couponApplied), + IgnoreNullable(FetchedCart.OrderItem::isGiftCard), IgnoreNullable(FetchedCart.OrderItem::digital), IgnoreNullable(FetchedCart.OrderItem::dimensions), IgnoreNullable(FetchedCart.OrderItem::discounts), diff --git a/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/OrderForCalculateRules.kt b/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/OrderForCalculateRules.kt index bfbcd263..770e2f78 100644 --- a/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/OrderForCalculateRules.kt +++ b/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/OrderForCalculateRules.kt @@ -59,6 +59,7 @@ val orderForCalculateNullablePropertyRules: List> = l IgnoreNullable(OrderForCalculate.OrderItem::categoryId), IgnoreNullable(OrderForCalculate.OrderItem::couponAmount), IgnoreNullable(OrderForCalculate.OrderItem::couponApplied), + IgnoreNullable(OrderForCalculate.OrderItem::isGiftCard), IgnoreNullable(OrderForCalculate.OrderItem::digital), IgnoreNullable(OrderForCalculate.OrderItem::dimensions), IgnoreNullable(OrderForCalculate.OrderItem::discounts), 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 43cfd0a1..6a1b61d6 100644 --- a/src/test/kotlin/com/ecwid/apiclient/v3/util/OrderUtils.kt +++ b/src/test/kotlin/com/ecwid/apiclient/v3/util/OrderUtils.kt @@ -208,6 +208,7 @@ private fun generateTestOrderItem() = UpdatedOrder.OrderItem( fixedShippingRateOnly = randomBoolean(), digital = randomBoolean(), couponApplied = randomBoolean(), + isGiftCard = randomBoolean(), isCustomerSetPrice = randomBoolean(), taxable = randomBoolean(), From a243dd580e786c0df0afda0703e8d449694f2bfd Mon Sep 17 00:00:00 2001 From: zont Date: Thu, 2 Nov 2023 16:00:09 +0400 Subject: [PATCH 2/7] ECWID-126274 OE2: The discount Based on Customer Groups is deducted from the gift card: changed var to val, fixed test --- .../ecwid/apiclient/v3/dto/cart/request/OrderForCalculate.kt | 2 +- .../apiclient/v3/dto/cart/result/CalculateOrderDetailsResult.kt | 2 +- .../com/ecwid/apiclient/v3/dto/cart/result/FetchedCart.kt | 2 +- src/test/kotlin/com/ecwid/apiclient/v3/entity/CartsTest.kt | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/cart/request/OrderForCalculate.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/cart/request/OrderForCalculate.kt index 26f1206a..81f121b2 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/dto/cart/request/OrderForCalculate.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/cart/request/OrderForCalculate.kt @@ -91,7 +91,7 @@ data class OrderForCalculate( val fixedShippingRateOnly: Boolean? = null, val digital: Boolean? = null, val couponApplied: Boolean? = null, - var isGiftCard: Boolean? = null, + val isGiftCard: Boolean? = null, val selectedOptions: List? = null, val combinationId: Int? = null, diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/cart/result/CalculateOrderDetailsResult.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/cart/result/CalculateOrderDetailsResult.kt index 42200adb..6f26f799 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/dto/cart/result/CalculateOrderDetailsResult.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/cart/result/CalculateOrderDetailsResult.kt @@ -148,7 +148,7 @@ data class CalculateOrderDetailsResult( val fixedShippingRateOnly: Boolean? = null, val digital: Boolean? = null, val couponApplied: Boolean? = null, - var isGiftCard: Boolean? = null, + val isGiftCard: Boolean? = null, val selectedOptions: List? = null, val combinationId: Int? = null, diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/cart/result/FetchedCart.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/cart/result/FetchedCart.kt index dc3167d7..c9c0ef5b 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/dto/cart/result/FetchedCart.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/cart/result/FetchedCart.kt @@ -141,7 +141,7 @@ data class FetchedCart( val fixedShippingRateOnly: Boolean? = null, val digital: Boolean? = null, val couponApplied: Boolean? = null, - var isGiftCard: Boolean? = null, + val isGiftCard: Boolean? = null, val selectedOptions: List? = null, val combinationId: Int? = null, 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 ce9fd342..e2354f88 100644 --- a/src/test/kotlin/com/ecwid/apiclient/v3/entity/CartsTest.kt +++ b/src/test/kotlin/com/ecwid/apiclient/v3/entity/CartsTest.kt @@ -306,6 +306,7 @@ class CartsTest : BaseEntityTest() { assertEquals(forCalculateItem.fixedShippingRateOnly, calculatedItem.fixedShippingRateOnly) assertEquals(forCalculateItem.digital, calculatedItem.digital) assertEquals(false, calculatedItem.couponApplied) + assertEquals(false, calculatedItem.isGiftCard) assertEquals(forCalculateItem.selectedOptions?.count(), calculatedItem.selectedOptions?.count()) calculatedItem.selectedOptions?.forEachIndexed { selectedOptionIndex, calculatedOrderItemOptions -> From 8a6f0cc5522940a71d426f51853f956bed063e01 Mon Sep 17 00:00:00 2001 From: zont Date: Thu, 2 Nov 2023 16:32:31 +0400 Subject: [PATCH 3/7] ECWID-126274 OE2: The discount Based on Customer Groups is deducted from the gift card: changed ignoreNullable to AllowNullable --- .../apiclient/v3/rule/nullablepropertyrules/FetchedCartRules.kt | 2 +- .../v3/rule/nullablepropertyrules/OrderForCalculateRules.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedCartRules.kt b/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedCartRules.kt index ff40d543..1a5b3312 100644 --- a/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedCartRules.kt +++ b/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedCartRules.kt @@ -81,7 +81,7 @@ val fetchedCartNullablePropertyRules: List> = listOf( IgnoreNullable(FetchedCart.OrderItem::categoryId), IgnoreNullable(FetchedCart.OrderItem::couponAmount), IgnoreNullable(FetchedCart.OrderItem::couponApplied), - IgnoreNullable(FetchedCart.OrderItem::isGiftCard), + AllowNullable(FetchedCart.OrderItem::isGiftCard), IgnoreNullable(FetchedCart.OrderItem::digital), IgnoreNullable(FetchedCart.OrderItem::dimensions), IgnoreNullable(FetchedCart.OrderItem::discounts), diff --git a/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/OrderForCalculateRules.kt b/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/OrderForCalculateRules.kt index 770e2f78..0bf37369 100644 --- a/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/OrderForCalculateRules.kt +++ b/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/OrderForCalculateRules.kt @@ -59,7 +59,7 @@ val orderForCalculateNullablePropertyRules: List> = l IgnoreNullable(OrderForCalculate.OrderItem::categoryId), IgnoreNullable(OrderForCalculate.OrderItem::couponAmount), IgnoreNullable(OrderForCalculate.OrderItem::couponApplied), - IgnoreNullable(OrderForCalculate.OrderItem::isGiftCard), + AllowNullable(OrderForCalculate.OrderItem::isGiftCard), IgnoreNullable(OrderForCalculate.OrderItem::digital), IgnoreNullable(OrderForCalculate.OrderItem::dimensions), IgnoreNullable(OrderForCalculate.OrderItem::discounts), From 4c71baab58ea020700c6c2db40ad5804b1e79363 Mon Sep 17 00:00:00 2001 From: zont Date: Thu, 2 Nov 2023 16:52:05 +0400 Subject: [PATCH 4/7] ECWID-126274 OE2: The discount Based on Customer Groups is deducted from the gift card: added AllowNullable in rules --- .../nullablepropertyrules/CalculateOrderDetailsResultRules.kt | 1 + .../apiclient/v3/rule/nullablepropertyrules/FetchedOrderRules.kt | 1 + 2 files changed, 2 insertions(+) diff --git a/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/CalculateOrderDetailsResultRules.kt b/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/CalculateOrderDetailsResultRules.kt index 41e596a8..8b4f8b77 100644 --- a/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/CalculateOrderDetailsResultRules.kt +++ b/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/CalculateOrderDetailsResultRules.kt @@ -37,6 +37,7 @@ val calculateOrderDetailsResultNullablePropertyRules: List> = listOf IgnoreNullable(FetchedOrder.OrderItem::categoryId), IgnoreNullable(FetchedOrder.OrderItem::couponAmount), IgnoreNullable(FetchedOrder.OrderItem::couponApplied), + AllowNullable(FetchedOrder.OrderItem::isGiftCard), IgnoreNullable(FetchedOrder.OrderItem::digital), IgnoreNullable(FetchedOrder.OrderItem::dimensions), IgnoreNullable(FetchedOrder.OrderItem::discounts), From feb73434e83f548bad8cb006ba8a8899c4ba8e87 Mon Sep 17 00:00:00 2001 From: zont Date: Thu, 2 Nov 2023 18:24:10 +0400 Subject: [PATCH 5/7] ECWID-126274 OE2: The discount Based on Customer Groups is deducted from the gift card: changed another one ignoreNullable to allowNullable --- .../nullablepropertyrules/CalculateOrderDetailsResultRules.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/CalculateOrderDetailsResultRules.kt b/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/CalculateOrderDetailsResultRules.kt index 8b4f8b77..7e42e800 100644 --- a/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/CalculateOrderDetailsResultRules.kt +++ b/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/CalculateOrderDetailsResultRules.kt @@ -37,7 +37,7 @@ val calculateOrderDetailsResultNullablePropertyRules: List Date: Wed, 8 Nov 2023 16:55:22 +0400 Subject: [PATCH 6/7] ECWID-126274 OE2: The discount Based on Customer Groups is deducted from the gift card: changed name isGiftCard to giftCard to correct rest4j mapping --- .../kotlin/com/ecwid/apiclient/v3/converter/FetchedOrder.kt | 2 +- .../apiclient/v3/dto/cart/request/OrderForCalculate.kt | 2 +- .../v3/dto/cart/result/CalculateOrderDetailsResult.kt | 2 +- .../com/ecwid/apiclient/v3/dto/cart/result/FetchedCart.kt | 2 +- .../ecwid/apiclient/v3/dto/order/request/UpdatedOrder.kt | 2 +- .../com/ecwid/apiclient/v3/dto/order/result/FetchedOrder.kt | 2 +- src/test/kotlin/com/ecwid/apiclient/v3/entity/CartsTest.kt | 6 +++--- .../CalculateOrderDetailsResultRules.kt | 2 +- .../v3/rule/nullablepropertyrules/FetchedCartRules.kt | 2 +- .../v3/rule/nullablepropertyrules/FetchedOrderRules.kt | 3 +-- .../v3/rule/nullablepropertyrules/OrderForCalculateRules.kt | 2 +- src/test/kotlin/com/ecwid/apiclient/v3/util/OrderUtils.kt | 2 +- 12 files changed, 14 insertions(+), 15 deletions(-) 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 7f8219b6..91294d23 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedOrder.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedOrder.kt @@ -145,7 +145,7 @@ fun FetchedOrder.OrderItem.toUpdated(): UpdatedOrder.OrderItem { fixedShippingRateOnly = fixedShippingRateOnly, digital = digital, couponApplied = couponApplied, - isGiftCard = isGiftCard, + giftCard = giftCard, discountsAllowed = discountsAllowed, isCustomerSetPrice = isCustomerSetPrice, diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/cart/request/OrderForCalculate.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/cart/request/OrderForCalculate.kt index 81f121b2..f0654e74 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/dto/cart/request/OrderForCalculate.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/cart/request/OrderForCalculate.kt @@ -91,7 +91,7 @@ data class OrderForCalculate( val fixedShippingRateOnly: Boolean? = null, val digital: Boolean? = null, val couponApplied: Boolean? = null, - val isGiftCard: Boolean? = null, + val giftCard: Boolean? = null, val selectedOptions: List? = null, val combinationId: Int? = null, diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/cart/result/CalculateOrderDetailsResult.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/cart/result/CalculateOrderDetailsResult.kt index 6f26f799..b81f30ea 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/dto/cart/result/CalculateOrderDetailsResult.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/cart/result/CalculateOrderDetailsResult.kt @@ -148,7 +148,7 @@ data class CalculateOrderDetailsResult( val fixedShippingRateOnly: Boolean? = null, val digital: Boolean? = null, val couponApplied: Boolean? = null, - val isGiftCard: Boolean? = null, + val giftCard: Boolean? = null, val selectedOptions: List? = null, val combinationId: Int? = null, diff --git a/src/main/kotlin/com/ecwid/apiclient/v3/dto/cart/result/FetchedCart.kt b/src/main/kotlin/com/ecwid/apiclient/v3/dto/cart/result/FetchedCart.kt index c9c0ef5b..f7042764 100644 --- a/src/main/kotlin/com/ecwid/apiclient/v3/dto/cart/result/FetchedCart.kt +++ b/src/main/kotlin/com/ecwid/apiclient/v3/dto/cart/result/FetchedCart.kt @@ -141,7 +141,7 @@ data class FetchedCart( val fixedShippingRateOnly: Boolean? = null, val digital: Boolean? = null, val couponApplied: Boolean? = null, - val isGiftCard: Boolean? = null, + val giftCard: Boolean? = null, val selectedOptions: List? = null, val combinationId: Int? = null, 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 61826eff..f3595448 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 @@ -153,7 +153,7 @@ data class UpdatedOrder( val fixedShippingRateOnly: Boolean? = null, val digital: Boolean? = null, val couponApplied: Boolean? = null, - val isGiftCard: Boolean? = null, + val giftCard: Boolean? = null, val selectedOptions: List? = null, val combinationId: Int? = null, 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 deeb1efb..8cdd74a9 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 @@ -185,7 +185,7 @@ data class FetchedOrder( val digital: Boolean? = null, val productAvailable: Boolean? = null, // TODO Probably this field is always true val couponApplied: Boolean? = null, - val isGiftCard: Boolean? = null, + val giftCard: Boolean? = null, val recurringChargeSettings: RecurringChargeSettings? = null, val subscriptionId: Long? = null, 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 e2354f88..0f12ebcd 100644 --- a/src/test/kotlin/com/ecwid/apiclient/v3/entity/CartsTest.kt +++ b/src/test/kotlin/com/ecwid/apiclient/v3/entity/CartsTest.kt @@ -98,7 +98,7 @@ class CartsTest : BaseEntityTest() { assertEquals(orderItem.fixedShippingRateOnly, cartItem.fixedShippingRateOnly) assertEquals(orderItem.digital, cartItem.digital) assertEquals(orderItem.couponApplied, cartItem.couponApplied) - assertEquals(orderItem.isGiftCard, cartItem.isGiftCard) + assertEquals(orderItem.giftCard, cartItem.giftCard) assertEquals(orderItem.dimensions?.length, cartItem.dimensions?.length) assertEquals(orderItem.dimensions?.width, cartItem.dimensions?.width) @@ -306,7 +306,7 @@ class CartsTest : BaseEntityTest() { assertEquals(forCalculateItem.fixedShippingRateOnly, calculatedItem.fixedShippingRateOnly) assertEquals(forCalculateItem.digital, calculatedItem.digital) assertEquals(false, calculatedItem.couponApplied) - assertEquals(false, calculatedItem.isGiftCard) + assertEquals(false, calculatedItem.giftCard) assertEquals(forCalculateItem.selectedOptions?.count(), calculatedItem.selectedOptions?.count()) calculatedItem.selectedOptions?.forEachIndexed { selectedOptionIndex, calculatedOrderItemOptions -> @@ -487,7 +487,7 @@ class CartsTest : BaseEntityTest() { fixedShippingRateOnly = true, digital = true, couponApplied = true, - isGiftCard = false, + giftCard = false, selectedOptions = listOf( generateChoiceSelectedOption(), generateChoicesSelectedOption(), diff --git a/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/CalculateOrderDetailsResultRules.kt b/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/CalculateOrderDetailsResultRules.kt index 7e42e800..915f31a6 100644 --- a/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/CalculateOrderDetailsResultRules.kt +++ b/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/CalculateOrderDetailsResultRules.kt @@ -37,7 +37,7 @@ val calculateOrderDetailsResultNullablePropertyRules: List> = listOf( IgnoreNullable(FetchedCart.OrderItem::categoryId), IgnoreNullable(FetchedCart.OrderItem::couponAmount), IgnoreNullable(FetchedCart.OrderItem::couponApplied), - AllowNullable(FetchedCart.OrderItem::isGiftCard), + AllowNullable(FetchedCart.OrderItem::giftCard), IgnoreNullable(FetchedCart.OrderItem::digital), IgnoreNullable(FetchedCart.OrderItem::dimensions), IgnoreNullable(FetchedCart.OrderItem::discounts), 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 e3ea6802..cb2814e0 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 @@ -55,7 +55,6 @@ val fetchedOrderNullablePropertyRules: List> = listOf IgnoreNullable(FetchedOrder.OrderItem::categoryId), IgnoreNullable(FetchedOrder.OrderItem::couponAmount), IgnoreNullable(FetchedOrder.OrderItem::couponApplied), - AllowNullable(FetchedOrder.OrderItem::isGiftCard), IgnoreNullable(FetchedOrder.OrderItem::digital), IgnoreNullable(FetchedOrder.OrderItem::dimensions), IgnoreNullable(FetchedOrder.OrderItem::discounts), @@ -67,7 +66,7 @@ val fetchedOrderNullablePropertyRules: List> = listOf IgnoreNullable(FetchedOrder.OrderItem::id), IgnoreNullable(FetchedOrder.OrderItem::imageUrl), AllowNullable(FetchedOrder.OrderItem::isCustomerSetPrice), - AllowNullable(FetchedOrder.OrderItem::isGiftCard), + AllowNullable(FetchedOrder.OrderItem::giftCard), IgnoreNullable(FetchedOrder.OrderItem::isShippingRequired), IgnoreNullable(FetchedOrder.OrderItem::name), AllowNullable(FetchedOrder.OrderItem::nameTranslated), diff --git a/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/OrderForCalculateRules.kt b/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/OrderForCalculateRules.kt index 0bf37369..a425bb3d 100644 --- a/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/OrderForCalculateRules.kt +++ b/src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/OrderForCalculateRules.kt @@ -59,7 +59,7 @@ val orderForCalculateNullablePropertyRules: List> = l IgnoreNullable(OrderForCalculate.OrderItem::categoryId), IgnoreNullable(OrderForCalculate.OrderItem::couponAmount), IgnoreNullable(OrderForCalculate.OrderItem::couponApplied), - AllowNullable(OrderForCalculate.OrderItem::isGiftCard), + AllowNullable(OrderForCalculate.OrderItem::giftCard), IgnoreNullable(OrderForCalculate.OrderItem::digital), IgnoreNullable(OrderForCalculate.OrderItem::dimensions), IgnoreNullable(OrderForCalculate.OrderItem::discounts), 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 6a1b61d6..787b2a39 100644 --- a/src/test/kotlin/com/ecwid/apiclient/v3/util/OrderUtils.kt +++ b/src/test/kotlin/com/ecwid/apiclient/v3/util/OrderUtils.kt @@ -208,7 +208,7 @@ private fun generateTestOrderItem() = UpdatedOrder.OrderItem( fixedShippingRateOnly = randomBoolean(), digital = randomBoolean(), couponApplied = randomBoolean(), - isGiftCard = randomBoolean(), + giftCard = randomBoolean(), isCustomerSetPrice = randomBoolean(), taxable = randomBoolean(), From 99b6ee8cdfe03514481ab6ffd794f55f414fe995 Mon Sep 17 00:00:00 2001 From: zont Date: Wed, 8 Nov 2023 19:04:06 +0400 Subject: [PATCH 7/7] ECWID-126274 OE2: The discount Based on Customer Groups is deducted from the gift card: changed generated value for giftCard in tests from randomBoolean to false - for true need new test --- src/test/kotlin/com/ecwid/apiclient/v3/util/OrderUtils.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 787b2a39..491dbbdb 100644 --- a/src/test/kotlin/com/ecwid/apiclient/v3/util/OrderUtils.kt +++ b/src/test/kotlin/com/ecwid/apiclient/v3/util/OrderUtils.kt @@ -208,7 +208,7 @@ private fun generateTestOrderItem() = UpdatedOrder.OrderItem( fixedShippingRateOnly = randomBoolean(), digital = randomBoolean(), couponApplied = randomBoolean(), - giftCard = randomBoolean(), + giftCard = false, isCustomerSetPrice = randomBoolean(), taxable = randomBoolean(),