(bearer: string)
| 33 | /** The org the bearer is scoped to — the Autumn customer id every billing call |
| 34 | * is made against — read from the JWT's public claims. */ |
| 35 | const orgIdOf = (bearer: string): string => { |
| 36 | const claims = JSON.parse(Buffer.from(bearer.split(".")[1] ?? "", "base64url").toString()) as { |
| 37 | readonly org_id?: string; |
| 38 | }; |
| 39 | if (!claims.org_id) throw new Error("orgIdOf: bearer carries no org_id claim"); |
| 40 | return claims.org_id; |
| 41 | }; |
| 42 | |
| 43 | scenario( |
| 44 | "Billing · the billed seat count reaches Autumn: active members only, reconciled not incremented", |
no test coverage detected