diff --git a/js/bitpay/showmodal.js b/js/bitpay/showmodal.js index b7282ed..bd37ded 100644 --- a/js/bitpay/showmodal.js +++ b/js/bitpay/showmodal.js @@ -5,10 +5,12 @@ function showModal(env){ setTimeout(function(){ jQuery.post( "/showmodal/index/modal", function(data ) { jQuery("#bitpaybtn").prop("disabled",true) + var is_paid = false var response = JSON.parse(data) window.addEventListener("message", function (event) { payment_status = event.data.status; if (payment_status == "paid") { + is_paid = true window.location.href =response.redirectURL; return; } @@ -20,7 +22,7 @@ function showModal(env){ }); //show the order info bitpay.onModalWillLeave(function () { - if (payment_status != "paid") { + if (is_paid == false) { window.location.href = response.cartFix; } //endif }); @@ -32,4 +34,4 @@ function showModal(env){ }); }, 1000); -} \ No newline at end of file +}