feat: add new subscription tier and update credit configurations
- Introduced a new "max" subscription tier with associated monthly credits and top-up limits. - Updated existing subscription tiers' monthly credits and top-up limits for "starter", "pro", and "business". - Enhanced credit display and overview components to reflect the new tier and its attributes. - Integrated Polar authentication features for improved subscription management and credit handling.
This commit is contained in:
14
lib/topup-calculator.ts
Normal file
14
lib/topup-calculator.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
export function calculateCustomTopup(euroAmount: number): {
|
||||
credits: number;
|
||||
bonusRate: number;
|
||||
} {
|
||||
const bonusRate =
|
||||
euroAmount >= 100 ? 0.13 :
|
||||
euroAmount >= 50 ? 0.10 :
|
||||
euroAmount >= 20 ? 0.06 :
|
||||
euroAmount >= 10 ? 0.03 : 0;
|
||||
|
||||
const netAmount = euroAmount / 1.19;
|
||||
const credits = Math.floor((netAmount * 0.70 * (1 + bonusRate)) / 0.01);
|
||||
return { credits, bonusRate };
|
||||
}
|
||||
Reference in New Issue
Block a user