File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,22 +28,22 @@ export const getFsUser: UserRetriever = async () => {
2828 // Todo: fill me
2929} ;
3030
31- function getCreditsForPurchase ( fsPurchase : PurchaseInfo ) : number {
31+ function getEntitledCredits ( fsPurchase : PurchaseInfo ) : number {
3232 const credits = resourceRecord [ pricingToResourceMap [ fsPurchase . pricingId ] ] ?? 0 ;
3333
3434 // Return sum total of 12 months of credits if annual billing cycle
3535 return fsPurchase . isAnnual ( ) ? credits * 12 : credits ;
3636}
3737
38- async function processEntitlementFromPurchase ( user : User , fsPurchase : PurchaseInfo ) : Promise < number > {
38+ async function getCreditsForUserPurchase ( user : User , fsPurchase : PurchaseInfo ) : Promise < number > {
3939 let credits = 0 ;
4040
4141 const isExisting = await prisma . userFsEntitlement . findUnique ( {
4242 where : { fsLicenseId : fsPurchase . licenseId } ,
4343 } ) ;
4444
4545 if ( ! isExisting ) {
46- credits = getCreditsForPurchase ( fsPurchase ) ;
46+ credits = getEntitledCredits ( fsPurchase ) ;
4747 }
4848
4949 // Save purchase info in our DB
@@ -73,7 +73,7 @@ export async function renewCreditsFromWebhook(fsLicenseId: string): Promise<void
7373 const purchaseInfo = await freemius . purchase . retrievePurchase ( fsLicenseId ) ;
7474
7575 if ( purchaseInfo ) {
76- const credits = getCreditsForPurchase ( purchaseInfo ) ;
76+ const credits = getEntitledCredits ( purchaseInfo ) ;
7777
7878 const entitlement = await prisma . userFsEntitlement . findUnique ( {
7979 where : { fsLicenseId } ,
You can’t perform that action at this time.
0 commit comments