Skip to content

Commit

Permalink
PSPAYPAL-815 remove bug button template because of '&' issue
Browse files Browse the repository at this point in the history
  • Loading branch information
René Gust committed Dec 12, 2024
1 parent 40b05d6 commit e704043
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions views/twig/frontend/paymentbuttons.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{% set aid = "" %}
{% endif %}
{% set sToken = oViewConf.getSessionChallengeToken() %}
{% set sSelfLink = oViewConf.getSslSelfLink()|replace({"&": "&"}) %}
const selfLink = "{{ oViewConf.getSslSelfLink()|raw }}";
{% if buttonId == "oscpaypal_sepa" or buttonId == "oscpaypal_cc_alternative" %}
FUNDING_SOURCES = [
paypal.FUNDING.{% if buttonId == "oscpaypal_sepa" %}SEPA{% elseif buttonId == "oscpaypal_cc_alternative" %}CARD{% endif %}
Expand All @@ -17,7 +17,7 @@
let button = paypal.Buttons({
fundingSource: fundingSource,
createOrder: function (data, actions) {
return fetch('{{ sSelfLink|cat("cl=oscpaypalproxy&fnc=createOrder&paymentid=")|cat(buttonId)|cat("&context=continue&stoken=")|cat(sToken)|raw }}', {
return fetch(selfLink + "cl=oscpaypalproxy&fnc=createOrder&paymentid={{ buttonId }}&context=continue&stoken={{ sToken }}", {
method: 'post',
headers: {
'content-type': 'application/json'
Expand All @@ -31,7 +31,7 @@
onApprove: function (data, actions) {
captureData = new FormData();
captureData.append('orderID', data.orderID);
return fetch('{{ sSelfLink|cat("cl=oscpaypalproxy&fnc=approveOrder&paymentid=")|cat(buttonId)|cat("&context=continue&stoken=")|cat(sToken)|raw }}', {
return fetch(selfLink + "cl=oscpaypalproxy&fnc=approveOrder&paymentid={{ buttonId }}&context=continue&stoken={{ sToken }}", {
method: 'post',
body: captureData
}).then(function (res) {
Expand All @@ -40,15 +40,15 @@
if (data.status == "ERROR") {
location.reload();
} else if (data.id && data.status == "APPROVED") {
location.replace('{{ sSelfLink|cat("cl=order")|raw }}');
location.replace(selfLink + "cl=order");
}
})
},
onCancel: function (data, actions) {
fetch('{{ sSelfLink|cat("cl=oscpaypalproxy&fnc=cancelPayPalPayment")|raw }}');
fetch(selfLink + "cl=oscpaypalproxy&fnc=cancelPayPalPayment");
},
onError: function (data) {
fetch('{{ sSelfLink|cat("cl=oscpaypalproxy&fnc=cancelPayPalPayment")|raw }}');
fetch(selfLink + "cl=oscpaypalproxy&fnc=cancelPayPalPayment");
}
})
// Check if the button is eligible
Expand Down Expand Up @@ -77,7 +77,7 @@
}
});
}
let baseUrl = '{{ sSelfLink|cat("cl=oscpaypalproxy&fnc=createOrder&aid=")|cat(aid)|cat("&context=continue&stoken=")|cat(sToken)|raw }}';
let baseUrl = selfLink + "cl=oscpaypalproxy&fnc=createOrder&aid={{ aid }}&context=continue&stoken={{ sToken }}";
let url = baseUrl + (params.toString() ? '&' + params.toString() : '');
return fetch(url , {
method: 'post',
Expand All @@ -93,7 +93,7 @@
onApprove: function (data, actions) {
captureData = new FormData();
captureData.append('orderID', data.orderID);
return fetch('{{ sSelfLink|cat("cl=oscpaypalproxy&fnc=approveOrder&context=continue&aid=")|cat(aid)|cat("&stoken=")|cat(sToken)|raw }}', {
return fetch(selfLink + "cl=oscpaypalproxy&fnc=approveOrder&context=continue&aid={{ aid }}&context=continue&stoken={{ sToken }}", {
method: 'post',
body: captureData
}).then(function (res) {
Expand All @@ -102,15 +102,15 @@
if (data.status == "ERROR") {
location.reload();
} else if (data.id && data.status == "APPROVED") {
location.replace('{{ sSelfLink|cat("cl=order")|raw }}');
location.replace(selfLink + "cl=order");
}
})
},
onCancel: function (data, actions) {
fetch('{{ sSelfLink|cat("cl=oscpaypalproxy&fnc=cancelPayPalPayment")|raw }}');
fetch(selfLink + "cl=oscpaypalproxy&fnc=cancelPayPalPayment");
},
onError: function (data) {
fetch('{{ sSelfLink|cat("cl=oscpaypalproxy&fnc=cancelPayPalPayment")|raw }}');
fetch(selfLink + "cl=oscpaypalproxy&fnc=cancelPayPalPayment");
}
})
if (button.isEligible()) {
Expand Down

0 comments on commit e704043

Please sign in to comment.