Skip to content

Commit

Permalink
Merge pull request #361 from Ecwid/ECWID-130811
Browse files Browse the repository at this point in the history
ECWID-130811 OE2: deleting a gift card is not applied in the order ed…
  • Loading branch information
zont163 authored Dec 15, 2023
2 parents ebd868c + 5119f12 commit 3dc3871
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ fun FetchedOrder.toUpdated(): UpdatedOrder {
subtotal = subtotal,

totalBeforeGiftCardRedemption = totalBeforeGiftCardRedemption,
giftCardRedemption = giftCardRedemption,
giftCardDoubleSpending = giftCardDoubleSpending,
giftCardCode = giftCardCode,
giftCardId = giftCardId,

tax = tax,
customerTaxExempt = customerTaxExempt,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ data class OrderForCalculate(
val giftCardCode: String? = null,
val giftCardId: Int? = null,
val giftCardTransactionOrderId: Int? = null,
val giftCardRedemption: Double? = null,
val totalBeforeGiftCardRedemption: Double? = null,
val giftCardDoubleSpending: Boolean? = null,
) : ApiRequestDTO {

data class DiscountInfo(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ data class CalculateOrderDetailsResult(
val usdTotal: Double? = null,

val totalBeforeGiftCardRedemption: Double? = null,
val giftCardRedemption: Double? = null,
val giftCardDoubleSpending: Boolean? = null,
val giftCardCode: String? = null,
val giftCardId: Int? = null,

val tax: Double? = null,
val taxesOnShipping: List<TaxOnShipping>? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ data class FetchedCart(
val subtotal: Double? = null,
val usdTotal: Double? = null,

val giftCardCode: String? = null,
val giftCardId: Int? = null,
val giftCardRedemption: Double? = null,
val totalBeforeGiftCardRedemption: Double? = null,
val giftCardDoubleSpending: Boolean? = 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 @@ -48,6 +48,10 @@ data class UpdatedOrder(
val subtotal: Double? = null,

val totalBeforeGiftCardRedemption: Double? = null,
val giftCardRedemption: Double? = null,
val giftCardDoubleSpending: Boolean? = null,
val giftCardCode: String? = null,
val giftCardId: Int? = null,

val tax: Double? = null,
val customerTaxExempt: Boolean? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ val nonUpdatablePropertyRules: List<NonUpdatablePropertyRule<*, *>> = listOf(
Ignored(FetchedCart::total),
Ignored(FetchedCart::subtotal),
Ignored(FetchedCart::usdTotal),
ReadOnly(FetchedCart::giftCardCode),
ReadOnly(FetchedCart::giftCardDoubleSpending),
ReadOnly(FetchedCart::giftCardId),
ReadOnly(FetchedCart::giftCardRedemption),
ReadOnly(FetchedCart::totalBeforeGiftCardRedemption),
Ignored(FetchedCart::tax),
Ignored(FetchedCart::customerTaxExempt),
Ignored(FetchedCart::customerTaxId),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@ val calculateOrderDetailsResultNullablePropertyRules: List<NullablePropertyRule<
IgnoreNullable(CalculateOrderDetailsResult::total),
IgnoreNullable(CalculateOrderDetailsResult::totalAndMembershipBasedDiscount),
AllowNullable(CalculateOrderDetailsResult::totalBeforeGiftCardRedemption),
AllowNullable(CalculateOrderDetailsResult::giftCardRedemption),
AllowNullable(CalculateOrderDetailsResult::giftCardDoubleSpending),
AllowNullable(CalculateOrderDetailsResult::giftCardCode),
AllowNullable(CalculateOrderDetailsResult::giftCardId),
AllowNullable(CalculateOrderDetailsResult::totalWithoutTax),
IgnoreNullable(CalculateOrderDetailsResult::usdTotal),
IgnoreNullable(CalculateOrderDetailsResult::volumeDiscount)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ val fetchedCartNullablePropertyRules: List<NullablePropertyRule<*, *>> = listOf(
IgnoreNullable(FetchedCart::updateDate),
IgnoreNullable(FetchedCart::updateTimestamp),
IgnoreNullable(FetchedCart::usdTotal),
AllowNullable(FetchedCart::giftCardCode),
AllowNullable(FetchedCart::giftCardDoubleSpending),
AllowNullable(FetchedCart::giftCardId),
AllowNullable(FetchedCart::giftCardRedemption),
AllowNullable(FetchedCart::totalBeforeGiftCardRedemption),
IgnoreNullable(FetchedCart::utmData),
IgnoreNullable(FetchedCart::volumeDiscount),
IgnoreNullable(FetchedCart.CreditCardStatus::avsMessage),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ val orderForCalculateNullablePropertyRules: List<NullablePropertyRule<*, *>> = l
AllowNullable(OrderForCalculate::giftCardCode),
AllowNullable(OrderForCalculate::giftCardId),
AllowNullable(OrderForCalculate::giftCardTransactionOrderId),
AllowNullable(OrderForCalculate::giftCardRedemption),
AllowNullable(OrderForCalculate::totalBeforeGiftCardRedemption),
AllowNullable(OrderForCalculate::giftCardDoubleSpending),
IgnoreNullable(OrderForCalculate::ipAddress),
IgnoreNullable(OrderForCalculate::items),
AllowNullable(OrderForCalculate::paymentOptionsDetails),
Expand Down
2 changes: 2 additions & 0 deletions src/test/kotlin/com/ecwid/apiclient/v3/util/OrderUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ fun generateTestOrder(): UpdatedOrder {
total = totalPrice,
totalBeforeGiftCardRedemption = totalPrice,
subtotal = randomPrice(),
giftCardRedemption = 0.0,
giftCardDoubleSpending = false,

tax = randomPrice(),
customerTaxExempt = false, // TODO We cannot set this field to true, we should need update corresponding customer entity field first
Expand Down

0 comments on commit 3dc3871

Please sign in to comment.