fix: 🐛 misc fixes
This commit is contained in:
@@ -138,6 +138,14 @@ const validateProductItem = ({
|
||||
});
|
||||
}
|
||||
|
||||
if (item.included_usage === Infinite) {
|
||||
throw new RecaseError({
|
||||
message: `Included usage can't be '${Infinite}' for tiered prices`,
|
||||
code: ErrCode.InvalidInputs,
|
||||
statusCode: StatusCodes.BAD_REQUEST,
|
||||
});
|
||||
}
|
||||
|
||||
if (item.billing_units && item.billing_units <= 0) {
|
||||
throw new RecaseError({
|
||||
message: `Billing units must be greater than 0`,
|
||||
|
||||
@@ -16,8 +16,7 @@ export function mapToProductV3({
|
||||
is_add_on: product.is_add_on,
|
||||
is_default: product.is_default,
|
||||
version: product.version,
|
||||
description:
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
||||
description: "",
|
||||
created_at: product.created_at,
|
||||
price: productV2ToBasePrice({ product }) || null,
|
||||
};
|
||||
|
||||
@@ -15,10 +15,10 @@ export function BillingType() {
|
||||
const setBillingType = (type: "included" | "priced") => {
|
||||
if (type === "included") {
|
||||
// Remove tiers to switch to included
|
||||
setItem({ ...item, tiers: null });
|
||||
setItem({ ...item, tiers: null, billing_units: undefined });
|
||||
} else {
|
||||
// Add initial tier to switch to priced
|
||||
setItem({ ...item, tiers: [{ to: 0, amount: 0 }] });
|
||||
setItem({ ...item, tiers: [{ to: 0, amount: 0 }], billing_units: 1 });
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user