-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add self serve billing management UI #5431
Changes from 1 commit
2440f32
acb2da5
44a38ab
475dbd0
441e0bf
662bfee
418e180
376cbaa
96d26a0
72e6508
1f71f66
fade30f
83ae354
e5af9dd
c337e64
a16c1f7
6ba3913
b60caca
368dd77
ebc8e6e
7730520
5a3105c
c4ea1c3
8310b96
df1f20b
9752b05
fc7e934
3dabb6a
1d61d74
e993973
1e5f1dd
d4b790c
79f4874
883738d
2198ea1
599d568
7560fa8
3613cc3
9c2b883
cfe2460
98e75c8
187bb17
d2148b1
c4d546b
e382acc
c6389c2
e49a3d8
24acbb9
d65af0d
3d0718c
de504fe
f6fc368
ab7e0f1
323699b
472e5de
dfd796b
1be4252
4c04d87
a671dd4
5674229
8ec01f5
6d57a5c
4b87ed9
8dcd55b
f4301e5
a8e41c2
d6ce8c4
0d774ea
06c444c
c535b01
035155b
87b95ae
2af7c7d
4b14bf3
7c5ba24
52df6b5
0dc2a39
691c99a
1deb7fb
15132a4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The calls to
1 might be safer & easier, but 2 is probably better long-term. |
AdityaHegde marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,11 @@ export const load: PageLoad = async ({ params: { organization }, url }) => { | |
`${url.protocol}//${url.host}/${organization}`, | ||
); | ||
} catch (e) { | ||
if (e.response?.status !== 403 || (await redirectToLoginIfNotLoggedIn())) { | ||
if (e.response?.status !== 403) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should throw the error when it's a 403 too |
||
throw error(e.response.status, "Error redirecting to payment portal"); | ||
} | ||
const didRedirect = await redirectToLoginIfNotLoggedIn(); | ||
if (!didRedirect) { | ||
throw error(e.response.status, "Error redirecting to payment portal"); | ||
} | ||
} | ||
|
AdityaHegde marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,24 @@ | ||
import { redirectToLoginIfNotLoggedIn } from "@rilldata/web-admin/features/authentication/checkUserAccess"; | ||
import { getPaymentIssues } from "@rilldata/web-admin/features/billing/issues/getMessageForPaymentIssues"; | ||
import { fetchPaymentsPortalURL } from "@rilldata/web-admin/features/billing/plans/selectors"; | ||
import { fetchOrganizationBillingIssues } from "@rilldata/web-admin/features/billing/selectors"; | ||
import { error, redirect } from "@sveltejs/kit"; | ||
import { redirect } from "@sveltejs/kit"; | ||
import type { PageLoad } from "./$types"; | ||
|
||
export const load: PageLoad = async ({ params: { organization }, url }) => { | ||
let redirectUrl = `/${organization}`; | ||
try { | ||
const issues = await fetchOrganizationBillingIssues(organization); | ||
const paymentIssues = getPaymentIssues(issues); | ||
if (paymentIssues.length) { | ||
redirectUrl = await fetchPaymentsPortalURL( | ||
export const load: PageLoad = async ({ | ||
params: { organization }, | ||
url, | ||
parent, | ||
}) => { | ||
const { issues } = await parent(); | ||
const paymentIssues = getPaymentIssues(issues); | ||
if (paymentIssues.length) { | ||
throw redirect( | ||
307, | ||
await fetchPaymentsPortalURL( | ||
organization, | ||
`${url.protocol}//${url.host}/${organization}`, | ||
); | ||
} else { | ||
redirectUrl = `/${organization}/-/settings/billing/callback`; | ||
} | ||
} catch (e) { | ||
if (e.response?.status !== 403 || (await redirectToLoginIfNotLoggedIn())) { | ||
throw error(e.response.status, "Error fetching billing issues"); | ||
} | ||
), | ||
); | ||
} else { | ||
throw redirect(307, `/${organization}/-/settings/billing/callback`); | ||
} | ||
throw redirect(307, redirectUrl); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you uncomment this, just remove the `Plan Name' from template no harm in that, once Eric O is back we can discuss.