feat(billing): keep the billing email apart from the account email #126

Sammanfogat
supernaut sammanfogade 2 incheckningar från feat/billing-email in i main 2026-10-09 13:05:57 +00:00
Ägare

Closes #112.

What

  • The checkout upsert no longer overwrites customer.billing_email on conflict. A first checkout still sets it.
  • New tRPC mutation updateBillingEmail: input { kanidmUser, email }, output { email }. An unknown customer gives NOT_FOUND (no_subscription). Same bearer auth and moving gate as cancel and withdraw.
  • Renewal invoices read the billing email at issue time, so an edited address applies to the next invoice. Issued invoices keep their snapshot.
  • No migration: the column already exists.
  • Versions: root 0.9.0, contract 0.10.0.

Not in this PR

  • The portal edit form (bitborg-web follow-up).
  • The Mollie customer email stays the checkout-time value. Recurring charges use the mandate, not the email.

Tests

405 passed with TEST_DATABASE_URL. New: a second checkout keeps an edited billing email and the renewal invoice uses it; the route updates and refuses an unknown customer; contract schema accepts and rejects.

Closes #112. ## What - The checkout upsert no longer overwrites `customer.billing_email` on conflict. A first checkout still sets it. - New tRPC mutation `updateBillingEmail`: input `{ kanidmUser, email }`, output `{ email }`. An unknown customer gives `NOT_FOUND` (`no_subscription`). Same bearer auth and `moving` gate as `cancel` and `withdraw`. - Renewal invoices read the billing email at issue time, so an edited address applies to the next invoice. Issued invoices keep their snapshot. - No migration: the column already exists. - Versions: root 0.9.0, contract 0.10.0. ## Not in this PR - The portal edit form (bitborg-web follow-up). - The Mollie customer email stays the checkout-time value. Recurring charges use the mandate, not the email. ## Tests 405 passed with `TEST_DATABASE_URL`. New: a second checkout keeps an edited billing email and the renewal invoice uses it; the route updates and refuses an unknown customer; contract schema accepts and rejects.
supernaut lade till 2 incheckningar 2026-10-09 12:56:47 +00:00
supernaut sammanfogade incheckning d347159f4f till main 2026-10-09 13:05:57 +00:00
supernaut tog bort grenen feat/billing-email 2026-10-09 13:05:57 +00:00
Logga in för att delta i denna konversation.
Inga granskare
Ingen milstolpe
Inget projekt
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Förfallodatumet är ogiltigt eller utanför gränserna. Använd formatet "åååå-mm-dd".

Inget förfallodatum satt.

Beroenden

Inga beroenden satta

Referens
bitborg/bitborg-payment!126
Ingen beskrivning angiven.