From b992edcc7f1b7395dea0c8562ddf272df9fc6b7f Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Sat, 29 Jun 2024 10:08:16 +0700
Subject: <iman> add parameter flag flash sale

---
 src/lib/checkout/components/Checkout.jsx | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

(limited to 'src/lib/checkout/components/Checkout.jsx')

diff --git a/src/lib/checkout/components/Checkout.jsx b/src/lib/checkout/components/Checkout.jsx
index 5ca3611f..df1768fb 100644
--- a/src/lib/checkout/components/Checkout.jsx
+++ b/src/lib/checkout/components/Checkout.jsx
@@ -112,6 +112,7 @@ const Checkout = () => {
   const [loadingVoucher, setLoadingVoucher] = useState(true);
   const [loadingRajaOngkir, setLoadingRajaOngkir] = useState(false);
   const [grandTotal, setGrandTotal] = useState(0);
+  const [hasFlashSale, setHasFlashSale] = useState(false);
 
   const expedisiValidation = useRef(null);
 
@@ -224,6 +225,7 @@ const Checkout = () => {
     setProducts(cartCheckout?.products);
     setCheckWeight(cartCheckout?.hasProductWithoutWeight);
     setTotalWeight(cartCheckout?.totalWeight.g);
+    setHasFlashSale(cartCheckout?.products[0]?.hasFlashsale ? cartCheckout.products[0].hasFlashsale : false);
   }, [cartCheckout]);
 
   useEffect(() => {
@@ -343,6 +345,7 @@ const Checkout = () => {
       carrier_id: selectedCarrierId,
       estimated_arrival_days: splitDuration(etd),
       delivery_service_type: selectedExpedisiService,
+      flash_sale : !hasFlashSale, // dibuat negasi untuk ngetest kebalikan nilai false
       voucher: activeVoucher,
       type: 'sale_order',
     };
@@ -358,7 +361,7 @@ const Checkout = () => {
       toast.error('Gagal melakukan transaksi, terjadi kesalahan internal');
       return;
     }
-
+    console.log("isCheckouted",isCheckouted)
     gtagPurchase(products, biayaKirim, isCheckouted.name);
 
     const midtrans = async () => {
-- 
cgit v1.2.3

