From f1472a3f11a7418e034a947dfd724b1b9603c2f8 Mon Sep 17 00:00:00 2001 From: Jaydev Waghela Date: Tue, 21 May 2024 17:02:08 +0530 Subject: [PATCH] Removed collection notice and added country in header --- checkout.js | 28 ++++++++++++---------------- index.html | 5 ----- 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/checkout.js b/checkout.js index 4116182..9baa77b 100644 --- a/checkout.js +++ b/checkout.js @@ -13,8 +13,7 @@ let stripe; // nativeAPI: true, // showWebComponents: false, // stripe: { -// publishableKey: -// "pk_test_51OoobQIhoMYCIMJxfjMZbjAVCicWGVevZPZpVVgdj0mzPkoJdRjL4gwizPOgpyflDPk78YNBuevOUZSS3egQy5AM00fluM6aqb", +// publishableKey: "", // options: { // betas: ["elements_saved_payment_methods_beta_1"], // locale: "en", @@ -34,8 +33,7 @@ let stripe; // }, // }, // }, -// customerSessionClientSecret: -// "cuss_secret_Q7tBuCiENjNApfNli76eXgJxWP0koCxw7Fcq2W7YI4M33Kq", +// customerSessionClientSecret: "", // amount: 2500, // currency: "nzd", // }, @@ -58,6 +56,7 @@ async function callAPI({ url, method, body }) { const headers = { "Content-Type": "application/json", Authorization: window.authorization, + country: window.country, }; return await fetch(`https://apim-na.dev.mypepsico.com/cgf/gpg/v1/${url}`, { @@ -70,8 +69,16 @@ async function callAPI({ url, method, body }) { } // Fetches a payment intent and captures the client secret -async function initialize({ token, customerKey, locale, amount, currency }) { +async function initialize({ + token, + country, + customerKey, + locale, + amount, + currency, +}) { window.authorization = token; + window.country = country; window.amount = amount; reactNativePostMessage({ @@ -221,9 +228,6 @@ function initStripe({ }, }); if (showWebComponents) { - document - .querySelector("#payment-collection-notice") - .classList.remove("hidden"); document.querySelector("#submit").classList.remove("hidden"); } setLoading(false); @@ -359,7 +363,6 @@ async function handleSubmit(e) { setLoading(false); document.querySelector("#payment-element").classList.add("hidden"); - document.querySelector("#payment-collection-notice").classList.add("hidden"); document.querySelector("#submit").classList.add("hidden"); document.querySelector("#confirm").classList.remove("hidden"); } @@ -473,13 +476,6 @@ function setLoading(isLoading) { } } -function onClickCollectionNotice() { - reactNativePostMessage({ - eventName: "stripe.collectionNotice", - eventData: {}, - }); -} - function reactNativePostMessage(postData) { /* Storing user's device details in a variable*/ let details = navigator.userAgent; diff --git a/index.html b/index.html index 9175d53..6f74270 100644 --- a/index.html +++ b/index.html @@ -21,11 +21,6 @@ -