diff --git a/src/Resources/views/Order/Admin/Refund/_paymentMethod.html.twig b/src/Resources/views/Order/Admin/Refund/_paymentMethod.html.twig index 213bdd6b..a33ba814 100644 --- a/src/Resources/views/Order/Admin/Refund/_paymentMethod.html.twig +++ b/src/Resources/views/Order/Admin/Refund/_paymentMethod.html.twig @@ -3,11 +3,14 @@ - {{ 'sylius.ui.original_payment_method'|trans }}: {{ original_payment_method }} + {% if original_payment_method is not null %} + {{ 'sylius.ui.original_payment_method'|trans }}: {{ original_payment_method }} + {% endif %} diff --git a/src/Resources/views/_paymentMethod.html.twig b/src/Resources/views/_paymentMethod.html.twig index c76631bc..ce814f30 100644 --- a/src/Resources/views/_paymentMethod.html.twig +++ b/src/Resources/views/_paymentMethod.html.twig @@ -1,11 +1,17 @@ -{% if order.payments.first() %} - {% set completed = constant('Sylius\\Component\\Core\\Model\\PaymentInterface::STATE_COMPLETED') %} - {% set original_payment_method = order.lastPayment(completed).method %} - +{% set completed = constant('Sylius\\Component\\Core\\Model\\PaymentInterface::STATE_COMPLETED') %} +{% set last_completed_payment = order.lastPayment(completed) %} +{% set lat_payment = order.lastPayment %} +{% if last_completed_payment is not null %} + {% set original_payment_method = last_completed_payment.method %} +{% elseif last_payment is not null %} + {% set original_payment_method = last_payment.method %} +{% else %} + {% set original_payment_method = null %} +{% endif %} -
-
- {{ sylius_template_event('sylius_refund.admin.order.refund.form.payment_method', _context) }} -
+ +
+
+ {{ sylius_template_event('sylius_refund.admin.order.refund.form.payment_method', _context) }}
-{% endif %} +