Skip to content

Commit

Permalink
Merge pull request #117 from internxt/fix/return-trialing-subscriptions
Browse files Browse the repository at this point in the history
[PB-3066]: fix/return active and trialing subscriptions
  • Loading branch information
sg-gs authored Oct 15, 2024
2 parents cd9bb2d + 0048a42 commit f8d9fbd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/services/PaymentService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,6 @@ export class PaymentService {
async getActiveSubscriptions(customerId: CustomerId): Promise<ExtendedSubscription[]> {
const res = await this.provider.subscriptions.list({
customer: customerId,
status: 'active',
expand: ['data.default_payment_method', 'data.default_source', 'data.plan.product'],
});

Expand All @@ -424,7 +423,11 @@ export class PaymentService {
return subscription;
});

return transformedData;
const activeOrTrialingSubscriptions = transformedData.filter(
(subscription) => subscription.status === 'active' || subscription.status === 'trialing',
);

return activeOrTrialingSubscriptions;
}

/**
Expand Down

0 comments on commit f8d9fbd

Please sign in to comment.