fix: attach same custom ents upgrade
This commit is contained in:
@@ -122,7 +122,7 @@ export const getPricesAndEnts = async ({
|
||||
optionsInput: optionsInput || [],
|
||||
features,
|
||||
prices,
|
||||
curCusProduct: curMainProduct,
|
||||
curCusProduct,
|
||||
}),
|
||||
prices,
|
||||
entitlements: getEntsWithFeature({
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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`}
|
||||
>
|
||||
<DialogHeader>
|
||||
<DialogTitle className="text-t2 text-md">
|
||||
Attach plan
|
||||
</DialogTitle>
|
||||
<DialogTitle className="text-t2 text-md">Attach plan</DialogTitle>
|
||||
</DialogHeader>
|
||||
|
||||
<div className="text-sm flex flex-col gap-4">
|
||||
|
||||
Reference in New Issue
Block a user