chore: added formatUtils and moved getIntervalStr and formatAmount to it

This commit is contained in:
John Yeo
2025-12-14 13:48:17 +00:00
parent 75ead719a3
commit 30f3f5dd82
43 changed files with 354 additions and 761 deletions

View File

@@ -0,0 +1,25 @@
import type { FullCusEntWithFullCusProduct } from "../../../models/cusProductModels/cusEntModels/cusEntWithProduct";
import {
cusEntToCusPrice,
entToOptions,
} from "../../productUtils/convertUtils";
import { getStartingBalance } from "../getStartingBalance";
export const cusEntToStartingBalance = ({
cusEnt,
}: {
cusEnt: FullCusEntWithFullCusProduct;
}) => {
const cusPrice = cusEntToCusPrice({ cusEnt });
const price = cusPrice?.price;
const options = entToOptions({
ent: cusEnt.entitlement,
options: cusEnt.customer_product.options,
});
return getStartingBalance({
entitlement: cusEnt.entitlement,
options,
relatedPrice: price,
});
};