Skip to content

Commit 0123582

Browse files
authored
Merge pull request #458 from Ecwid/ECWID-156302
ECWID-156302 - add absent enums to DiscountBase
2 parents 57f4150 + fa40118 commit 0123582

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

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

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,10 @@ fun generateTestOrder(): UpdatedOrder {
7373
generateTestOnTotalDiscountInfo(),
7474
generateTestOnMembershipDiscountInfo(),
7575
generateTestOnTotalAndMembershipDiscountInfo(),
76-
generateTestCustomDiscountInfo()
76+
generateTestCustomDiscountInfo(),
77+
generateTestItemDiscountInfo(),
78+
generateTestShippingDiscountInfo(),
79+
generateTestSubtotalDiscountInfo()
7780
),
7881

7982
// TODO Pass real discount coupon code when API client will support this
@@ -190,6 +193,30 @@ private fun generateTestCustomDiscountInfo() = UpdatedOrder.DiscountInfo(
190193
description = "Custom discount " + randomAlphanumeric(8)
191194
)
192195

196+
private fun generateTestItemDiscountInfo() = UpdatedOrder.DiscountInfo(
197+
value = randomPrice(),
198+
type = randomEnumValue<DiscountType>(),
199+
base = DiscountBase.ITEM,
200+
orderTotal = randomPrice(),
201+
description = "On item discount " + randomAlphanumeric(8)
202+
)
203+
204+
private fun generateTestShippingDiscountInfo() = UpdatedOrder.DiscountInfo(
205+
value = randomPrice(),
206+
type = randomEnumValue<DiscountType>(),
207+
base = DiscountBase.SHIPPING,
208+
orderTotal = randomPrice(),
209+
description = "On shipping discount " + randomAlphanumeric(8)
210+
)
211+
212+
private fun generateTestSubtotalDiscountInfo() = UpdatedOrder.DiscountInfo(
213+
value = randomPrice(),
214+
type = randomEnumValue<DiscountType>(),
215+
base = DiscountBase.SUBTOTAL,
216+
orderTotal = randomPrice(),
217+
description = "On subtotal discount " + randomAlphanumeric(8)
218+
)
219+
193220
private fun generateTestOrderItem() = UpdatedOrder.OrderItem(
194221
// var id: Int? = null, // TODO readonly
195222
// productId = com.ecwid.api.v3.randomId(), // TODO need to pass existing product id

0 commit comments

Comments
 (0)