From 9a8647a9cac69ee6fdff353605e66bbc94e732e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kevin=20Gr=C3=BCneberg?= Date: Thu, 19 Oct 2023 11:47:28 +0200 Subject: [PATCH] feat: partner billing plan upgrades (#18311) --- .../Subscription/PlanUpdateSidePanel.tsx | 39 ++++++++++++------- .../subscriptions/org-subscription-query.ts | 1 + 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/studio/components/interfaces/Organization/BillingSettingsV2/Subscription/PlanUpdateSidePanel.tsx b/studio/components/interfaces/Organization/BillingSettingsV2/Subscription/PlanUpdateSidePanel.tsx index 7f06512c584..206c5a8cd94 100644 --- a/studio/components/interfaces/Organization/BillingSettingsV2/Subscription/PlanUpdateSidePanel.tsx +++ b/studio/components/interfaces/Organization/BillingSettingsV2/Subscription/PlanUpdateSidePanel.tsx @@ -73,6 +73,9 @@ const PlanUpdateSidePanel = () => { } ) + const billingViaPartner = subscription?.billing_via_partner === true + const paymentViaInvoice = subscription?.payment_method_type === 'invoice' + const { data: subscriptionPreview, error: subscriptionPreviewError, @@ -115,7 +118,7 @@ const PlanUpdateSidePanel = () => { const onUpdateSubscription = async () => { if (!slug) return console.error('org slug is required') if (!selectedTier) return console.error('Selected plan is required') - if (!selectedPaymentMethod) { + if (!selectedPaymentMethod && !paymentViaInvoice) { return ui.setNotification({ category: 'error', message: 'Please select a payment method' }) } @@ -392,19 +395,29 @@ const PlanUpdateSidePanel = () => { -
-

- Upon clicking confirm, your monthly invoice will be adjusted and your credit card will - be charged immediately. Changing the plan resets your billing cycle and may result in - a prorated charge for previous usage. -

-
- + {!billingViaPartner ? ( +
+

+ Upon clicking confirm, your monthly invoice will be adjusted and your credit card + will be charged immediately. Changing the plan resets your billing cycle and may + result in a prorated charge for previous usage. +

+ +
+ +
-
+ ) : ( +
+

+ This organization is billed through one of our partners and you will be charged by + them directly. +

+
+ )} diff --git a/studio/data/subscriptions/org-subscription-query.ts b/studio/data/subscriptions/org-subscription-query.ts index 067bca8c60c..03040d3f744 100644 --- a/studio/data/subscriptions/org-subscription-query.ts +++ b/studio/data/subscriptions/org-subscription-query.ts @@ -62,6 +62,7 @@ export type OrgSubscription = { expiry_year: number } project_addons: ProjectAddon[] + billing_via_partner?: boolean } export async function getOrgSubscription(