Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ECWID-126236. Added totalBeforeGiftCardRedemption field to order calculation and update methods #325

Merged
merged 2 commits into from
Sep 14, 2023
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 @@ -41,6 +41,8 @@ fun FetchedOrder.toUpdated(): UpdatedOrder {
total = total,
subtotal = subtotal,

totalBeforeGiftCardRedemption = totalBeforeGiftCardRedemption,

tax = tax,
customerTaxExempt = customerTaxExempt,
customerTaxId = customerTaxId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ data class CalculateOrderDetailsResult(
val subtotalWithoutTax: Double? = null,
val usdTotal: Double? = null,

val totalBeforeGiftCardRedemption: Double? = null,

val tax: Double? = null,
val taxesOnShipping: List<TaxOnShipping>? = null,
val availableTaxes: List<TaxInfo> = emptyList(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ data class UpdatedOrder(
val total: Double? = null,
val subtotal: Double? = null,

val totalBeforeGiftCardRedemption: Double? = null,

val tax: Double? = null,
val customerTaxExempt: Boolean? = null,
val customerTaxId: String? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,9 @@ val calculateOrderDetailsResultNullablePropertyRules: List<NullablePropertyRule<
IgnoreNullable(CalculateOrderDetailsResult::tax),
IgnoreNullable(CalculateOrderDetailsResult::taxesOnShipping),
IgnoreNullable(CalculateOrderDetailsResult::total),
AllowNullable(CalculateOrderDetailsResult::totalWithoutTax),
IgnoreNullable(CalculateOrderDetailsResult::totalAndMembershipBasedDiscount),
AllowNullable(CalculateOrderDetailsResult::totalBeforeGiftCardRedemption),
AllowNullable(CalculateOrderDetailsResult::totalWithoutTax),
IgnoreNullable(CalculateOrderDetailsResult::usdTotal),
IgnoreNullable(CalculateOrderDetailsResult::volumeDiscount)
)
4 changes: 3 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 @@ -8,6 +8,7 @@ fun generateTestOrder(): UpdatedOrder {
val externalOrderId = "Order #" + randomAlphanumeric(8)
val externalFulfillment = randomBoolean()
val refererId = "Referer " + randomAlphanumeric(8)
val totalPrice = randomPrice()
return UpdatedOrder(
email = randomEmail(),
ipAddress = randomIp(),
Expand Down Expand Up @@ -49,7 +50,8 @@ fun generateTestOrder(): UpdatedOrder {
customerGroup = "Group " + randomAlphanumeric(8),
acceptMarketing = randomBoolean(),

total = randomPrice(),
total = totalPrice,
totalBeforeGiftCardRedemption = totalPrice,
subtotal = randomPrice(),

tax = randomPrice(),
Expand Down