From 749107ee0fc99698fb501fc8b944b827e5fad2c7 Mon Sep 17 00:00:00 2001 From: John Atkinson Date: Wed, 19 Dec 2012 17:25:40 -0800 Subject: [PATCH] early auto-redirect bug fixed --- upload/catalog/controller/payment/bitcoin.php | 6 +++++- .../view/theme/default/template/payment/bitcoin.tpl | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/upload/catalog/controller/payment/bitcoin.php b/upload/catalog/controller/payment/bitcoin.php index 0cdf39d..0ce61f3 100644 --- a/upload/catalog/controller/payment/bitcoin.php +++ b/upload/catalog/controller/payment/bitcoin.php @@ -93,7 +93,11 @@ public function confirm_sent() { $this->data['error'] = true; } - $received_amount = $bitcoin->getreceivedbyaccount($this->config->get('bitcoin_prefix').'_'.$order_id,0); + try { + $received_amount = $bitcoin->getreceivedbyaccount($this->config->get('bitcoin_prefix').'_'.$order_id,0); + } catch (Exception $e) { + echo false; + } if(round((float)$received_amount,4) >= round((float)$bitcoin_total,4)) { $order = $this->model_checkout_order->getOrder($order_id); $this->model_checkout_order->confirm($order_id, $this->config->get('bitcoin_order_status_id')); diff --git a/upload/catalog/view/theme/default/template/payment/bitcoin.tpl b/upload/catalog/view/theme/default/template/payment/bitcoin.tpl index d378477..ea64dff 100644 --- a/upload/catalog/view/theme/default/template/payment/bitcoin.tpl +++ b/upload/catalog/view/theme/default/template/payment/bitcoin.tpl @@ -44,6 +44,7 @@ if (typeof colorbox == 'undefined') { document.getElementsByTagName("head")[0].appendChild(e); } $('#button-pay').on('click', function() { + var checker = 0; html = '
'; html += '
'; html += '
'; @@ -63,7 +64,7 @@ $('#button-pay').on('click', function() { href: false, html: html, onComplete: function() { - setInterval (bitcoin_check, 1000); + checker = setInterval(bitcoin_check, 5000); $('#button-confirm').on('click', function() { $.ajax({ type: 'GET', @@ -94,6 +95,10 @@ $('#button-pay').on('click', function() { } }); } + }, + onCleanup: function() { + clearInterval(checker); + checker = 0; } }); });