We're coding a custom payment gateway and have stumbled upon an issue... we're unable to properly refresh the order summary in the confirm step...
Here's the details:
The payment gateway is for a local credit card processor which offers financing, problem is you need to add a "fee" for this financing based on the financing months so you need to "refresh" the summary table when you change a select on the payment form, however after doing everything right, for reasons that are beyond me the scripts in our payment method's twig file stops running, not even a simple alert("hello world") runs which tells me the whole script doesn't run after it is refreshed using ajax...
So being it a bug so weird and unusual that I have been unable to find anything that remotely helps me solve it I can only conclude I'm doing something wrong in the design of the gateway... something as simple as adding a fee based on selection of a payment form should NOT be this complicated, right?
Here's the code
Code: Select all
$('#some-select').on('change', function() {
$.ajax({
url: 'index.php?route=extension/payment/custom_gateway/save_option&option='+$('#some-select').val(),
type: 'post',
dataType: 'json',
cache: false,
success: function(json) {
// inocently simple code that should refresh the checkout confirm step
$.ajax({
url: 'index.php?route=checkout/confirm',
dataType: 'html',
success: function (html) {
$('#collapse-checkout-confirm .panel-body').html(html);
},
error: function (xhr, ajaxOptions, thrownError) {
alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
}
});
},
error: function (request, error) {
console.log(arguments);
alert(error);
}
});
});