From 3137ac3d4c98441ead773ceeb00dee64a38e8b62 Mon Sep 17 00:00:00 2001 From: NerdyVisky Date: Sun, 10 Oct 2021 11:51:50 +0530 Subject: [PATCH] minor fixes: updated balance --- js/payment.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/js/payment.js b/js/payment.js index e97ba9a..cef50c9 100644 --- a/js/payment.js +++ b/js/payment.js @@ -127,6 +127,7 @@ const animItem = bodymovin.loadAnimation({ submitBtn.addEventListener('click', ()=>{ // Dialog box to showcase payment processing makePayment(); + exitOption(); }) // Javascript Promise to authenticate/process payment or throw error acc. to user input @@ -160,10 +161,10 @@ function processPayment(cardDetails){ return new Promise((resolve, reject) => { console.log(cardDetails); // fetch balance - const balance = 100; + const balance = 10000; if(balance>=payment){ //Card company makes payment and calls resolve - resolve(` INR ${payment} has been deducted from your account`); + resolve(` INR ${payment} /- has been deducted from your account`); }else{ reject('INSUFFICIENT CARD BALANCE'); } @@ -220,12 +221,15 @@ async function makePayment() { // Exit button -okayBtn.addEventListener('click', ()=>{ - successBox.style.transform = "scale(0)"; - setTimeout(()=>{ - location.reload() - }, 500) -}) +const exitOption = () => { + okayBtn.addEventListener('click', ()=>{ + successBox.style.transform = "scale(0)"; + setTimeout(()=>{ + location.reload() + }, 500) + }) +} +