Commit 232d735
authored
fix(payments): add org membership check to top-up checkout (#1414)
## Summary
- Adds an organization authorization check to the top-up checkout route
(`/payments/topup`)
- Previously, any authenticated user could initiate a checkout for any
organization by passing an arbitrary `organization-id` query param
- Now uses `getAuthorizedOrgContext` to verify the user is a member of
the org (or an admin) before creating/reusing the org's Stripe customer
## Test plan
- [ ] Verify top-up works normally for a user's own account (no
`organization-id`)
- [ ] Verify top-up works for an org the user belongs to
- [ ] Verify top-up returns 404 when `organization-id` belongs to an org
the user is not a member of
- [ ] Verify admin users can still top up any org1 file changed
Lines changed: 11 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
63 | 64 | | |
64 | 65 | | |
65 | 66 | | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
70 | 77 | | |
71 | 78 | | |
72 | 79 | | |
| |||
0 commit comments