Skip to content

Commit

Permalink
early auto-redirect bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
btcgear committed Dec 20, 2012
1 parent cf16c26 commit 749107e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 5 additions & 1 deletion upload/catalog/controller/payment/bitcoin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ if (typeof colorbox == 'undefined') {
document.getElementsByTagName("head")[0].appendChild(e);
}
$('#button-pay').on('click', function() {
var checker = 0;
html = '<div id="payment-wrapper" style="position:relative;">';
html += ' <div id="payment-left" style="float:left; margin-top:20px;">';
html += ' <div style="font-size:16px; padding:6px; text-align:center;"><?php echo $text_please_send ?> <span style="font-size:18px; border-style:solid; border-width: 1px; border-radius:3px; padding-top:3px; padding-right:6px; padding-left:6px; padding-bottom:3px;"><?php echo $bitcoin_total; ?></span> <?php echo $text_btc_to ?> </div>';
Expand All @@ -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',
Expand Down Expand Up @@ -94,6 +95,10 @@ $('#button-pay').on('click', function() {
}
});
}
},
onCleanup: function() {
clearInterval(checker);
checker = 0;
}
});
});
Expand Down

0 comments on commit 749107e

Please sign in to comment.