From 5497178200f414e51544e83fc558d29ff413566c Mon Sep 17 00:00:00 2001 From: SirDomin Date: Tue, 27 Oct 2020 13:36:09 +0100 Subject: [PATCH] handle error delay --- .../Checkout/Complete/_navigation.html.twig | 7 ++++ .../Checkout/complete.html.twig | 35 ------------------- src/Resources/views/payWithPaypal.html.twig | 2 +- 3 files changed, 8 insertions(+), 36 deletions(-) create mode 100644 src/Resources/views/bundles/SyliusShopBundle/Checkout/Complete/_navigation.html.twig delete mode 100644 src/Resources/views/bundles/SyliusShopBundle/Checkout/complete.html.twig diff --git a/src/Resources/views/bundles/SyliusShopBundle/Checkout/Complete/_navigation.html.twig b/src/Resources/views/bundles/SyliusShopBundle/Checkout/Complete/_navigation.html.twig new file mode 100644 index 00000000..cfa985ca --- /dev/null +++ b/src/Resources/views/bundles/SyliusShopBundle/Checkout/Complete/_navigation.html.twig @@ -0,0 +1,7 @@ +{% if order.lastPayment.method.gatewayConfig.factoryName == 'sylius.pay_pal' and order.lastPayment.state == 'cart' %} + {{ render(controller('Sylius\\PayPalPlugin\\Controller\\PayPalButtonsController:renderPayPalPaymentAction', {'orderId': order.id})) }} +{% else %} + +{% endif %} diff --git a/src/Resources/views/bundles/SyliusShopBundle/Checkout/complete.html.twig b/src/Resources/views/bundles/SyliusShopBundle/Checkout/complete.html.twig deleted file mode 100644 index a8051651..00000000 --- a/src/Resources/views/bundles/SyliusShopBundle/Checkout/complete.html.twig +++ /dev/null @@ -1,35 +0,0 @@ -{% extends '@SyliusShop/Checkout/layout.html.twig' %} - -{% form_theme form '@SyliusShop/Form/theme.html.twig' %} - -{% block content %} - {{ sylius_template_event(['sylius.shop.checkout.complete.steps', 'sylius.shop.checkout.steps'], _context|merge({'active': 'complete', 'orderTotal': order.total})) }} - -
- {% include '@SyliusShop/Checkout/Complete/_header.html.twig' %} - - {{ sylius_template_event('sylius.shop.checkout.complete.after_content_header', {'order': order}) }} - - {% include '@SyliusShop/_flashes.html.twig' %} - - {{ form_start(form, {'action': path('sylius_shop_checkout_complete'), 'attr': {'class': 'ui loadable form', 'novalidate': 'novalidate'}}) }} - {{ form_errors(form) }} - - - {{ sylius_template_event('sylius.shop.checkout.complete.summary', _context) }} - - - {% include '@SyliusShop/Checkout/Complete/_form.html.twig' %} - - {{ sylius_template_event('sylius.shop.checkout.complete.before_navigation', {'order': order}) }} - - {% if order.lastPayment.method.gatewayConfig.factoryName == 'sylius.pay_pal' and order.lastPayment.state == 'cart' %} - {{ render(controller('Sylius\\PayPalPlugin\\Controller\\PayPalButtonsController:renderPayPalPaymentAction', {'orderId': order.id})) }} - {% else %} - {% include '@SyliusShop/Checkout/Complete/_navigation.html.twig' %} - {% endif %} - - {{ form_row(form._token) }} - {{ form_end(form, {'render_rest': false}) }} -
-{% endblock %} diff --git a/src/Resources/views/payWithPaypal.html.twig b/src/Resources/views/payWithPaypal.html.twig index f578aaf6..ec9544ef 100644 --- a/src/Resources/views/payWithPaypal.html.twig +++ b/src/Resources/views/payWithPaypal.html.twig @@ -211,7 +211,7 @@ method: 'post', headers: { 'content-type': 'application/json' }, body: JSON.stringify(err) - }).then(window.location.reload()); + }).then(() => {setTimeout(window.location.reload, 300)}); }, onShippingChange: function(data, actions) { if (!availableCountries.filter(country => country === data.shipping_address.country_code).length) {