Set optional checkout.session.url (#4569)
* Set optional checkout.session.url * Lint * Edit .env.example * Vale CI --------- Co-authored-by: Félix Malfait <felix.malfait@gmail.com>
This commit is contained in:
@ -131,10 +131,13 @@ export class BillingService {
|
||||
workspaceId: string,
|
||||
returnUrlPath?: string,
|
||||
) {
|
||||
const billingSubscription =
|
||||
await this.billingSubscriptionRepository.findOneOrFail({
|
||||
where: { workspaceId },
|
||||
});
|
||||
const billingSubscription = await this.getCurrentBillingSubscription({
|
||||
workspaceId,
|
||||
});
|
||||
|
||||
if (!billingSubscription) {
|
||||
return;
|
||||
}
|
||||
|
||||
const frontBaseUrl = this.environmentService.get('FRONT_BASE_URL');
|
||||
const returnUrl = returnUrlPath
|
||||
@ -190,10 +193,9 @@ export class BillingService {
|
||||
}
|
||||
|
||||
async deleteSubscription(workspaceId: string) {
|
||||
const subscriptionToCancel =
|
||||
await this.billingSubscriptionRepository.findOneBy({
|
||||
workspaceId,
|
||||
});
|
||||
const subscriptionToCancel = await this.getCurrentBillingSubscription({
|
||||
workspaceId,
|
||||
});
|
||||
|
||||
if (subscriptionToCancel) {
|
||||
await this.stripeService.cancelSubscription(
|
||||
|
||||
@ -2,6 +2,6 @@ import { Field, ObjectType } from '@nestjs/graphql';
|
||||
|
||||
@ObjectType()
|
||||
export class SessionEntity {
|
||||
@Field(() => String)
|
||||
@Field(() => String, { nullable: true })
|
||||
url: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user