Skip to content

Commit

Permalink
Merge pull request #2462 from liberapay/various
Browse files Browse the repository at this point in the history
  • Loading branch information
Changaco authored Sep 30, 2024
2 parents dbc98c1 + 5466db7 commit 2aeeb39
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 30 deletions.
1 change: 1 addition & 0 deletions sql/branch.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
UPDATE exchange_routes SET is_default_for = 'EUR', is_default = null WHERE network = 'stripe-sdd' AND is_default;
6 changes: 3 additions & 3 deletions templates/macros/payment-methods.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@
username=tippee.username
) if tippee.payment_providers == 0 else _(
"Donations to {username} can be paid using a credit or debit card "
"({list_of_card_brands}), or by direct debit of a Euro bank account "
"(for donations in Euro only).",
"({list_of_card_brands}), or by direct debit of a euro bank account "
"(for donations in euro only).",
username=tippee.username,
list_of_card_brands=["American Express", "Cartes Bancaires", "Diners", "Discover", "JCB", "Mastercard", "UnionPay", "Visa"],
) if tippee.payment_providers == 1 else _(
"Donations to {username} are processed through PayPal.",
username=tippee.username
) if tippee.payment_providers == 2 else _(
"Donations to {username} can be paid using: a credit or debit card "
"({list_of_card_brands}), a Euro bank account (SEPA Direct Debit), or "
"({list_of_card_brands}), a euro bank account (SEPA Direct Debit), or "
"a PayPal account.",
username=tippee.username,
list_of_card_brands=["American Express", "Cartes Bancaires", "Diners", "Discover", "JCB", "Mastercard", "UnionPay", "Visa"],
Expand Down
4 changes: 2 additions & 2 deletions www/%username/giving/pay/%payment_id.spt
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,9 @@ title = _("Funding your donations")
% elif not sepa
<small class="text-danger">{{ _("Only for donations to SEPA countries") }}</small>
% elif payment.currency != 'EUR'
<small class="text-warning">{{ _("Euro donations only") }}</small>
<small class="text-warning">{{ _("Only for donations in euros") }}</small>
% else
<small class="{{ 'text-warning' if warn else '' }}">{{ _("Euro bank accounts only") }}</small>
<small class="{{ 'text-warning' if warn else '' }}">{{ _("Only euro bank accounts") }}</small>
% endif
</h4>
% if possible
Expand Down
2 changes: 1 addition & 1 deletion www/%username/payment/index.spt
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ subhead = _("Payment Processors")
<h3>Stripe</h3>
<p>{{ _(
"With Stripe your donors can pay by card or direct debit directly from the "
"Liberapay website. (Direct debits are currently only supported from Euro "
"Liberapay website. (Direct debits are currently only supported from euro "
"bank accounts.)"
) }}</p>
% if stripe_accounts
Expand Down
2 changes: 1 addition & 1 deletion www/%username/routes/add.spt
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ title = _("Add a payment instrument")
{{ _("Forget this bank account number after one payment.") }}
</label><br>
<label>
<input type="checkbox" name="set_as_default" value="true" checked />
<input type="checkbox" name="set_as_default_for" value="EUR" checked />
{{ _("Use this payment instrument by default for future payments") }}
</label>
</fieldset>
Expand Down
47 changes: 28 additions & 19 deletions www/%username/routes/index.spt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ if request.method == 'POST':
try:
route_id, currency = request.body['set_as_default_for'].split(':')
route_id = int(route_id)
if currency not in constants.CURRENCIES:
if currency == '':
currency = None
elif currency not in constants.CURRENCIES:
raise ValueError(currency)
except ValueError:
raise response.invalid_input(request.body['set_as_default_for'], 'set_as_default_for', 'body')
Expand Down Expand Up @@ -181,18 +183,27 @@ title = _("Payment Instruments")
% if route.status in ('chargeable', 'pending')
<span>
<button class="btn btn-danger btn-xs" name="remove" value="{{ route.id }}">{{ _("Remove") }}</button>
% if not route.is_default
<button class="btn btn-primary btn-xs" name="set_as_default" value="{{ route.id }}">{{ _("Set as default") }}</button>
% if last_payin and participant.donates_in_multiple_currencies
<button class="btn btn-primary btn-xs"
name="set_as_default_for" value="{{ route.id }}:{{ last_payin.amount.currency }}"
title="{{ _(
'Use this instrument by default for payments in {currency}.',
currency=Currency(last_payin.amount.currency)
) }}">{{ _(
"Set as default for {currency}", currency=last_payin.amount.currency
) }}</button>
% endif
% if route.network == 'stripe-card' and not route.is_default
<button class="btn btn-primary btn-xs" name="set_as_default" value="{{ route.id }}">{{ _("Set as default") }}</button>
% endif
% if route.is_default_for
<button class="btn btn-warning btn-xs"
name="set_as_default_for" value="{{ route.id }}:"
title="{{ _(
'Stop using this instrument by default for payments in {currency}.',
currency=Currency(last_payin.amount.currency)
) }}">{{ _(
"Unset as default for {currency}", currency=last_payin.amount.currency
) }}</button>
% elif route.network != 'stripe-card' and last_payin and participant.donates_in_multiple_currencies
<button class="btn btn-primary btn-xs"
name="set_as_default_for" value="{{ route.id }}:{{ last_payin.amount.currency }}"
title="{{ _(
'Use this instrument by default for payments in {currency}.',
currency=Currency(last_payin.amount.currency)
) }}">{{ _(
"Set as default for {currency}", currency=last_payin.amount.currency
) }}</button>
% endif
</span>
% endif
Expand All @@ -216,15 +227,13 @@ title = _("Payment Instruments")
><span class="sr-only">{{ _("Add a card") }}</span></a>
</div>
</div>
<div class="panel panel-default {{ '' if has_euro_donations else 'muted' }}">
<div class="panel panel-default {{ '' if has_euro_donations and participant.guessed_country in constants.EUROZONE else 'muted' }}">
<div class="panel-body overlaid">
{{ icon('bank-account', size=32) }}
<h4>{{ _("Bank Account") }}<br>
<h4>{{ _("Euro Bank Account") }}<br>
<small>
<span class="text-{{ 'info' if participant.guessed_country in constants.EUROZONE else 'warning' }}">{{
_("Euro bank accounts only") }}</span><br>
<span class="text-{{ 'info' if has_euro_donations else 'warning' }}">{{
_("Euro donations only") }}</span>
<span class="text-warning">{{
_("Only for donations in euros to recipients in SEPA countries") }}</span><br>
</small>
</h4>
<a class="overlay" href="{{ participant.path('routes/add') }}?type=stripe-sdd"
Expand Down
7 changes: 4 additions & 3 deletions www/about/faq.spt
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,10 @@ title = _("Frequently Asked Questions")
"The available payment methods depend on which payment processors are "
"supported by the recipient. If a payment is processed by Stripe, then "
"most credit and debit cards ({list_of_card_brands}) are accepted, as "
"well as SEPA Direct Debits (for Euro donations only). If a payment is "
"through PayPal, then it's possible to pay in various ways, however "
"the donor needs to have or create a PayPal account.",
"well as SEPA Direct Debits (only for donations in euros to recipients "
"in SEPA countries). If a payment is through PayPal, then it's possible "
"to pay in various ways, however the donor needs to have or create a "
"PayPal account.",
list_of_card_brands=[
"American Express", "Cartes Bancaires", "Diners", "Discover", "JCB",
"Mastercard", "UnionPay", "Visa"
Expand Down
2 changes: 1 addition & 1 deletion www/about/global.spt
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ title = _("Global")
"",
"Liberapay is also available to creators in the {n} territories listed below. "
"However, donations going to those territories cannot be grouped to lower the "
"payment processing fees, and the Euro direct debit payment method isn't "
"payment processing fees, and the euro direct debit payment method isn't "
"available to the donors.",
n=len(stripe_countries_outside_sepa),
) }}</p>
Expand Down

0 comments on commit 2aeeb39

Please sign in to comment.