Skip to content

Commit

Permalink
Merge pull request #458 from Ecwid/ECWID-156302
Browse files Browse the repository at this point in the history
ECWID-156302 - add absent enums to DiscountBase
  • Loading branch information
mvgreen authored Jan 27, 2025
2 parents 57f4150 + fa40118 commit 0123582
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion src/test/kotlin/com/ecwid/apiclient/v3/util/OrderUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ fun generateTestOrder(): UpdatedOrder {
generateTestOnTotalDiscountInfo(),
generateTestOnMembershipDiscountInfo(),
generateTestOnTotalAndMembershipDiscountInfo(),
generateTestCustomDiscountInfo()
generateTestCustomDiscountInfo(),
generateTestItemDiscountInfo(),
generateTestShippingDiscountInfo(),
generateTestSubtotalDiscountInfo()
),

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

private fun generateTestItemDiscountInfo() = UpdatedOrder.DiscountInfo(
value = randomPrice(),
type = randomEnumValue<DiscountType>(),
base = DiscountBase.ITEM,
orderTotal = randomPrice(),
description = "On item discount " + randomAlphanumeric(8)
)

private fun generateTestShippingDiscountInfo() = UpdatedOrder.DiscountInfo(
value = randomPrice(),
type = randomEnumValue<DiscountType>(),
base = DiscountBase.SHIPPING,
orderTotal = randomPrice(),
description = "On shipping discount " + randomAlphanumeric(8)
)

private fun generateTestSubtotalDiscountInfo() = UpdatedOrder.DiscountInfo(
value = randomPrice(),
type = randomEnumValue<DiscountType>(),
base = DiscountBase.SUBTOTAL,
orderTotal = randomPrice(),
description = "On subtotal discount " + randomAlphanumeric(8)
)

private fun generateTestOrderItem() = UpdatedOrder.OrderItem(
// var id: Int? = null, // TODO readonly
// productId = com.ecwid.api.v3.randomId(), // TODO need to pass existing product id
Expand Down

0 comments on commit 0123582

Please sign in to comment.