diff --git a/src/test/kotlin/com/ecwid/apiclient/v3/util/OrderUtils.kt b/src/test/kotlin/com/ecwid/apiclient/v3/util/OrderUtils.kt index a359db5db..deb07ac5c 100644 --- a/src/test/kotlin/com/ecwid/apiclient/v3/util/OrderUtils.kt +++ b/src/test/kotlin/com/ecwid/apiclient/v3/util/OrderUtils.kt @@ -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 @@ -190,6 +193,30 @@ private fun generateTestCustomDiscountInfo() = UpdatedOrder.DiscountInfo( description = "Custom discount " + randomAlphanumeric(8) ) +private fun generateTestItemDiscountInfo() = UpdatedOrder.DiscountInfo( + value = randomPrice(), + type = randomEnumValue(), + base = DiscountBase.ITEM, + orderTotal = randomPrice(), + description = "On item discount " + randomAlphanumeric(8) +) + +private fun generateTestShippingDiscountInfo() = UpdatedOrder.DiscountInfo( + value = randomPrice(), + type = randomEnumValue(), + base = DiscountBase.SHIPPING, + orderTotal = randomPrice(), + description = "On shipping discount " + randomAlphanumeric(8) +) + +private fun generateTestSubtotalDiscountInfo() = UpdatedOrder.DiscountInfo( + value = randomPrice(), + type = randomEnumValue(), + 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