Skip to content

Commit

Permalink
automatic redirection upon payment
Browse files Browse the repository at this point in the history
  • Loading branch information
btcgear committed Dec 8, 2012
1 parent 74fd8a5 commit d4bc345
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions upload/catalog/view/theme/default/template/payment/bitcoin.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -31,28 +31,27 @@ DEALINGS IN THE SOFTWARE.
</div>
<?php } ?>
<script type="text/javascript"><!--
$('#button-pay').on('click', function() {
html = '<div id="payment-wrapper" style="position:relative;">';
html += ' <div id="payment-left" style="float:left; padding-top:25px;">';
html += ' <div id="payment-left" style="float:left; margin-top:20px;">';
html += ' <div style="font-size:16px; padding:6px; text-align:center;">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> BTC to </div>';
html += ' <div style="font-size:16px; padding:6px; text-align:center;"><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_send_address; ?></span></div>';
html += ' <div style="font-size:16px; padding:6px; text-align:center;"> to complete the transaction.</div>';
html += ' <div style="font-size:16px; padding:6px; text-align:center;"><a style="font-size: 16px;" href="bitcoin:<?php echo $bitcoin_send_address; ?>?amount=<?php echo $bitcoin_total; ?>">Click to pay</a> (URI-compatible wallets only)</div>';
html += ' </div>';
html += '<div id="payment-right" style="float: right;"><img src="http://chart.apis.google.com/chart?cht=qr&chl=bitcoin:<?php echo $bitcoin_send_address; ?>?amount=<?php echo $bitcoin_total; ?>&chs=160x160"></div></div>';
html += '<div class="buttons" style="clear: both;">';
html += ' <div class="right"><a id="button-confirm" class="button"><span><?php echo $button_bitcoin_confirm; ?></span></a></div>';
html += '<div class="buttons" style="clear: both; margin-bottom:6px; margin-top:12px;">';
html += ' <div class="center"><a id="button-confirm"><span>Click here</span></a> if you are not redirected automatically a few seconds after payment.</div>';
html += '</div>';
$.colorbox({
overlayClose: true,
opacity: 0.5,
width: '600px',
height: '285px',
width: '650px',
height: '275px',
href: false,
html: html,
onComplete: function() {
setInterval (bitcoin_check, 1000);
$('#button-confirm').on('click', function() {
$.ajax({
type: 'GET',
Expand All @@ -71,6 +70,18 @@ $('#button-pay').on('click', function() {
}
});
});
function bitcoin_check () {
$.ajax({
type: 'GET',
url: 'index.php?route=payment/bitcoin/confirm_sent',
timeout: 5000,
success: function(received) {
if(received) {
location.href = 'index.php?route=checkout/success';
}
}
});
}
}
});
});
Expand Down

0 comments on commit d4bc345

Please sign in to comment.