From 26671e251c282b9eca63d3506068b5c3bfe11b8c Mon Sep 17 00:00:00 2001 From: Laura Alejandra Pinilla Buitrago Date: Tue, 14 Nov 2023 16:22:18 -0600 Subject: [PATCH] using the past midnight date --- .../components/Cart/index.jsx | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/blocks/subscriptions-block/components/Cart/index.jsx b/blocks/subscriptions-block/components/Cart/index.jsx index 92c8c0db83..f58f5973a3 100644 --- a/blocks/subscriptions-block/components/Cart/index.jsx +++ b/blocks/subscriptions-block/components/Cart/index.jsx @@ -7,8 +7,14 @@ import useSales from "../useSales"; import currency from "../../utils/currency"; import Item from "./item"; -const getPaymentInfo = ({ origin, endpoint, priceCode }) => - fetch(`${origin}${endpoint}${priceCode}/1/${new Date().getTime()}`, {}).then((res) => res.json()); +const getPaymentInfo = ({ origin, endpoint, priceCode }) => { + const dateMidnight = new Date(); + dateMidnight.setUTCHours(0, 0, 0, 0); + + return fetch(`${origin}${endpoint}${priceCode}/1/${dateMidnight}`, {}).then((res) => + res.json(), + ); +}; const Cart = ({ offerURL, className }) => { const { arcSite } = useFusionContext(); @@ -45,8 +51,8 @@ const Cart = ({ offerURL, className }) => { fetchPaymentInfo(item.priceCode).then((priceSummary) => ({ ...item, priceSummary, - })) - ) + })), + ), ).then((results) => { updatedCart.items = results; }); @@ -58,7 +64,7 @@ const Cart = ({ offerURL, className }) => { setCartItems( await Sales.getCart() .then(fetchCartItemSummaries) - .catch(() => []) + .catch(() => []), ); setIsFetching(false); }; @@ -105,4 +111,4 @@ Cart.propTypes = { offerURL: PropTypes.string.isRequired, }; -export default Cart; \ No newline at end of file +export default Cart;