chore: fix type error

This commit is contained in:
Bereket Engida
2025-03-03 19:51:41 +03:00
parent e122692b52
commit 6c4368ccfd
2 changed files with 3 additions and 3 deletions

View File

@@ -43,7 +43,7 @@ export async function onCheckoutSessionCompleted(
periodEnd: new Date(subscription.current_period_end * 1000),
stripeSubscriptionId: checkoutSession.subscription as string,
seats,
stripeCustomerId: subscription.customer.toString(),
...trial,
},
where: [
@@ -97,7 +97,7 @@ export async function onSubscriptionUpdated(
const plan = await getPlanByPriceId(options, priceId);
const referenceId = subscriptionUpdated.metadata?.referenceId;
const customerId = subscriptionUpdated.customer.toString();
const customerId = subscriptionUpdated.customer?.toString();
let subscription = await ctx.context.adapter.findOne<Subscription>({
model: "subscription",
where: referenceId
@@ -133,7 +133,6 @@ export async function onSubscriptionUpdated(
periodStart: new Date(subscriptionUpdated.current_period_start * 1000),
periodEnd: new Date(subscriptionUpdated.current_period_end * 1000),
cancelAtPeriodEnd: subscriptionUpdated.cancel_at_period_end,
stripeCustomerId: subscriptionUpdated.customer.toString(),
seats,
stripeSubscriptionId: subscriptionUpdated.id,
},

View File

@@ -341,6 +341,7 @@ describe("stripe", async () => {
},
],
});
expect(updatedSubscription).toMatchObject({
id: testSubscriptionId,
status: "active",