ÁSZF consent on Stripe's page off until the opening (TERMS_CONSENT)
CI / test (push) Successful in 1m28s
CI / build (push) Successful in 5m2s
CI / deploy (push) Skipped

Stripe refuses the terms consent until the terms URL is set in its
Public details, so purchases would fail. TERMS_CONSENT=false (the
default) leaves the consent out; then the package cards do not mention
the withdrawal waiver and no purchase confirmation is sent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
feco
2026-11-20 14:03:12 +00:00
co-authored by Claude Opus 5.5
parent e326095f3f
commit 54af54cd39
9 changed files with 58 additions and 16 deletions
+8
View File
@@ -2312,6 +2312,7 @@ async fn stripe_checkout_grants_the_paid_package_once(pool: PgPool) {
assert_eq!(r.body["payments"], "stripe");
assert_eq!(r.body["payments_test"], false);
assert_eq!(r.body["vat"], "AAM");
assert_eq!(r.body["terms_consent"], true);
// Stripe replaces the stand-in payment.
assert_eq!(r.body["mock_payments"], false);
let anna = app.register("anna@example.com", "Anna").await;
@@ -2549,14 +2550,21 @@ async fn stripe_purchases_wait_for_the_opening(pool: PgPool) {
let app = TestApp::with_config(pool, |c| {
with_stripe(c, "sk_live_fake");
c.purchases_open = false;
c.terms_consent = false;
})
.await;
let r = app.get("/v1/config", None).await;
assert_eq!((&r.body["payments_test"], &r.body["payments_admins_only"]), (&json!(false), &json!(true)));
assert_eq!(r.body["terms_consent"], false);
let anna = app.register("anna@example.com", "Anna").await;
let r = app.post("/v1/payments/checkout", Some(&anna), json!({"package": "single"})).await;
assert_eq!(r.status, StatusCode::FORBIDDEN);
let admin = app.register("admin@example.com", "Admin").await;
let r = app.post("/v1/payments/checkout", Some(&admin), json!({"package": "single"})).await;
assert_eq!(r.status, StatusCode::OK, "{}", r.body);
// Until the opening Stripe's page does not ask for the ÁSZF (TERMS_CONSENT).
let id = r.body["url"].as_str().unwrap().rsplit('/').next().unwrap().to_string();
assert_eq!(stripe_form(&id, "billing_address_collection").as_deref(), Some("required"));
assert_eq!(stripe_form(&id, "consent_collection[terms_of_service]"), None);
assert_eq!(stripe_form(&id, "custom_text[terms_of_service_acceptance][message]"), None);
}