Fix sentry issue (#6719)
https://twenty-v7.sentry.io/issues/5677123076/?environment=prod&project=4507072499810304&query=is%3Aunresolved+issue.priority%3A%5Bhigh%2C+medium%5D&referrer=issue-stream&statsPeriod=7d&stream_index=12 Removes billing section when is_free_access_enabled
This commit is contained in:
@ -43,7 +43,7 @@ export class BillingResolver {
|
||||
@Args() { returnUrlPath }: BillingSessionInput,
|
||||
) {
|
||||
return {
|
||||
url: await this.billingPortalWorkspaceService.computeBillingPortalSessionURL(
|
||||
url: await this.billingPortalWorkspaceService.computeBillingPortalSessionURLOrThrow(
|
||||
user.defaultWorkspaceId,
|
||||
returnUrlPath,
|
||||
),
|
||||
|
||||
@ -65,18 +65,22 @@ export class BillingPortalWorkspaceService {
|
||||
return session.url;
|
||||
}
|
||||
|
||||
async computeBillingPortalSessionURL(
|
||||
async computeBillingPortalSessionURLOrThrow(
|
||||
workspaceId: string,
|
||||
returnUrlPath?: string,
|
||||
) {
|
||||
const currentSubscriptionItem =
|
||||
const currentSubscription =
|
||||
await this.billingSubscriptionService.getCurrentBillingSubscriptionOrThrow(
|
||||
{
|
||||
workspaceId,
|
||||
},
|
||||
);
|
||||
|
||||
const stripeCustomerId = currentSubscriptionItem.stripeCustomerId;
|
||||
if (!currentSubscription) {
|
||||
throw new Error('Error: missing subscription');
|
||||
}
|
||||
|
||||
const stripeCustomerId = currentSubscription.stripeCustomerId;
|
||||
|
||||
if (!stripeCustomerId) {
|
||||
throw new Error('Error: missing stripeCustomerId');
|
||||
|
||||
Reference in New Issue
Block a user