Repository navigation
feat: credit codes + invites (pro_days onto a practice's paid plan), CLI/MCP 0.5.0 - #29
Merged
Merged
Conversation
…CLI/MCP 0.5.0 - @profullstack/redeem-credits 0.2.0: codes grant pro_days. "Have a code?" on Billing redeems straight onto the practice (owner/org manager) and moves org_billing.paid_through, the column a CoinPay payment extends; a trial's remaining days are kept. Unapplied days wait in a balance. API: GET /credits, POST /credits/redeem, POST /orgs/:org/billing/apply-credits. Minting is staff-only: apps/web/scripts/mint-credit-code.js. - @profullstack/affiliates 0.3.0: 3 invites per account (/app/invites, /invites, GET|POST /invites). /i/<code> sets th_invite and links to signup; /auth/link stores the invite on the emailed link (another device counts) and /auth/magic accepts it only when that link creates the account. New accounts (7 days) can also accept by code (POST /invites/accept). 7 pro_days each side, paid only when redeemInvite() succeeds; no throwaway domains, no +tag/Gmail-dot alias of another account; inviter side capped at 3 a month; invite_bonuses has one row per invitee. /i/ is outside the crawl gate. - CLI: tleehealth redeem | credits [--apply] | invite | invites. MCP: redeem_credit_code, get_credits, create_invite. 0.5.0. - Migration 0008: login_tokens.invite, invite_bonuses. No health data touched. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Credit codes (@profullstack/redeem-credits 0.2.0) and invites (@profullstack/affiliates 0.3.0).
What a code grants:
pro_days, days of a practice's paid plan ($10/seat/mo, max $199). Redeemed on Billing by an owner or org manager, the days moveorg_billing.paid_throughforward: the same column a CoinPay payment extends (a practice still in its trial keeps the trial; paid time starts when it ends). Days not yet applied (invite bonuses,--keep) wait in a per-user balance and are added under Billing.docker exec tleehealthcom-app-1 bun apps/web/scripts/mint-credit-code.js --days 30 [--max N] [--expires-days N] [--label ...], plus--list/--revokePOST /api/v1/credits/redeem {code, org_id?}(the practice is checked before the code is spent),POST /orgs/:org/billing/apply-credits {days},GET /credits; CLItleehealth redeem|credits; MCPredeem_credit_code,get_creditsGET|POST /api/v1/invites,POST /invites/accept; CLItleehealth invite|invites; MCPcreate_invite/i/<code>setsth_inviteand links to signup./auth/linkstores the invite on the emailed link (login_tokens.invite), so opening it on another device still counts;/auth/magicaccepts it only when that link creates the account (xmax = 0). New accounts (7 days) can also accept by code.redeemInvite().ok(never pre-checkinginvitedBy()); no throwaway domains, no +tag/Gmail-dot alias of another account; inviter side max 3 a month;invite_bonuseshas one row per invitee. Every account here is email-verified (the magic link made it)./i/is an open path in the crawl gate. No health data is read or written.Security sweep (rules 10/11): identity comes only from the session cookie or a
th_live_key; no admin-by-email; nonext=redirects;PATCH /mewrites onlyname; org_billing is written only by the signed webhook (empty secret refuses). Nothing to fix.Migration 0008 (login_tokens.invite, invite_bonuses) dry-run on prod in a rolled-back transaction; tables backed up. Tests:
bun test134/134 on a fresh Postgres (8 new incl. a concurrent double-accept: one wins, the otheralready_invited, left unused). master: 126/126.🤖 Generated with Claude Code