{% load i18n %}

{% if payment_info %}
    <dl class="dl-horizontal">
        {% if payment_info.purchase_units.0.payments %}
            <dt>{% trans "Sale ID" %}</dt>
            <dd>{{ payment_info.purchase_units.0.payments.captures.0.id }}</dd>
        {% endif %}
        <dt>{% trans "Status" %}</dt>
        <dd>{{ payment_info.status }}</dd>
        {% if payment_info.payer %}
            <dt>{% trans "Payer" %}</dt>
            <dd>{{ payment_info.payer.email_address }}</dd>
        {% endif %}
        {% if payment_info.error %}
            <dt>{% trans "Error" %}</dt>
            <dd>[{{ payment_info.error.name }}] {{ payment_info.error.message }}</dd>
            {% for d in payment_info.error.details %}
                <dt>{% trans "Error" %}</dt>
                <dd>[{{ d.issue }}] {{ d.description }}</dd>
            {% endfor %}
        {% endif %}
        {% if payment_info.purchase_units.0.payments %}
            <dt>{% trans "Capture status" %}</dt>
            <dd>
                {% if payment_info.purchase_units.0.payments.captures.0.status_details.reason in "PENDING_REVIEW, BUYER_COMPLAINT" %}
                    <span class="fa fa-warning fa-danger" data-toggle="tooltip" title="{% trans "This payment is being reviewed by PayPal. Until the review is lifted, the money will not be disbursed and the order remain in its pending state." %}"></span>
                {% endif %}
                {{ payment_info.purchase_units.0.payments.captures.0.status }}
                {% if payment_info.purchase_units.0.payments.captures.0.status_details.reason %}
                    ({{ payment_info.purchase_units.0.payments.captures.0.status_details.reason }})
                {% endif %}
            </dd>

            <dt>{% trans "Last update" %}</dt>
            <dd>{{ payment_info.purchase_units.0.payments.captures.0.update_time }}</dd>
            <dt>{% trans "Total value" %}</dt>
            <dd>{{ payment_info.purchase_units.0.payments.captures.0.amount.value }}</dd>
            <dt>{% trans "Currency" %}</dt>
            <dd>{{ payment_info.purchase_units.0.payments.captures.0.amount.currency_code }}</dd>
        {% endif %}
    </dl>
{% endif %}
