Skip to content

Commit 3b47b58

Browse files
ECWID-169205 Add PRICE_BOOK discount base
1 parent 37d3a0f commit 3b47b58

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

src/main/kotlin/com/ecwid/apiclient/v3/dto/order/enums/DiscountBase.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ enum class DiscountBase {
77
SHIPPING,
88
ITEM,
99
SUBTOTAL,
10-
CUSTOM
10+
CUSTOM,
11+
PRICE_BOOK
1112
}

src/test/kotlin/com/ecwid/apiclient/v3/util/OrderUtils.kt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ fun generateTestOrder(): UpdatedOrder {
7676
generateTestCustomDiscountInfo(),
7777
generateTestItemDiscountInfo(),
7878
generateTestShippingDiscountInfo(),
79-
generateTestSubtotalDiscountInfo()
79+
generateTestSubtotalDiscountInfo(),
80+
generateTestPriceBookDiscountInfo()
8081
),
8182

8283
// TODO Pass real discount coupon code when API client will support this
@@ -217,6 +218,14 @@ private fun generateTestSubtotalDiscountInfo() = UpdatedOrder.DiscountInfo(
217218
description = "On subtotal discount " + randomAlphanumeric(8)
218219
)
219220

221+
private fun generateTestPriceBookDiscountInfo() = UpdatedOrder.DiscountInfo(
222+
value = randomPrice(),
223+
type = randomEnumValue<DiscountType>(),
224+
base = DiscountBase.PRICE_BOOK,
225+
orderTotal = randomPrice(),
226+
description = "Price book discount " + randomAlphanumeric(8)
227+
)
228+
220229
private fun generateTestOrderItem() = UpdatedOrder.OrderItem(
221230
// var id: Int? = null, // TODO readonly
222231
// productId = com.ecwid.api.v3.randomId(), // TODO need to pass existing product id

0 commit comments

Comments
 (0)