From 8185fab2572d1a24343799c426c2521072aad203 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Thu, 14 Mar 2024 21:03:07 +0000 Subject: [PATCH] chore: fix-upgrade-wizard-flow --- .../paymentDetails.svelte | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/routes/console/wizard/cloudOrganizationChangeTier/paymentDetails.svelte b/src/routes/console/wizard/cloudOrganizationChangeTier/paymentDetails.svelte index f03feecca..99116f394 100644 --- a/src/routes/console/wizard/cloudOrganizationChangeTier/paymentDetails.svelte +++ b/src/routes/console/wizard/cloudOrganizationChangeTier/paymentDetails.svelte @@ -10,7 +10,6 @@ import { Dependencies } from '$lib/constants'; import { initializeStripe, isStripeInitialized, submitStripeCard } from '$lib/stores/stripe'; import { organization } from '$lib/stores/organization'; - import { symmetricDifference } from '$lib/helpers/array'; import { showUsageRatesModal } from '$lib/stores/billing'; import { PaymentBoxes } from '$lib/components/billing'; import { page } from '$app/stores'; @@ -49,15 +48,10 @@ } } else { try { - await submitStripeCard(name, $page?.params?.organization ?? null); - const latestMethods = await sdk.forConsole.billing.listPaymentMethods(); - const paymentMethod = symmetricDifference( - methods.paymentMethods, - latestMethods.paymentMethods - )[0] as PaymentMethodData; - const card = await sdk.forConsole.billing.getPaymentMethod(paymentMethod.$id); + const method = await submitStripeCard(name, $page?.params?.organization ?? null); + const card = await sdk.forConsole.billing.getPaymentMethod(method.$id); if (card?.last4) { - $changeOrganizationTier.paymentMethodId = paymentMethod.$id; + $changeOrganizationTier.paymentMethodId = method.$id; } else { throw new Error( 'The payment method you selected is not valid. Please select a different one.'