-
Notifications
You must be signed in to change notification settings - Fork 210
Remove: BillingPlan hardcoded constant #2737
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: billing-sdk-refactor
Are you sure you want to change the base?
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Console (appwrite/console)Project ID: Tip HTTPS and SSL certificates are handled automatically for all your Sites |
lohanidamodar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gone through probably 30% of the files
looks generally good.
Let's also make sure to replace organization.billingPlan with organization.billingPlanId so that later migration is easier .
| </script> | ||
|
|
||
| {#if $organization?.$id && $organization?.billingPlan === BillingPlan.FREE && $readOnly && !hideBillingHeaderRoutes.includes(page.url.pathname)} | ||
| {#if $organization?.$id && !$organization?.billingPlanDetails.usage && $readOnly && !hideBillingHeaderRoutes.includes(page.url.pathname)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make sure properly with test that negation in conditions are all tested correctly. these are all very complex conditions
| } | ||
| onMount(() => { | ||
| // fast path: don't subscribe if org is on a free plan or is self-hosted. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix comment.
| const plans = $derived(Object.values(page.data.plans.plans) as Models.BillingPlan[]); | ||
| const currentPlanInList = $derived(plans.some((plan) => plan.$id === $currentPlan?.$id)); | ||
| // experiment to remove scale plan temporarily |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after latest changes this should be hidden from BE
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why two components selectPlan and planSelection?
| organization?.billingPlan === BillingPlan.FREE || | ||
| organization?.billingPlan === BillingPlan.GITHUB_EDUCATION | ||
| ); | ||
| // 0 priced plans don't need payment methods! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix comment
| {#if selectedOrgId && (selectedOrg?.billingPlan !== BillingPlan.PRO || !selectedOrg?.paymentMethodId)} | ||
|
|
||
| <!-- show invite members --> | ||
| {#if selectedOrgId && (!selectedOrg?.billingPlanDetails.addons.seats.supported || !selectedOrg?.paymentMethodId)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to check .paymentMethodId here?
| </Fieldset> | ||
| {#if (selectedOrgId && (selectedOrg?.billingPlan !== BillingPlan.PRO || !selectedOrg?.paymentMethodId)) || (!data?.couponData?.code && selectedOrgId)} | ||
|
|
||
| {#if (selectedOrgId && (!selectedOrg?.billingPlanDetails.requiresPaymentMethod || !selectedOrg?.paymentMethodId)) || (!data?.couponData?.code && selectedOrgId)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks complex, see if can be simplified

What does this PR do?
Removes the hardcoded checks.
Test Plan
N/A.
Related PRs and Issues
Have you read the Contributing Guidelines on issues?
Yes.