From 9c20fa2587ffa33b41bdc90d357f016a711ea50c Mon Sep 17 00:00:00 2001 From: Changaco Date: Sat, 2 Nov 2024 16:40:25 +0100 Subject: [PATCH] fix Stripe payment page for minimum donations fixes LIBERAPAYCOM-27B --- liberapay/payin/common.py | 3 +++ www/%username/giving/pay/stripe/%payin_id.spt | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/liberapay/payin/common.py b/liberapay/payin/common.py index 1eb35d88d..f727f26ac 100644 --- a/liberapay/payin/common.py +++ b/liberapay/payin/common.py @@ -558,6 +558,9 @@ def resolve_amounts( Returns a copy of `base_amounts` with updated values. """ + if available_amount < (minimum_amount or 0): + raise ValueError("available_amount can't be less than minimum_amount or 0") + currency = available_amount.currency zero = Money.ZEROS[currency] inf = Money('inf', currency) diff --git a/www/%username/giving/pay/stripe/%payin_id.spt b/www/%username/giving/pay/stripe/%payin_id.spt index 9ed8d036c..59097965c 100644 --- a/www/%username/giving/pay/stripe/%payin_id.spt +++ b/www/%username/giving/pay/stripe/%payin_id.spt @@ -256,7 +256,7 @@ if tippees: if len(tips) == 1: proto_transfers = resolve_tip( website.db, tips[0], tips[0].tippee_p, 'stripe', payer, payer.guessed_country, - tips[0].periodic_amount + tips[0].amount * 52 ) if len(proto_transfers) == 1: if proto_transfers[0].destination.country not in constants.SEPA: