Skip to content

Commit 582dd40

Browse files
authored
Merge pull request #469 from Ecwid/ECWID-157488
Add new values for CustomAppRequest.DiscountType
2 parents 4781ba5 + 8f48c96 commit 582dd40

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

src/main/kotlin/com/ecwid/apiclient/v3/dto/custom/CustomAppRequest.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,9 @@ data class CustomAppRequest(
181181
)
182182

183183
enum class DiscountType {
184-
ABS, PERCENT
184+
ABS,
185+
PERCENT,
186+
FIXED_PRICE,
185187
}
186188

187189
enum class DiscountBase {

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ package com.ecwid.apiclient.v3.dto.order.enums
22

33
enum class DiscountType {
44
ABS,
5-
PERCENT
5+
PERCENT,
6+
FIXED_PRICE,
67
}

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -164,54 +164,54 @@ fun generateTestOrder(): UpdatedOrder {
164164

165165
private fun generateTestOnTotalDiscountInfo() = UpdatedOrder.DiscountInfo(
166166
value = randomPrice(),
167-
type = randomEnumValue<DiscountType>(),
167+
type = randomEnumValue<DiscountType>(exclude = arrayOf(DiscountType.FIXED_PRICE)),
168168
base = DiscountBase.ON_TOTAL,
169169
orderTotal = randomPrice(),
170170
description = "On total discount " + randomAlphanumeric(8)
171171
)
172172

173173
private fun generateTestOnMembershipDiscountInfo() = UpdatedOrder.DiscountInfo(
174174
value = randomPrice(),
175-
type = randomEnumValue<DiscountType>(),
175+
type = randomEnumValue<DiscountType>(exclude = arrayOf(DiscountType.FIXED_PRICE)),
176176
base = DiscountBase.ON_MEMBERSHIP,
177177
description = "On membership discount " + randomAlphanumeric(8)
178178
)
179179

180180
private fun generateTestOnTotalAndMembershipDiscountInfo() = UpdatedOrder.DiscountInfo(
181181
value = randomPrice(),
182-
type = randomEnumValue<DiscountType>(),
182+
type = randomEnumValue<DiscountType>(exclude = arrayOf(DiscountType.FIXED_PRICE)),
183183
base = DiscountBase.ON_TOTAL_AND_MEMBERSHIP,
184184
orderTotal = randomPrice(),
185185
description = "On total and membership discount " + randomAlphanumeric(8)
186186
)
187187

188188
private fun generateTestCustomDiscountInfo() = UpdatedOrder.DiscountInfo(
189189
value = randomPrice(),
190-
type = randomEnumValue<DiscountType>(),
190+
type = randomEnumValue<DiscountType>(exclude = arrayOf(DiscountType.FIXED_PRICE)),
191191
base = DiscountBase.CUSTOM,
192192
orderTotal = randomPrice(),
193193
description = "Custom discount " + randomAlphanumeric(8)
194194
)
195195

196196
private fun generateTestItemDiscountInfo() = UpdatedOrder.DiscountInfo(
197197
value = randomPrice(),
198-
type = randomEnumValue<DiscountType>(),
198+
type = randomEnumValue<DiscountType>(exclude = arrayOf(DiscountType.FIXED_PRICE)),
199199
base = DiscountBase.ITEM,
200200
orderTotal = randomPrice(),
201201
description = "On item discount " + randomAlphanumeric(8)
202202
)
203203

204204
private fun generateTestShippingDiscountInfo() = UpdatedOrder.DiscountInfo(
205205
value = randomPrice(),
206-
type = randomEnumValue<DiscountType>(),
206+
type = randomEnumValue<DiscountType>(exclude = arrayOf(DiscountType.FIXED_PRICE)),
207207
base = DiscountBase.SHIPPING,
208208
orderTotal = randomPrice(),
209209
description = "On shipping discount " + randomAlphanumeric(8)
210210
)
211211

212212
private fun generateTestSubtotalDiscountInfo() = UpdatedOrder.DiscountInfo(
213213
value = randomPrice(),
214-
type = randomEnumValue<DiscountType>(),
214+
type = randomEnumValue<DiscountType>(exclude = arrayOf(DiscountType.FIXED_PRICE)),
215215
base = DiscountBase.SUBTOTAL,
216216
orderTotal = randomPrice(),
217217
description = "On subtotal discount " + randomAlphanumeric(8)

0 commit comments

Comments
 (0)