Skip to content
Snippets Groups Projects
Commit 0521e212 authored by srosse's avatar srosse
Browse files

OO-5059: some error handling if smart buttons make errors

parent 3695830b
No related branches found
No related tags found
No related merge requests found
......@@ -19,15 +19,29 @@
<div id="paypal_buttons_${r.getCId()}">
<script defer>
jQuery(function() {
jQuery(function() {
jQuery.ajax({
url: 'https://www.paypal.com/sdk/js?client-id=$clientId&currency=$currency&intent=authorize',
cache: true,
dataType: "script",
success: loadButtons
success: loadButtons,
error: errorButtons,
});
function errorButtons() {
location.reload();
}
function loadButtons() {
try {
internalLoadButtons();
} catch(e) {
if(window.console) console.log(e);
location.reload();
}
}
function internalLoadButtons() {
paypal.Buttons({
createOrder: function(data, actions) {
return fetch('$mapperUri/create-paypal-transaction', {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment