Count failed payments as "open" charges (#4013)

This allows people to cancel failed payments, currently it fails with error "There is no open charge for this subscription"
This commit is contained in:
Emma Alexia
2025-07-19 10:33:37 -04:00
committed by GitHub
parent 526561f2de
commit bcf46d440b
2 changed files with 3 additions and 3 deletions

View File

@@ -197,7 +197,7 @@ impl DBCharge {
) -> Result<Option<DBCharge>, DatabaseError> {
let user_subscription_id = user_subscription_id.0;
let res = select_charges_with_predicate!(
"WHERE subscription_id = $1 AND (status = 'open' OR status = 'cancelled')",
"WHERE subscription_id = $1 AND (status = 'open' OR status = 'cancelled' OR status = 'failed')",
user_subscription_id
)
.fetch_optional(exec)