diff --git a/server/src/internal/customers/attach/attachUtils/attachParams/attachParamsUtils/getPricesAndEnts.ts b/server/src/internal/customers/attach/attachUtils/attachParams/attachParamsUtils/getPricesAndEnts.ts index 221277a15..6bf5933f2 100644 --- a/server/src/internal/customers/attach/attachUtils/attachParams/attachParamsUtils/getPricesAndEnts.ts +++ b/server/src/internal/customers/attach/attachUtils/attachParams/attachParamsUtils/getPricesAndEnts.ts @@ -122,7 +122,7 @@ export const getPricesAndEnts = async ({ optionsInput: optionsInput || [], features, prices, - curCusProduct: curMainProduct, + curCusProduct, }), prices, entitlements: getEntsWithFeature({ diff --git a/server/src/internal/customers/attach/attachUtils/handleAttachErrors.ts b/server/src/internal/customers/attach/attachUtils/handleAttachErrors.ts index 3a7f741b0..d07a2b15c 100644 --- a/server/src/internal/customers/attach/attachUtils/handleAttachErrors.ts +++ b/server/src/internal/customers/attach/attachUtils/handleAttachErrors.ts @@ -5,10 +5,11 @@ import { AttachErrCode, BillingType, cusProductsToCusEnts, - cusProductToPrices, ErrCode, + cusProductToPrices, + ErrCode, type FullCusProduct, getStartingBalance, - type UsagePriceConfig + type UsagePriceConfig, } from "@autumn/shared"; import { Decimal } from "decimal.js"; import { StatusCodes } from "http-status-codes"; @@ -237,12 +238,7 @@ export const handleAttachErrors = async ({ AttachBranch.Downgrade, ]; - - - - if ( - upgradeDowngradeFlows.includes(branch) - ) { + if (upgradeDowngradeFlows.includes(branch)) { handleNonCheckoutErrors({ flags, config, diff --git a/shared/utils/cusProductUtils/productIdToCusProduct.ts b/shared/utils/cusProductUtils/productIdToCusProduct.ts index 6b13fed59..c7e295815 100644 --- a/shared/utils/cusProductUtils/productIdToCusProduct.ts +++ b/shared/utils/cusProductUtils/productIdToCusProduct.ts @@ -30,17 +30,19 @@ export const productToCusProduct = ({ ? cusProduct.internal_entity_id === internalEntityId : nullish(cusProduct.internal_entity_id); - const statusMatch = inStatuses - ? inStatuses.includes(cusProduct.status) - : true; + // const statusMatch = inStatuses + // ? inStatuses.includes(cusProduct.status) + // : true; - return ( - cusProductIdMatch && - versionMatch && - prodIdMatch && - entityMatch && - statusMatch - ); + // if (cusProductIdMatch) { + // console.log(`Cus Product ID Match: ${cusProductIdMatch}`); + // console.log(`Version Match: ${versionMatch}`); + // console.log(`Prod ID Match: ${prodIdMatch}`); + // console.log(`Entity Match: ${entityMatch}`); + // console.log(`--------------------------------`); + // } + + return cusProductIdMatch && versionMatch && prodIdMatch && entityMatch; }); } diff --git a/vite/src/views/customers/customer/product/components/AttachModal.tsx b/vite/src/views/customers/customer/product/components/AttachModal.tsx index db194808c..8f42be3d0 100644 --- a/vite/src/views/customers/customer/product/components/AttachModal.tsx +++ b/vite/src/views/customers/customer/product/components/AttachModal.tsx @@ -158,7 +158,10 @@ export const AttachModal = ({ entityId, product, optionsInput: - preview?.branch !== AttachBranch.NewVersion ? options : undefined, + preview?.branch !== AttachBranch.NewVersion && + preview?.branch !== AttachBranch.SameCustomEnts + ? options + : undefined, attachState, useInvoice, enableProductImmediately, @@ -199,7 +202,7 @@ export const AttachModal = ({ } else { toast.error(getBackendErr(error, "Error creating plan")); } - } finally{ + } finally { setLoading(false); } }; @@ -216,9 +219,7 @@ export const AttachModal = ({ className={`p-6 pb-2 flex flex-col gap-4 ${mainWidth} rounded-sm`} > - - Attach plan - + Attach plan