diff --git a/Resources/views/frontend/_public/src/js/jquery.create_order_function.js b/Resources/views/frontend/_public/src/js/jquery.create_order_function.js index 0188a561..37d560e3 100644 --- a/Resources/views/frontend/_public/src/js/jquery.create_order_function.js +++ b/Resources/views/frontend/_public/src/js/jquery.create_order_function.js @@ -41,7 +41,7 @@ delete this.latestResponse; if (jsonResponse.redirectTo) { - window.location.replace(jsonResponse.redirectTo); + $.redirectToUrl(jsonResponse.redirectTo); return; } } @@ -121,7 +121,7 @@ return; } - window.location.replace(this.sourcePlugin.opts.paypalErrorPage); + $.redirectToUrl(this.sourcePlugin.opts.paypalErrorPage); }; $.createSwagPaymentPaypalCreateOrderFunction = function(createOrderUrl, sourcePlugin) { diff --git a/Resources/views/frontend/_public/src/js/jquery.redirect.js b/Resources/views/frontend/_public/src/js/jquery.redirect.js new file mode 100644 index 00000000..b337e598 --- /dev/null +++ b/Resources/views/frontend/_public/src/js/jquery.redirect.js @@ -0,0 +1,10 @@ +(function ($) { + /** + * @param { string } url + */ + $.redirectToUrl = function (url) { + setTimeout(function () { + window.location.replace(url); + }, 250); + }; +})(jQuery); diff --git a/Resources/views/frontend/_public/src/js/jquery.swag-paypal-unified-sepa.js b/Resources/views/frontend/_public/src/js/jquery.swag-paypal-unified-sepa.js index 28818bb1..45cc624a 100644 --- a/Resources/views/frontend/_public/src/js/jquery.swag-paypal-unified-sepa.js +++ b/Resources/views/frontend/_public/src/js/jquery.swag-paypal-unified-sepa.js @@ -183,10 +183,11 @@ onApprove: function(data, actions) { var params = { - token: data.orderID, - payerId: data.payerID, - basketId: this.opts.basketId - }; + token: data.orderID, + payerId: data.payerID, + basketId: this.opts.basketId + }, + url = $.swagPayPalRenderUrl(this.opts.returnUrl, params); $.loadingIndicator.open({ openOverlay: true, @@ -194,7 +195,7 @@ theme: 'light' }); - actions.redirect($.swagPayPalRenderUrl(this.opts.returnUrl, params)); + $.redirectToUrl(url); }, /** @@ -205,7 +206,8 @@ extraParams = {}; } - window.location.replace($.swagPayPalRenderUrl(this.opts.paypalErrorPage, extraParams)); + var url = $.swagPayPalRenderUrl(this.opts.paypalErrorPageUrl, extraParams); + $.redirectToUrl(url); } }); diff --git a/Resources/views/frontend/_public/src/js/jquery.swag-paypal-unified.advanced-credit-debit-card-fallback.js b/Resources/views/frontend/_public/src/js/jquery.swag-paypal-unified.advanced-credit-debit-card-fallback.js index ba3fff94..df09d82f 100644 --- a/Resources/views/frontend/_public/src/js/jquery.swag-paypal-unified.advanced-credit-debit-card-fallback.js +++ b/Resources/views/frontend/_public/src/js/jquery.swag-paypal-unified.advanced-credit-debit-card-fallback.js @@ -104,7 +104,8 @@ theme: 'light' }); - actions.redirect(this.renderConfirmUrl(data)); + var url = this.renderConfirmUrl(data); + $.redirectToUrl(url); }, /** @@ -123,7 +124,7 @@ }, onPayPalAPIError: function() { - window.location.replace(this.opts.paypalErrorPage); + $.redirectToUrl(this.opts.paypalErrorPage); } }); })(jQuery, window); diff --git a/Resources/views/frontend/_public/src/js/jquery.swag-paypal-unified.advanced-credit-debit-card.js b/Resources/views/frontend/_public/src/js/jquery.swag-paypal-unified.advanced-credit-debit-card.js index dde73397..b7ee99b1 100644 --- a/Resources/views/frontend/_public/src/js/jquery.swag-paypal-unified.advanced-credit-debit-card.js +++ b/Resources/views/frontend/_public/src/js/jquery.swag-paypal-unified.advanced-credit-debit-card.js @@ -387,7 +387,7 @@ jsonResponse = JSON.parse(response.responseText); if (jsonResponse.redirectTo) { - window.location.replace(jsonResponse.redirectTo); + $.redirectToUrl(jsonResponse.redirectTo); return; } diff --git a/Resources/views/frontend/_public/src/js/jquery.swag-paypal-unified.express-address-patch.js b/Resources/views/frontend/_public/src/js/jquery.swag-paypal-unified.express-address-patch.js index e8866294..07bf12b0 100644 --- a/Resources/views/frontend/_public/src/js/jquery.swag-paypal-unified.express-address-patch.js +++ b/Resources/views/frontend/_public/src/js/jquery.swag-paypal-unified.express-address-patch.js @@ -65,7 +65,7 @@ var url = new URL(window.location); url.searchParams.set(this.opts.requireAddressPatchKey, requireAddressPatch.toString()); - window.location.href = url.toString(); + $.redirectToUrl(url.toString()); window.history.pushState({ path: url.toString() }, '', url.toString()); }, diff --git a/Resources/views/frontend/_public/src/js/jquery.swag-paypal-unified.express-checkout-button.js b/Resources/views/frontend/_public/src/js/jquery.swag-paypal-unified.express-checkout-button.js index 36a6fb3b..fbb2c387 100644 --- a/Resources/views/frontend/_public/src/js/jquery.swag-paypal-unified.express-checkout-button.js +++ b/Resources/views/frontend/_public/src/js/jquery.swag-paypal-unified.express-checkout-button.js @@ -371,11 +371,12 @@ data: data }).then(function (response) { var params = { - expressCheckout: response.expressCheckout, - token: response.token - }; + expressCheckout: response.expressCheckout, + token: response.token + }, + url = $.swagPayPalRenderUrl(me.opts.confirmUrl, params); - actions.redirect($.swagPayPalRenderUrl(me.opts.confirmUrl, params)); + $.redirectToUrl(url); }, function () { me.onPayPalAPIError(); }).promise(); diff --git a/Resources/views/frontend/_public/src/js/jquery.swag-paypal-unified.in-context-checkout.js b/Resources/views/frontend/_public/src/js/jquery.swag-paypal-unified.in-context-checkout.js index 671225cd..6dc608a5 100644 --- a/Resources/views/frontend/_public/src/js/jquery.swag-paypal-unified.in-context-checkout.js +++ b/Resources/views/frontend/_public/src/js/jquery.swag-paypal-unified.in-context-checkout.js @@ -208,7 +208,8 @@ theme: 'light' }); - return actions.redirect(this.renderConfirmUrl(data)); + var url = this.renderConfirmUrl(data); + $.redirectToUrl(url); }, /** diff --git a/Resources/views/frontend/_public/src/js/jquery.swag-paypal-unified.pay-later.js b/Resources/views/frontend/_public/src/js/jquery.swag-paypal-unified.pay-later.js index 09abff9d..ebebc8ef 100644 --- a/Resources/views/frontend/_public/src/js/jquery.swag-paypal-unified.pay-later.js +++ b/Resources/views/frontend/_public/src/js/jquery.swag-paypal-unified.pay-later.js @@ -167,7 +167,8 @@ theme: 'light' }); - return actions.redirect(this.renderConfirmUrl(data)); + var url = this.renderConfirmUrl(data); + $.redirectToUrl(url); }, /** @@ -186,7 +187,7 @@ }, onPayPalAPIError: function() { - window.location.replace(this.opts.paypalErrorPage); + $.redirectToUrl(this.opts.paypalErrorPage); } }); diff --git a/Resources/views/frontend/_public/src/js/jquery.swag-paypal-unified.polling.js b/Resources/views/frontend/_public/src/js/jquery.swag-paypal-unified.polling.js index 85f52ad1..fcfe0ffc 100644 --- a/Resources/views/frontend/_public/src/js/jquery.swag-paypal-unified.polling.js +++ b/Resources/views/frontend/_public/src/js/jquery.swag-paypal-unified.polling.js @@ -43,11 +43,11 @@ }, redirectToSuccess() { - window.location = this.opts.successUrl; + $.redirectToUrl(this.opts.successUrl); }, redirectToError() { - window.location = this.opts.errorUrl; + $.redirectToUrl(this.opts.errorUrl); }, retryPolling() { diff --git a/Resources/views/frontend/_public/src/js/jquery.swag-paypal-unified.smart-payment-buttons.js b/Resources/views/frontend/_public/src/js/jquery.swag-paypal-unified.smart-payment-buttons.js index faca3cc2..bb02fdff 100644 --- a/Resources/views/frontend/_public/src/js/jquery.swag-paypal-unified.smart-payment-buttons.js +++ b/Resources/views/frontend/_public/src/js/jquery.swag-paypal-unified.smart-payment-buttons.js @@ -181,10 +181,11 @@ onApprove: function(data, actions) { var params = { - token: data.orderID, - payerId: data.payerID, - basketId: this.opts.basketId - }; + token: data.orderID, + payerId: data.payerID, + basketId: this.opts.basketId + }, + url = $.swagPayPalRenderUrl(this.opts.returnUrl, params); $.loadingIndicator.open({ openOverlay: true, @@ -192,7 +193,7 @@ theme: 'light' }); - actions.redirect($.swagPayPalRenderUrl(this.opts.returnUrl, params)); + $.redirectToUrl(url); }, destroy: function() { diff --git a/Subscriber/Frontend.php b/Subscriber/Frontend.php index 9baf0ade..8c8266bc 100644 --- a/Subscriber/Frontend.php +++ b/Subscriber/Frontend.php @@ -98,6 +98,7 @@ public function onCollectJavascript() $this->pluginDir . '/Resources/views/frontend/_public/src/js/jquery.swag-paypal-unified.pui-phone-number-field.js', $this->pluginDir . '/Resources/views/frontend/_public/src/js/jquery.swag-paypal-unified.pui-birthday-field.js', $this->pluginDir . '/Resources/views/frontend/_public/src/js/jquery.swag-paypal-unified.polling.js', + $this->pluginDir . '/Resources/views/frontend/_public/src/js/jquery.redirect.js', ]; return new ArrayCollection($jsPath); diff --git a/plugin.xml b/plugin.xml index ac070a59..364bff99 100644 --- a/plugin.xml +++ b/plugin.xml @@ -5,13 +5,22 @@ - 6.1.9 + 6.1.10 (c) by shopware AG MIT http://store.shopware.com shopware AG + + + PT-13158 - Fehler während des Bestellabschlusses in iOS Web-Views behoben; + + + PT-13158 - Fix error during order checkout in iOS web views; + + + PT-13158 - Fehler beim Laden des PayPal-Buttons für den Bestellabschluss in Web-Views behoben;