From 496fe7cb7a2a0cb5919b3e8d4e66b28c81dff805 Mon Sep 17 00:00:00 2001 From: Changaco Date: Mon, 16 Sep 2024 16:05:21 +0200 Subject: [PATCH 1/3] always mark SEPA mandates as defaults for EUR only --- sql/branch.sql | 1 + www/%username/routes/add.spt | 2 +- www/%username/routes/index.spt | 24 ++++++++++++------------ 3 files changed, 14 insertions(+), 13 deletions(-) create mode 100644 sql/branch.sql diff --git a/sql/branch.sql b/sql/branch.sql new file mode 100644 index 000000000..8994f50d7 --- /dev/null +++ b/sql/branch.sql @@ -0,0 +1 @@ +UPDATE exchange_routes SET is_default_for = 'EUR', is_default = null WHERE network = 'stripe-sdd' AND is_default; diff --git a/www/%username/routes/add.spt b/www/%username/routes/add.spt index 66c0fe7c6..d7ca94c2d 100644 --- a/www/%username/routes/add.spt +++ b/www/%username/routes/add.spt @@ -120,7 +120,7 @@ title = _("Add a payment instrument") {{ _("Forget this bank account number after one payment.") }}
diff --git a/www/%username/routes/index.spt b/www/%username/routes/index.spt index 079189536..ea8cbe913 100644 --- a/www/%username/routes/index.spt +++ b/www/%username/routes/index.spt @@ -181,18 +181,18 @@ title = _("Payment Instruments") % if route.status in ('chargeable', 'pending') - % if not route.is_default - - % if last_payin and participant.donates_in_multiple_currencies - - % endif + % if route.network == 'stripe-card' and not route.is_default + + % endif + % if last_payin and participant.donates_in_multiple_currencies and not route.is_default_for + % endif % endif From fcbf14d60e7b0f86702d002f8fbc8a15c657036e Mon Sep 17 00:00:00 2001 From: Changaco Date: Fri, 20 Sep 2024 23:12:26 +0200 Subject: [PATCH 2/3] recase and update mentions of the euro currency --- templates/macros/payment-methods.html | 6 +++--- www/%username/giving/pay/%payment_id.spt | 4 ++-- www/%username/payment/index.spt | 2 +- www/%username/routes/index.spt | 10 ++++------ www/about/faq.spt | 7 ++++--- www/about/global.spt | 2 +- 6 files changed, 15 insertions(+), 16 deletions(-) diff --git a/templates/macros/payment-methods.html b/templates/macros/payment-methods.html index a7e2ecf40..ff4b40463 100644 --- a/templates/macros/payment-methods.html +++ b/templates/macros/payment-methods.html @@ -22,8 +22,8 @@ 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 _( @@ -31,7 +31,7 @@ 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"], diff --git a/www/%username/giving/pay/%payment_id.spt b/www/%username/giving/pay/%payment_id.spt index 6196d467f..3f543a67b 100644 --- a/www/%username/giving/pay/%payment_id.spt +++ b/www/%username/giving/pay/%payment_id.spt @@ -318,9 +318,9 @@ title = _("Funding your donations") % elif not sepa {{ _("Only for donations to SEPA countries") }} % elif payment.currency != 'EUR' - {{ _("Euro donations only") }} + {{ _("Only for donations in euros") }} % else - {{ _("Euro bank accounts only") }} + {{ _("Only euro bank accounts") }} % endif % if possible diff --git a/www/%username/payment/index.spt b/www/%username/payment/index.spt index d8f84e511..3e1753ac5 100644 --- a/www/%username/payment/index.spt +++ b/www/%username/payment/index.spt @@ -164,7 +164,7 @@ subhead = _("Payment Processors")

Stripe

{{ _( "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.)" ) }}

% if stripe_accounts diff --git a/www/%username/routes/index.spt b/www/%username/routes/index.spt index ea8cbe913..ba93bbd1a 100644 --- a/www/%username/routes/index.spt +++ b/www/%username/routes/index.spt @@ -216,15 +216,13 @@ title = _("Payment Instruments") >{{ _("Add a card") }} -
+
{{ icon('bank-account', size=32) }} -

{{ _("Bank Account") }}
+

{{ _("Euro Bank Account") }}
- {{ - _("Euro bank accounts only") }}
- {{ - _("Euro donations only") }} + {{ + _("Only for donations in euros to recipients in SEPA countries") }}

From 5466db73e2f93aa77dbd5cc396adcb0efe42e24d Mon Sep 17 00:00:00 2001 From: Changaco Date: Mon, 30 Sep 2024 10:46:43 +0200 Subject: [PATCH 3/3] implement unsetting `is_default_for` on a route --- www/%username/routes/index.spt | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/www/%username/routes/index.spt b/www/%username/routes/index.spt index ba93bbd1a..606f9cb7c 100644 --- a/www/%username/routes/index.spt +++ b/www/%username/routes/index.spt @@ -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') @@ -184,7 +186,16 @@ title = _("Payment Instruments") % if route.network == 'stripe-card' and not route.is_default % endif - % if last_payin and participant.donates_in_multiple_currencies and not route.is_default_for + % if route.is_default_for + + % elif route.network != 'stripe-card' and last_payin and participant.donates_in_multiple_currencies