feat(billing): complimentary pro subscriptions that can be withdrawn #136

Sammanfogat
supernaut sammanfogade 2 incheckningar från feat/complimentary-subscriptions in i main 2026-10-12 08:55:28 +00:00
Ägare

An operator can give pro access for free and withdraw it later. Each grant records who has it, why, who granted it and until when.

  • New complimentary table (migration 0010_complimentary.sql). A grant has no customer, charge, invoice or provider object.
  • Granting adds tier_pro and drops the lower tiers. Withdrawing, now or by the sweep at the end date, revokes the same way a paid subscription ends. Ending access puts the user back in tier_participant.
  • A first payment does not end a grant. The grant stays live next to the subscription, so a later end of the payment leaves the user on pro.
  • Grants and revokes for one user take a transaction-scoped advisory lock on the username. A revoke can no longer miss a concurrent payment or grant and remove tier_pro from a paying user.
  • The service and CLI start without a Mollie key while payments are disabled. A key that is set must still be a test key.

CLI in the container:

node dist/src/cli.js comp grant <username> --reason "..." --by <operator> [--until YYYY-MM-DD]
node dist/src/cli.js comp list [--all]
node dist/src/cli.js comp withdraw <username>

Version 0.11.0. 436 tests pass.

Closes #134

An operator can give pro access for free and withdraw it later. Each grant records who has it, why, who granted it and until when. - New `complimentary` table (migration `0010_complimentary.sql`). A grant has no customer, charge, invoice or provider object. - Granting adds `tier_pro` and drops the lower tiers. Withdrawing, now or by the sweep at the end date, revokes the same way a paid subscription ends. Ending access puts the user back in `tier_participant`. - A first payment does not end a grant. The grant stays live next to the subscription, so a later end of the payment leaves the user on pro. - Grants and revokes for one user take a transaction-scoped advisory lock on the username. A revoke can no longer miss a concurrent payment or grant and remove `tier_pro` from a paying user. - The service and CLI start without a Mollie key while payments are disabled. A key that is set must still be a test key. CLI in the container: ``` node dist/src/cli.js comp grant <username> --reason "..." --by <operator> [--until YYYY-MM-DD] node dist/src/cli.js comp list [--all] node dist/src/cli.js comp withdraw <username> ``` Version 0.11.0. 436 tests pass. Closes #134
supernaut lade till 2 incheckningar 2026-10-12 08:52:20 +00:00
An operator can grant pro access for free and withdraw it, with a record
of who has it, why and until when. A grant is a row in the new
`complimentary` table, with no customer, charge, invoice or provider
object.

Grant adds tier_pro and drops the lower tiers through the paid grant.
Withdraw, now or by the sweep at the end date, revokes as a paid end
does. A paid first payment ends a live grant. Operators use a CLI in the
container: `node dist/src/cli.js comp grant|list|withdraw`.

The service and CLI start without a Mollie key while payments are
disabled. A set key must still be a test key. Ending access now also
puts the user back in tier_participant.

Closes #134
fix(billing): serialise tier writes per user and keep grants after payment
Alla kontroller lyckades
ci / ci (pull_request) Successful in 2m0s
469bb83e0c
Grants and revokes for one user now take a transaction-scoped advisory
lock on the username. A revoke can no longer count a concurrent first
payment or grant as not live and remove tier_pro from a paying user.

A first payment no longer ends a complimentary grant. The grant stays
live next to the paid subscription, so ending the payment leaves the
user on pro. Only a withdrawal or the end date ends it.
supernaut sammanfogade incheckning 63a9a64aa8 till main 2026-10-12 08:55:28 +00:00
supernaut tog bort grenen feat/complimentary-subscriptions 2026-10-12 08:55:29 +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!136
Ingen beskrivning angiven.