From a3292451907ce5e3d44f8d2a6c554cc6c0415dac Mon Sep 17 00:00:00 2001 From: Adrian Fella Date: Mon, 2 Oct 2023 16:45:07 +0200 Subject: [PATCH] Use cart values from BE response --- src/components/Cart/cart.js | 48 +++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/src/components/Cart/cart.js b/src/components/Cart/cart.js index 9832eecf..8e2897b9 100644 --- a/src/components/Cart/cart.js +++ b/src/components/Cart/cart.js @@ -301,7 +301,7 @@ export const CartSubTotalExcludeVat = ({ value, currency }) => { Subtotal without VAT @@ -319,16 +319,16 @@ export const CartSubTotalIncludeVat = ({ grossValue, currency }) => { ) } -export const CartVat = ({ value, taxPercentage, currency }) => { +export const CartVat = ({ taxAggregate, currency }) => { return ( <> - VAT {taxPercentage}% of{' '} - + VAT {taxAggregate.rate}% of{' '} + @@ -384,7 +384,7 @@ const CartGoCart = () => { } export const getShippingCost = (shippingMethod) => { - return shippingMethod != null ? shippingMethod?.fee : 0 + return shippingMethod != null ? shippingMethod?.fees[0].amount : 0 } export const CartActionPanel = ({ action }) => { @@ -421,23 +421,29 @@ export const CartActionPanel = ({ action }) => { )} + {cartAccount && + cartAccount?.taxAggregate && + cartAccount?.taxAggregate.lines.length > 0 && ( + cartAccount?.taxAggregate.lines.map((taxItem) => { + return ( + + + + + + ) + }) + )} + - - {cartAccount && - cartAccount?.taxAggregate && - cartAccount?.taxAggregate.lines.length > 0 && ( - - )} - {cartAccount?.subtotalAggregate && cartAccount?.subtotalAggregate.grossValue && ( )} @@ -455,11 +461,7 @@ export const CartActionPanel = ({ action }) => { {cartAccount.totalPrice && cartAccount.totalPrice.amount && ( )}