🛂 (billing) Disable sub update when workspace is past due
This commit is contained in:
@@ -49,7 +49,7 @@ export const updateSubscription = authenticatedProcedure
|
|||||||
id: workspaceId,
|
id: workspaceId,
|
||||||
},
|
},
|
||||||
select: {
|
select: {
|
||||||
isQuarantined: true,
|
isPastDue: true,
|
||||||
stripeId: true,
|
stripeId: true,
|
||||||
members: {
|
members: {
|
||||||
select: {
|
select: {
|
||||||
@@ -59,6 +59,12 @@ export const updateSubscription = authenticatedProcedure
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
if (workspace?.isPastDue)
|
||||||
|
throw new TRPCError({
|
||||||
|
code: 'BAD_REQUEST',
|
||||||
|
message:
|
||||||
|
'You have unpaid invoices. Please head over your billing portal to pay it.',
|
||||||
|
})
|
||||||
if (
|
if (
|
||||||
!workspace?.stripeId ||
|
!workspace?.stripeId ||
|
||||||
isAdminWriteWorkspaceForbidden(workspace, user)
|
isAdminWriteWorkspaceForbidden(workspace, user)
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ export const DashboardHeader = () => {
|
|||||||
/>
|
/>
|
||||||
</Link>
|
</Link>
|
||||||
<HStack>
|
<HStack>
|
||||||
{user && workspace && (
|
{user && workspace && !workspace.isPastDue && (
|
||||||
<WorkspaceSettingsModal
|
<WorkspaceSettingsModal
|
||||||
isOpen={isOpen}
|
isOpen={isOpen}
|
||||||
onClose={onClose}
|
onClose={onClose}
|
||||||
@@ -45,6 +45,7 @@ export const DashboardHeader = () => {
|
|||||||
workspace={workspace}
|
workspace={workspace}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
{!workspace?.isPastDue && (
|
||||||
<Button
|
<Button
|
||||||
leftIcon={<SettingsIcon />}
|
leftIcon={<SettingsIcon />}
|
||||||
onClick={onOpen}
|
onClick={onOpen}
|
||||||
@@ -52,6 +53,7 @@ export const DashboardHeader = () => {
|
|||||||
>
|
>
|
||||||
{t('dashboard.header.settingsButton.label')}
|
{t('dashboard.header.settingsButton.label')}
|
||||||
</Button>
|
</Button>
|
||||||
|
)}
|
||||||
<WorkspaceDropdown
|
<WorkspaceDropdown
|
||||||
currentWorkspace={workspace}
|
currentWorkspace={workspace}
|
||||||
onLogoutClick={logOut}
|
onLogoutClick={logOut}
|
||||||
|
|||||||
Reference in New Issue
Block a user