2013-11-19 16:01:29 +00:00
|
|
|
$(document).ready(function () {
|
|
|
|
|
|
|
|
var _poll_nbr = 0;
|
|
|
|
|
|
|
|
function payment_transaction_poll_status() {
|
2013-11-21 12:09:02 +00:00
|
|
|
var order_node = $('div.oe_website_sale_tx_status');
|
|
|
|
if (! order_node || order_node.data('orderId') === undefined) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
var order_id = order_node.data('orderId');
|
2014-03-14 16:23:46 +00:00
|
|
|
return openerp.jsonRpc('/shop/payment/get_status' + order_id, 'call', {
|
2013-11-21 12:09:02 +00:00
|
|
|
}).then(function (result) {
|
|
|
|
var tx_node = $('div.oe_website_sale_tx_status');
|
2013-11-19 16:01:29 +00:00
|
|
|
_poll_nbr += 1;
|
2014-01-24 14:43:55 +00:00
|
|
|
if (result.state == 'pending' && result.validation == 'automatic' && _poll_nbr <= 5) {
|
|
|
|
var txt = result.mesage;
|
2013-11-21 12:09:02 +00:00
|
|
|
setTimeout(function () {
|
|
|
|
payment_transaction_poll_status();
|
|
|
|
}, 1000);
|
|
|
|
}
|
2014-01-24 14:43:55 +00:00
|
|
|
else {
|
|
|
|
var txt = result.message;
|
2013-11-19 16:01:29 +00:00
|
|
|
}
|
2013-11-21 12:09:02 +00:00
|
|
|
tx_node.html(txt);
|
2013-11-19 16:01:29 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2013-11-21 12:09:02 +00:00
|
|
|
payment_transaction_poll_status();
|
2013-11-19 16:01:29 +00:00
|
|
|
});
|