Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/common/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,20 @@ export const deleteUser = async (
}

if (subscriptionFlags?.provider === SubscriptionProvider.Paddle) {
await cancelSubscription({
subscriptionId: subscriptionFlags.subscriptionId,
});
const isGifted = !!subscriptionFlags.giftExpirationDate;
// gifted subscription is a one-time payment hence not considered subscription in Paddle's terms
if (!isGifted) {
await cancelSubscription({
subscriptionId: subscriptionFlags.subscriptionId,
});
}
logger.info(
{
provider: SubscriptionProvider.Paddle,
userId,
subscriptionId: subscriptionFlags.subscriptionId,
},
'Subscription cancelled user deletion',
`Subscription${isGifted ? ' (gifted)' : ''} cancelled user deletion`,
Copy link
Contributor

@capJavert capJavert May 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of modifying string you can pass isGifted as property to log, more easily queryable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, right. Yeah, that is better.

);
}
}
Expand Down
Loading