From 54af54cd393b5217458f6841b92233c53a8d93c4 Mon Sep 17 00:00:00 2001 From: feco Date: Fri, 20 Nov 2026 14:03:12 +0000 Subject: [PATCH] =?UTF-8?q?=C3=81SZF=20consent=20on=20Stripe's=20page=20of?= =?UTF-8?q?f=20until=20the=20opening=20(TERMS=5FCONSENT)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL --- deploy/docker-compose.yml | 3 +++ docker-compose.yml | 1 + docs/fizetes.md | 4 +-- services/backend/src/config.rs | 6 +++++ services/backend/src/routes/mod.rs | 2 ++ services/backend/src/routes/payments.rs | 23 ++++++++++------- services/backend/src/tests.rs | 8 ++++++ .../frontend/src/components/PackageCards.tsx | 25 +++++++++++++++---- services/frontend/src/lib/types.ts | 2 ++ 9 files changed, 58 insertions(+), 16 deletions(-) diff --git a/deploy/docker-compose.yml b/deploy/docker-compose.yml index e2d30d2..67a8084 100644 --- a/deploy/docker-compose.yml +++ b/deploy/docker-compose.yml @@ -91,6 +91,9 @@ services: # Stripe purchases for everyone (false: admins only, until the opening; # with a test key always admins only). PURCHASES_OPEN: ${PURCHASES_OPEN:-false} + # Buyers accept the ÁSZF on Stripe's page (needs the terms URL in + # Stripe's Public details): off until the opening. + TERMS_CONSENT: ${TERMS_CONSENT:-false} # VAT on the invoices: AAM (alanyi adómentes) or a rate like 27%. INVOICE_VAT: ${INVOICE_VAT:-AAM} # Users inviting others ("Meghívom"): shown but off until the launch. diff --git a/docker-compose.yml b/docker-compose.yml index f19fd64..874d19f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -58,6 +58,7 @@ services: # Stripe purchases for everyone (false: admins only, until the opening; # with a test key always admins only). PURCHASES_OPEN: ${PURCHASES_OPEN:-false} + TERMS_CONSENT: ${TERMS_CONSENT:-false} # VAT on the invoices: AAM (alanyi adómentes) or a rate like 27%. INVOICE_VAT: ${INVOICE_VAT:-AAM} FREE_PERSON_SLOTS: ${FREE_PERSON_SLOTS:-0} diff --git a/docs/fizetes.md b/docs/fizetes.md index 6ac38a6..7459fe2 100644 --- a/docs/fizetes.md +++ b/docs/fizetes.md @@ -15,9 +15,9 @@ A csomagokat a Stripe Checkout fizetési oldalán lehet megvenni. A csomagok nev ## ÁSZF és elállási jog -Minden vásárlásnál a Stripe fizetési oldalán kötelező bepipálni: „Elfogadom az ÁSZF-et, kérem a szolgáltatás azonnali megkezdését, és tudomásul veszem, hogy ezzel elveszítem a 14 napos elállási jogomat.” (`consent_collection[terms_of_service]=required` és `custom_text[terms_of_service_acceptance]`). Digitális tartalomnál így szűnik meg az elállási jog (45/2014. Korm. rendelet 29. §). Ehhez **a Stripe felületén meg kell adni az ÁSZF címét** (Settings → Business → Public details → Terms of service: `https://sorsfonalak.hu/aszf`), különben a Stripe nem indítja el a fizetést. +**A megnyitásig ki van kapcsolva** (`TERMS_CONSENT=false`, az alapértelmezés): a Stripe nem kéri az elfogadást, a csomagkártyák nem írnak az elállási jogról, és visszaigazoló e-mail sem megy. Bekapcsolva (`TERMS_CONSENT=true` a `.env`-ben, a backend újraindításával) minden vásárlásnál a Stripe fizetési oldalán kötelező bepipálni: „Elfogadom az ÁSZF-et, kérem a szolgáltatás azonnali megkezdését, és tudomásul veszem, hogy ezzel elveszítem a 14 napos elállási jogomat.” (`consent_collection[terms_of_service]=required` és `custom_text[terms_of_service_acceptance]`). Digitális tartalomnál így szűnik meg az elállási jog (45/2014. Korm. rendelet 29. §). Ehhez **a Stripe felületén meg kell adni az ÁSZF címét** (Settings → Business → Public details → Terms of service: `https://sorsfonalak.hu/aszf`), különben a Stripe nem indítja el a fizetést. -Az elfogadás idejét és az ÁSZF változatát (`TERMS_VERSION`, a frontend `TERMS_UPDATED`-jével együtt kell léptetni) a `stripe_checkouts` sor őrzi (`terms_accepted_at`, `terms_version`). Fizetés után a backend visszaigazoló e-mailt küld (`purchase_confirmation`): a csomag, az összeg, a dátum és a lemondás az elállási jogról; ez a rendelet szerinti visszaigazolás. +Az elfogadás idejét és az ÁSZF változatát (`TERMS_VERSION`, a frontend `TERMS_UPDATED`-jével együtt kell léptetni) a `stripe_checkouts` sor őrzi (`terms_accepted_at`, `terms_version`). Elfogadott ÁSZF esetén fizetés után a backend visszaigazoló e-mailt küld (`purchase_confirmation`): a csomag, az összeg, a dátum és a lemondás az elállási jogról; ez a rendelet szerinti visszaigazolás. Az ÁSZF az `/aszf` oldalon van (`services/frontend/src/app/aszf/page.tsx`); a céges adatok a `lib/legal.ts`-ből jönnek. Megnyitás előtt jogásszal át kell nézetni. diff --git a/services/backend/src/config.rs b/services/backend/src/config.rs index 1c76bb1..aa585bf 100644 --- a/services/backend/src/config.rs +++ b/services/backend/src/config.rs @@ -58,6 +58,10 @@ pub struct Config { /// Until the opening only admins can (and with a test key always only /// admins), so nobody types a real card into a test or unfinished setup. pub purchases_open: bool, + /// `TERMS_CONSENT` (default `false`): Stripe's payment page asks every + /// buyer to accept the ÁSZF and give up the withdrawal right. Needs the + /// terms URL in Stripe's Public details; off until the opening. + pub terms_consent: bool, /// `USER_INVITES` (default `false`): users may invite others ("how /// compatible are we?" links, which also let the invitee sign up). Off /// until the launch; admins may always. @@ -187,6 +191,7 @@ impl Config { .trim_end_matches('/') .to_string(), purchases_open: parsed("PURCHASES_OPEN", false)?, + terms_consent: parsed("TERMS_CONSENT", false)?, user_invites: parsed("USER_INVITES", false)?, referral_rewards: parsed("REFERRAL_REWARDS", false)?, google_client_ids: list("GOOGLE_CLIENT_IDS"), @@ -231,6 +236,7 @@ impl Config { billingo_api_key: Some("billingo-fake".into()), billingo_api_url: format!("{horoscope_api_url}/billingo"), purchases_open: true, + terms_consent: true, user_invites: true, referral_rewards: true, google_client_ids: vec!["test-client.apps.googleusercontent.com".into()], diff --git a/services/backend/src/routes/mod.rs b/services/backend/src/routes/mod.rs index ccbf998..30f5dc1 100644 --- a/services/backend/src/routes/mod.rs +++ b/services/backend/src/routes/mod.rs @@ -175,6 +175,8 @@ async fn public_config(State(state): St) -> Json { "payments_test": c.stripe.as_ref().is_some_and(|s| s.test_mode()), // "AAM" (alanyi adómentes: the prices carry no VAT) or a rate like "27%". "vat": c.invoice_vat.code(), + // Buyers accept the ÁSZF on Stripe's page (off until the opening). + "terms_consent": c.terms_consent, "user_invites": c.user_invites, "referral_rewards": c.referral_rewards, "signup_mode": c.signup_mode.as_str(), diff --git a/services/backend/src/routes/payments.rs b/services/backend/src/routes/payments.rs index 8472dd6..40670f2 100644 --- a/services/backend/src/routes/payments.rs +++ b/services/backend/src/routes/payments.rs @@ -132,7 +132,7 @@ pub async fn checkout( let package = packages::find(&req.package).ok_or(ApiError::NotFound("package"))?; let back = format!("{}{}", state.config.public_base_url, return_path(req.return_path.as_deref())); let field = |k: &str, v: &str| (k.to_string(), v.to_string()); - let form = vec![ + let mut form = vec![ field("mode", "payment"), field("locale", "hu"), field("client_reference_id", &auth.id().to_string()), @@ -152,21 +152,23 @@ pub async fn checkout( field("metadata[user_id]", &auth.id().to_string()), field("payment_intent_data[description]", &format!("Sorsfonalak – {}", package.name)), field("payment_intent_data[metadata][package]", package.id), + field("success_url", &format!("{back}?fizetes={{CHECKOUT_SESSION_ID}}")), + field("cancel_url", &format!("{back}?fizetes=megszakitva")), + ]; + if state.config.terms_consent { // Every purchase accepts the terms and asks for immediate delivery, // giving up the 14-day withdrawal right (45/2014. Korm. rendelet 29. §). // Stripe needs the terms URL in its dashboard (Public details) for this. - field("consent_collection[terms_of_service]", "required"), - field( + form.push(field("consent_collection[terms_of_service]", "required")); + form.push(field( "custom_text[terms_of_service_acceptance][message]", &format!( "Elfogadom az [ÁSZF-et]({}/aszf), kérem a szolgáltatás azonnali megkezdését, és tudomásul veszem, \ hogy ezzel elveszítem a 14 napos elállási jogomat.", state.config.public_base_url ), - ), - field("success_url", &format!("{back}?fizetes={{CHECKOUT_SESSION_ID}}")), - field("cancel_url", &format!("{back}?fizetes=megszakitva")), - ]; + )); + } let session = state.stripe.create_session(config, &form).await?; let url = session.url.ok_or_else(|| ApiError::Internal(format!("checkout session {} has no url", session.id)))?; sqlx::query("INSERT INTO stripe_checkouts (id, user_id, package, price_huf, live) VALUES ($1, $2, $3, $4, $5)") @@ -210,7 +212,7 @@ async fn complete(state: &AppState, session: &stripe::Session) -> Result None, }; - if !session.terms_accepted() { + if state.config.terms_consent && !session.terms_accepted() { tracing::warn!(session = %session.id, "paid without the terms consent"); } sqlx::query( @@ -227,7 +229,10 @@ async fn complete(state: &AppState, session: &stripe::Session) -> Result `${n.toLocaleString("hu-HU")} Ft`; @@ -54,6 +54,16 @@ export function PackageCards({ window.addEventListener("pageshow", reset); return () => window.removeEventListener("pageshow", reset); }, []); + // Whether Stripe's page asks for the ÁSZF and the withdrawal waiver + // (TERMS_CONSENT, off until the opening). + const stripe = canPay === "stripe" || canPay === "stripe_test"; + const [termsConsent, setTermsConsent] = useState(false); + useEffect(() => { + if (!stripe) return; + api("/config") + .then((c) => setTermsConsent(c.terms_consent === true)) + .catch(() => {}); + }, [stripe]); const shown = ids ? ids.map((id) => packages.find((p) => p.id === id)).filter((p): p is Package => p !== undefined) : packages.filter((p) => p.tier === "main"); @@ -149,12 +159,17 @@ export function PackageCards({

)} {canPay === "mock" &&

Tesztüzem: a fizetés még nincs bekötve, a gomb nem terhel semmit.

} - {(canPay === "stripe" || canPay === "stripe_test") && ( + {stripe && (

A fizetés a Stripe biztonságos oldalán történik (bankkártya, Apple Pay, - Google Pay). A kártyaadataidat közvetlenül a Stripe-nak adod meg: mi nem látjuk és nem tároljuk őket. A - csomagot azonnal megkapod, ezért a fizetésnél kéred a teljesítés megkezdését, és ezzel lemondasz a 14 napos - elállási jogról. ÁSZF + Google Pay). A kártyaadataidat közvetlenül a Stripe-nak adod meg: mi nem látjuk és nem tároljuk őket. + {termsConsent && ( + <> + {" "} + A csomagot azonnal megkapod, ezért a fizetésnél kéred a teljesítés megkezdését, és ezzel lemondasz a 14 + napos elállási jogról. ÁSZF + + )}

)} {canPay === "stripe_test" && ( diff --git a/services/frontend/src/lib/types.ts b/services/frontend/src/lib/types.ts index aa5b334..08cf808 100644 --- a/services/frontend/src/lib/types.ts +++ b/services/frontend/src/lib/types.ts @@ -102,6 +102,8 @@ export interface PublicConfig { payments_test: boolean; /** "AAM": alanyi adómentes, the prices carry no VAT; otherwise the rate, e.g. "27%". */ vat: string; + /** Stripe's page asks for the ÁSZF and the withdrawal waiver (off until the opening). */ + terms_consent?: boolean; /** "invite": new accounts need an invitation. */ signup_mode: "invite" | "open"; /** Users may invite others (off until the launch; admins always may). */