Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,9 @@ data class CustomAppRequest(
)

enum class DiscountType {
ABS, PERCENT
ABS,
PERCENT,
FIXED_PRICE,
}

enum class DiscountBase {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ package com.ecwid.apiclient.v3.dto.order.enums

enum class DiscountType {
ABS,
PERCENT
PERCENT,
FIXED_PRICE,
}
14 changes: 7 additions & 7 deletions src/test/kotlin/com/ecwid/apiclient/v3/util/OrderUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -164,54 +164,54 @@ fun generateTestOrder(): UpdatedOrder {

private fun generateTestOnTotalDiscountInfo() = UpdatedOrder.DiscountInfo(
value = randomPrice(),
type = randomEnumValue<DiscountType>(),
type = randomEnumValue<DiscountType>(exclude = arrayOf(DiscountType.FIXED_PRICE)),
base = DiscountBase.ON_TOTAL,
orderTotal = randomPrice(),
description = "On total discount " + randomAlphanumeric(8)
)

private fun generateTestOnMembershipDiscountInfo() = UpdatedOrder.DiscountInfo(
value = randomPrice(),
type = randomEnumValue<DiscountType>(),
type = randomEnumValue<DiscountType>(exclude = arrayOf(DiscountType.FIXED_PRICE)),
base = DiscountBase.ON_MEMBERSHIP,
description = "On membership discount " + randomAlphanumeric(8)
)

private fun generateTestOnTotalAndMembershipDiscountInfo() = UpdatedOrder.DiscountInfo(
value = randomPrice(),
type = randomEnumValue<DiscountType>(),
type = randomEnumValue<DiscountType>(exclude = arrayOf(DiscountType.FIXED_PRICE)),
base = DiscountBase.ON_TOTAL_AND_MEMBERSHIP,
orderTotal = randomPrice(),
description = "On total and membership discount " + randomAlphanumeric(8)
)

private fun generateTestCustomDiscountInfo() = UpdatedOrder.DiscountInfo(
value = randomPrice(),
type = randomEnumValue<DiscountType>(),
type = randomEnumValue<DiscountType>(exclude = arrayOf(DiscountType.FIXED_PRICE)),
base = DiscountBase.CUSTOM,
orderTotal = randomPrice(),
description = "Custom discount " + randomAlphanumeric(8)
)

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

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

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