From 3f128b54e9a7bb73c10e305c69d5d139f46e130d Mon Sep 17 00:00:00 2001 From: zont Date: Tue, 2 Apr 2024 21:21:55 +0400 Subject: [PATCH] ECWID-134977 OE2: if an advanced discount is used for a product and more items are added to an order, the total is calculated incorrectly: added fields to calculated order --- .../ecwid/apiclient/v3/dto/cart/request/OrderForCalculate.kt | 4 +++- .../v3/dto/cart/result/CalculateOrderDetailsResult.kt | 4 +++- .../nullablepropertyrules/CalculateOrderDetailsResultRules.kt | 2 ++ .../v3/rule/nullablepropertyrules/OrderForCalculateRules.kt | 2 ++ 4 files changed, 10 insertions(+), 2 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 589c669f..a5b27a50 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 @@ -36,7 +36,9 @@ data class OrderForCalculate( val type: DiscountType? = null, val base: DiscountBase? = null, val orderTotal: Double? = null, - val description: String? = null + val description: String? = null, + val appliesToProducts: List? = null, + val appliesToItems: List? = null, ) data class OrderItemDiscountInfo( 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 6fd2f141..efc3823a 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 @@ -95,7 +95,9 @@ data class CalculateOrderDetailsResult( val type: DiscountType? = null, val base: DiscountBase? = null, val orderTotal: Double? = null, - val description: String? = null + val description: String? = null, + val appliesToProducts: List? = null, + val appliesToItems: List? = null, ) data class OrderItemDiscountInfo( 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 ff133251..e2e1b409 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 @@ -26,6 +26,8 @@ val calculateOrderDetailsResultNullablePropertyRules: List> = l IgnoreNullable(OrderForCalculate.DiscountInfo::orderTotal), IgnoreNullable(OrderForCalculate.DiscountInfo::type), IgnoreNullable(OrderForCalculate.DiscountInfo::value), + AllowNullable(OrderForCalculate.DiscountInfo::appliesToProducts), + AllowNullable(OrderForCalculate.DiscountInfo::appliesToItems), AllowNullable(OrderForCalculate.HandlingFee::description), AllowNullable(OrderForCalculate.HandlingFee::name), AllowNullable(OrderForCalculate.HandlingFee::taxes),