Skip to content

Commit e458c8c

Browse files
committed
[fix] [credit] Properly assign annual credits
1 parent ccee27f commit e458c8c

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/lib/user-entitlement.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ export async function processPurchaseInfo(fsPurchase: PurchaseInfo): Promise<voi
3131
}
3232

3333
function getCreditsForPurchase(fsPurchase: PurchaseInfo): number {
34-
return resourceRecord[pricingToResourceMap[fsPurchase.pricingId]] ?? 0;
34+
const credits = resourceRecord[pricingToResourceMap[fsPurchase.pricingId]] ?? 0;
35+
36+
// Return sum total of 12 months of credits if annual billing cycle
37+
return fsPurchase.isAnnual() ? credits * 12 : credits;
3538
}
3639

3740
async function processEntitlementFromPurchase(user: User, fsPurchase: PurchaseInfo): Promise<number> {

0 commit comments

Comments
 (0)