Skip to content

Commit e2fc235

Browse files
committed
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 into DiscountInfo
1 parent 03e102a commit e2fc235

4 files changed

Lines changed: 15 additions & 4 deletions

File tree

src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedOrder.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,9 @@ fun FetchedOrder.DiscountInfo.toUpdated(): UpdatedOrder.DiscountInfo {
106106
type = type,
107107
base = base,
108108
orderTotal = orderTotal,
109-
description = description
109+
description = description,
110+
appliesToProducts = appliesToProducts,
111+
appliesToItems = appliesToItems,
110112
)
111113
}
112114

src/main/kotlin/com/ecwid/apiclient/v3/dto/order/request/UpdatedOrder.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ data class UpdatedOrder(
107107
val type: DiscountType? = null,
108108
val base: DiscountBase? = null,
109109
val orderTotal: Double? = null,
110-
val description: String? = null
110+
val description: String? = null,
111+
val appliesToProducts: Set<Int?>? = null,
112+
val appliesToItems: Set<Long>? = null,
111113
)
112114

113115
data class DiscountCouponInfo(

src/main/kotlin/com/ecwid/apiclient/v3/dto/order/result/FetchedOrder.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
package com.ecwid.apiclient.v3.dto.order.result
22

3-
import com.ecwid.apiclient.v3.dto.common.*
3+
import com.ecwid.apiclient.v3.dto.common.ApiFetchedDTO
44
import com.ecwid.apiclient.v3.dto.common.ApiFetchedDTO.ModifyKind
5+
import com.ecwid.apiclient.v3.dto.common.ExtendedOrderTax
6+
import com.ecwid.apiclient.v3.dto.common.OrderedStringToListStringMap
7+
import com.ecwid.apiclient.v3.dto.common.OrderedStringToStringMap
58
import com.ecwid.apiclient.v3.dto.order.enums.*
69
import com.ecwid.apiclient.v3.dto.order.request.UpdatedOrder
710
import java.util.*
@@ -125,7 +128,9 @@ data class FetchedOrder(
125128
val type: DiscountType? = null,
126129
val base: DiscountBase? = null,
127130
val orderTotal: Double? = null,
128-
val description: String? = null
131+
val description: String? = null,
132+
val appliesToProducts: Set<Int?>? = null,
133+
val appliesToItems: Set<Long>? = null,
129134
)
130135

131136
data class DiscountCouponInfo(

src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedOrderRules.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ val fetchedOrderNullablePropertyRules: List<NullablePropertyRule<*, *>> = listOf
4343
IgnoreNullable(FetchedOrder.DiscountInfo::orderTotal),
4444
IgnoreNullable(FetchedOrder.DiscountInfo::type),
4545
IgnoreNullable(FetchedOrder.DiscountInfo::value),
46+
AllowNullable(FetchedOrder.DiscountInfo::appliesToProducts),
47+
AllowNullable(FetchedOrder.DiscountInfo::appliesToItems),
4648
AllowNullable(FetchedOrder.ExtraFieldsInfo::customerInputType),
4749
AllowNullable(FetchedOrder.ExtraFieldsInfo::id),
4850
AllowNullable(FetchedOrder.ExtraFieldsInfo::orderBy),

0 commit comments

Comments
 (0)