{% load i18n %}

{% if payment_info %}
    <dl class="dl-horizontal">
        {% if "id" in payment_info %}
            <dt>{% trans "Charge ID" %}</dt>
            <dd>{{ payment_info.id }}</dd>
        {% endif %}
        {% if "source" in payment_info %}
            {% if payment_info.source.card %}
                <dt>{% trans "Card type" %}</dt>
                <dd>{{ payment_info.source.card.brand }}</dd>
                <dt>{% trans "Card number" %}</dt>
                <dd>**** **** **** {{ payment_info.source.card.last4 }}</dd>
                {% if payment_info.source.owner.name %}
                    <dt>{% trans "Payer name" %}</dt>
                    <dd>{{ payment_info.source.owner.name }}</dd>
                {% endif %}
            {% endif %}
            {% if payment_info.source.type == "giropay" %}
                <dt>{% trans "Bank" %}</dt>
                <dd>{{ payment_info.source.giropay.bank_name }} ({{ payment_info.source.giropay.bic }})</dd>
                <dt>{% trans "Payer name" %}</dt>
                <dd>{{ payment_info.source.owner.verified_name|default:payment_info.source.owner.name }}</dd>
            {% endif %}
            {% if payment_info.source.type == "bancontact" %}
                <dt>{% trans "Bank" %}</dt>
                <dd>{{ payment_info.source.bancontact.bank_name }} ({{ payment_info.source.bancontact.bic }})</dd>
                <dt>{% trans "Payer name" %}</dt>
                <dd>{{ payment_info.source.owner.verified_name|default:payment_info.source.owner.name }}</dd>
            {% endif %}
            {% if payment_info.source.type == "ideal" %}
                <dt>{% trans "Bank" %}</dt>
                <dd>{{ payment_info.source.ideal.bank }} ({{ payment_info.source.ideal.bic }})</dd>
                <dt>{% trans "Payer name" %}</dt>
                <dd>{{ payment_info.source.owner.verified_name|default:payment_info.source.owner.name }}</dd>
            {% endif %}
        {% endif %}
        {% if payment_info.charges.data.0 %}
            {% if payment_info.charges.data.0.payment_method_details.card %}
                <dt>{% trans "Card type" %}</dt>
                <dd>{{ payment_info.charges.data.0.payment_method_details.card.brand }}</dd>
                <dt>{% trans "Card number" %}</dt>
                <dd>
                    **** **** **** {{ payment_info.charges.data.0.payment_method_details.card.last4 }}
                    {% if payment_info.charges.data.0.payment_method_details.card.moto %}
                        <span class="label label-info">{% trans "MOTO" %}</span>
                    {% endif %}
                </dd>
            {% endif %}
        {% endif %}
        {% if "amount" in payment_info %}
            <dt>{% trans "Total value" %}</dt>
            <dd>{{ payment_info.amount|floatformat:2 }}</dd>
        {% endif %}
        {% if "currency" in payment_info %}
            <dt>{% trans "Currency" %}</dt>
            <dd>{{ payment_info.currency|upper }}</dd>
        {% endif %}
        {% if "status" in payment_info %}
            <dt>{% trans "Status" %}</dt>
            <dd>{{ payment_info.status }}</dd>
        {% endif %}
        {% if "message" in payment_info %}
            <dt>{% trans "Error message" %}</dt>
            <dd>{{ payment_info.message }}</dd>
        {% endif %}
    </dl>
{% endif %}
