{% set contributions = contributions.get(product.pk, []) %}
{% if contributions %}
{% set last_contrib = contributions[-1].type in [amo.CONTRIB_PURCHASE, amo.CONTRIB_INAPP]
and contributions[-1].id %}
{% for contribution in contributions %}
{# Show "Request Support" link if this is the last contribution
and is a purchase. #}
{% set get_support = (contribution.id == last_contrib) and show_link %}
{% if contribution.type in [amo.CONTRIB_PURCHASE, amo.CONTRIB_INAPP] %}
{% if contribution.type == amo.CONTRIB_INAPP %}
{% trans date=contribution.created|datetime,
amt=contribution.get_amount_locale() %}
In-app purchase {{ date }} for {{ amt }}
{% endtrans %}
{% else %}
{% trans date=contribution.created|datetime,
amt=contribution.get_amount_locale() %}
Purchased {{ date }} for {{ amt }}
{% endtrans %}
{% endif %}
{% if get_support or (show_link and contribution.type == amo.CONTRIB_INAPP) %}
{{ _('Request Support') }}
{% endif %}
{% elif contribution.type == amo.CONTRIB_REFUND %}
{% trans date=contribution.created|datetime,
amt=contribution.get_amount_locale() %}
Refunded {{ date }} for {{ amt }}
{% endtrans %}
{% elif contribution.type == amo.CONTRIB_CHARGEBACK %}
{% trans date=contribution.created|datetime,
amt=contribution.get_amount_locale() %}
Reversed {{ date }} for {{ amt }}
{% endtrans %}
{% endif %}