{% set payment_method = cart.paymentMethod ?: (cart.cartCheckout ? cart.cartCheckout.paymentMethod : null) %}
{% set payment_configuration = payment_method ? payment_method.configuration : {} %}
{% set configured_name = payment_configuration['name'] ?? null %}
{% set order_comment = cart.comment|default('')|trim %}
{% if configured_name %}
    {% set payment_method_label = configured_name %}
{% elseif payment_method %}
    {% set payment_method_label = payment_method.paymentOnline
        ? 'checkout_design.payment_card'|trans({}, null, locale|default('fr'))
        : (payment_method.method in ['bankTransfert', 'banktransfert']
            ? 'checkout_design.payment_banktransfert'|trans({}, null, locale|default('fr'))
            : 'checkout_design.payment_check'|trans({}, null, locale|default('fr'))) %}
{% else %}
    {% set payment_method_label = null %}
{% endif %}
{{ 'order.admin_mail.intro'|trans({'%company%': company }, null, locale|default('fr')) }}

{% if payment_method_label %}
{{ 'order.admin_mail.payment_label'|trans({}, null, locale|default('fr')) }} {{ payment_method_label }}
{% endif %}

{{ 'order.admin_mail.customer_intro'|trans({'%firstname%': cart.firstname|default(''), '%lastname%': cart.lastname|default('') }, null, locale|default('fr')) }}

{{ 'order.admin_mail.reference_label'|trans({}, null, locale|default('fr')) }}: {{ reference }}
{{ 'shop.total'|trans({}, null, locale|default('fr')) }}: {% if cart.total is not null %}{{ cart.total|price_format }} €{% else %}-{% endif %}

{{ attachment_notice }}

{% if order_comment != '' %}
{{ 'checkout_design.info_title'|trans({}, null, locale|default('fr')) }}:
{{ order_comment }}

{% endif %}

{{ company }}
