Skip to content

Commit

Permalink
Merge pull request #8417 from cfpb/tccp/detail-fees-cleanup
Browse files Browse the repository at this point in the history
TCCP: Cleanup detail page fee logic
  • Loading branch information
chosak committed May 17, 2024
2 parents 57fed3e + 0ef644b commit a6e7fe1
Showing 1 changed file with 8 additions and 41 deletions.
49 changes: 8 additions & 41 deletions cfgov/tccp/jinja2/tccp/card.html
Original file line number Diff line number Diff line change
Expand Up @@ -386,31 +386,12 @@ <h2>
- Other fee: "$50 {fee name, period}"
- Annual and other fee: "$495 annual fee + $50 {fee name, period}"
- No periodic fee: "$0 annual fee"
- Fee that varies: "$25 - $55 annual/monthly fee"
#}
<div class="m-payment-calculation u-mb15">
{% if card.annual_fee or not card.periodic_fee_type %}
{% if card.annual_fee %}
<div class="m-payment-calculation__part">
<div class="h2 u-mb0 u-mt0">
{# A handful of cards have both an annual and monthly
fee with one of those fees varying. Because of how
the data is (not) structured, we can only tell which
fee varies by looking for either "annual" or
"monthly" in the text of the fee explanation.
#}
{% if card.fee_varies %}
{% if card.periodic_fee_type | join == "Annual" %}
{{ currency(card.periodic_min) ~ ' - '
~ currency(card.periodic_max) }}
{% elif card.fee_explanation.lower().count('annual') %}
{{ currency(card.periodic_min) ~ ' - '
~ currency(card.periodic_max) }}
{% else %}
{{ currency(card.annual_fee) }}
{% endif %}
{% else %}
{{ currency(card.annual_fee) if card.annual_fee else currency(0) }}
{% endif %}
{{ currency(card.annual_fee) if card.annual_fee else currency(0) }}
<span class="u-visually-hidden">Annual fee</span>
</div>
<div class="h4 u-mt0 u-mb0" aria-hidden="true">
Expand All @@ -424,25 +405,7 @@ <h2>
{% endif %}
<div class="m-payment-calculation__part">
<div class="h2 u-mb0 u-mt0">
{# A handful of cards have both an annual and monthly
fee with one of those fees varying. Because of how
the data is (not) structured, we can only tell which
fee varies by looking for either "annual" or
"monthly" in the text of the fee explanation.
#}
{% if card.fee_varies %}
{% if card.periodic_fee_type | join == "Monthly" %}
{{ currency(card.periodic_min) ~ ' - '
~ currency(card.periodic_max) }}
{% elif card.fee_explanation.lower().count('monthly') %}
{{ currency(card.periodic_min) ~ ' - '
~ currency(card.periodic_max) }}
{% else %}
{{ currency(card.monthly_fee) }}
{% endif %}
{% else %}
{{ currency(card.monthly_fee) }}
{% endif %}
{{ currency(card.monthly_fee) if card.monthly_fee else currency(0) }}
<span class="u-visually-hidden">Monthly fee</span>
</div>
<div class="h4 u-mt0 u-mb0" aria-hidden="true">
Expand All @@ -465,7 +428,11 @@ <h2>
</div>
{% endif %}
{% if card.other_periodic_fee_amount %}
{% if card.annual_fee or card.monthly_fee or card.weekly_fee %}
{% if
card.annual_fee
or card.monthly_fee
or card.weekly_fee
%}
<div class="m-payment-calculation__operator h2">+</div>
{% endif %}
<div class="m-payment-calculation__part">
Expand Down

0 comments on commit a6e7fe1

Please sign in to comment.