From 2a04031e3052f6a9d52ec174efcafbd193075650 Mon Sep 17 00:00:00 2001 From: Christiaan Scheermeijer Date: Wed, 27 Mar 2024 12:09:08 +0100 Subject: [PATCH] chore: fix jwp coupon discount price --- .../src/services/integrations/jwp/JWPCheckoutService.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/common/src/services/integrations/jwp/JWPCheckoutService.ts b/packages/common/src/services/integrations/jwp/JWPCheckoutService.ts index 484eb393d..678c50cd5 100644 --- a/packages/common/src/services/integrations/jwp/JWPCheckoutService.ts +++ b/packages/common/src/services/integrations/jwp/JWPCheckoutService.ts @@ -72,6 +72,7 @@ export default class JWPCheckoutService extends CheckoutService { totalPrice: payload.offer.customerPriceInclTax, priceBreakdown: { offerPrice: payload.offer.customerPriceInclTax, + // @TODO is this correct? discountAmount: payload.offer.customerPriceInclTax, discountedPrice: payload.offer.customerPriceInclTax, paymentMethodFee: 0, @@ -181,14 +182,14 @@ export default class JWPCheckoutService extends CheckoutService { accessFeeId: order.id, }); - const discountedAmount = order.totalPrice - response.data.amount; - const updatedOrder = { + const discountAmount = order.totalPrice - response.data.amount; + const updatedOrder: Order = { ...order, totalPrice: response.data.amount, priceBreakdown: { ...order.priceBreakdown, - discountedAmount, - discountedPrice: discountedAmount, + discountAmount, + discountedPrice: discountAmount, }, discount: { applied: true,