Skip to content

Commit

Permalink
minor fixes: updated balance
Browse files Browse the repository at this point in the history
  • Loading branch information
NerdyVisky committed Oct 10, 2021
1 parent b545aa1 commit 3137ac3
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions js/payment.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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');
}
Expand Down Expand Up @@ -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)
})
}




Expand Down

0 comments on commit 3137ac3

Please sign in to comment.