ZIm/crates/collab/src
Marshall Bowers 66121fa0e8
collab: Add endpoint for managing a billing subscription (#15455)
This PR adds a new `POST /billing/subscriptions/manage` endpoint that
can be used to manage a billing subscription.

The endpoint accepts a `github_user_id` to identify the user, as well as
an optional `subscription_id` for managing a specific subscription. If
`subscription_id` is not provided, it try and use the active
subscription, if there is only one.

Right now the endpoint only supports cancelling an active subscription.
This is done by passing `"intent": "cancel"` in the request body.

The endpoint will return the URL to a Stripe customer portal session,
which the caller can redirect the user to.

Here's an example of how to call it:

```sh
curl -X POST "http://localhost:8080/billing/subscriptions/manage" \
     -H "Authorization: <ADMIN_TOKEN>" \
     -H "Content-Type: application/json" \
     -d '{"github_user_id": 12345, "intent": "cancel"}'
```

Release Notes:

- N/A
2024-07-29 20:05:17 -04:00
..
api collab: Add endpoint for managing a billing subscription (#15455) 2024-07-29 20:05:17 -04:00
bin Make it (a tiny bit) easier to run your own collab (#9557) 2024-03-20 21:00:02 -06:00
db collab: Add endpoint for managing a billing subscription (#15455) 2024-07-29 20:05:17 -04:00
rpc remoting: Allow Add/Remove remote folder (#14532) 2024-07-16 12:01:59 -06:00
tests collab: Add endpoint for initiating a billing subscription (#15452) 2024-07-29 17:31:36 -04:00
api.rs collab: Add endpoint for initiating a billing subscription (#15452) 2024-07-29 17:31:36 -04:00
auth.rs Upgrade base64 to v0.22 (#15304) 2024-07-26 17:40:38 -04:00
completion.rs Supermaven (#10788) 2024-05-03 12:50:42 -07:00
db.rs collab: Add billing_subscriptions table (#15448) 2024-07-29 14:32:13 -04:00
env.rs Add an extensions API to the collaboration server (#7807) 2024-02-15 12:53:57 -08:00
errors.rs Remove more unused code related to GitHub auth and errors 2022-04-21 08:57:49 -06:00
executor.rs Remove 2 suffix for collab, rope, settings, menu 2024-01-03 12:29:16 -08:00
lib.rs collab: Add endpoint for initiating a billing subscription (#15452) 2024-07-29 17:31:36 -04:00
main.rs fix: Typos (#15313) 2024-07-26 17:52:37 -07:00
rate_limiter.rs Fix logic errors in RateLimiter (#12421) 2024-05-29 12:05:40 +02:00
rpc.rs assistant: Allow guests to create new contexts on the host (#15439) 2024-07-29 12:01:09 -04:00
seed.rs Make it (a tiny bit) easier to run your own collab (#9557) 2024-03-20 21:00:02 -06:00
tests.rs Add the ability to edit remote directories over SSH (#14530) 2024-07-19 10:27:26 -07:00