Skip to content

Commit

Permalink
ECWID-134977 OE2: if an advanced discount is used for a product and m…
Browse files Browse the repository at this point in the history
…ore items are added to an order, the total is calculated incorrectly: added fields into DiscountInfo
  • Loading branch information
zont163 committed Apr 1, 2024
1 parent 03e102a commit e2fc235
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ fun FetchedOrder.DiscountInfo.toUpdated(): UpdatedOrder.DiscountInfo {
type = type,
base = base,
orderTotal = orderTotal,
description = description
description = description,
appliesToProducts = appliesToProducts,
appliesToItems = appliesToItems,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ data class UpdatedOrder(
val type: DiscountType? = null,
val base: DiscountBase? = null,
val orderTotal: Double? = null,
val description: String? = null
val description: String? = null,
val appliesToProducts: Set<Int?>? = null,
val appliesToItems: Set<Long>? = null,
)

data class DiscountCouponInfo(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package com.ecwid.apiclient.v3.dto.order.result

import com.ecwid.apiclient.v3.dto.common.*
import com.ecwid.apiclient.v3.dto.common.ApiFetchedDTO
import com.ecwid.apiclient.v3.dto.common.ApiFetchedDTO.ModifyKind
import com.ecwid.apiclient.v3.dto.common.ExtendedOrderTax
import com.ecwid.apiclient.v3.dto.common.OrderedStringToListStringMap
import com.ecwid.apiclient.v3.dto.common.OrderedStringToStringMap
import com.ecwid.apiclient.v3.dto.order.enums.*
import com.ecwid.apiclient.v3.dto.order.request.UpdatedOrder
import java.util.*
Expand Down Expand Up @@ -125,7 +128,9 @@ data class FetchedOrder(
val type: DiscountType? = null,
val base: DiscountBase? = null,
val orderTotal: Double? = null,
val description: String? = null
val description: String? = null,
val appliesToProducts: Set<Int?>? = null,
val appliesToItems: Set<Long>? = null,
)

data class DiscountCouponInfo(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ val fetchedOrderNullablePropertyRules: List<NullablePropertyRule<*, *>> = listOf
IgnoreNullable(FetchedOrder.DiscountInfo::orderTotal),
IgnoreNullable(FetchedOrder.DiscountInfo::type),
IgnoreNullable(FetchedOrder.DiscountInfo::value),
AllowNullable(FetchedOrder.DiscountInfo::appliesToProducts),
AllowNullable(FetchedOrder.DiscountInfo::appliesToItems),
AllowNullable(FetchedOrder.ExtraFieldsInfo::customerInputType),
AllowNullable(FetchedOrder.ExtraFieldsInfo::id),
AllowNullable(FetchedOrder.ExtraFieldsInfo::orderBy),
Expand Down

0 comments on commit e2fc235

Please sign in to comment.