@malga-checkout/core
Version:
Core components for Malga Checkout
18 lines (17 loc) • 637 B
JavaScript
export const getItems = (boleto) => {
var _a;
if (!boleto.items || !((_a = boleto.items) === null || _a === void 0 ? void 0 : _a.length))
return {};
return {
items: boleto.items,
};
};
export const normalizeBoletoFees = (feesType, fees) => {
return fees ? { [feesType]: formatBoletoFees(fees) } : {};
};
const formatBoletoFees = (fees) => {
const days = fees.days ? { days: fees.days } : {};
const amount = fees.amount ? { amount: fees.amount } : {};
const percentage = fees.percentage ? { percentage: fees.percentage } : {};
return Object.assign(Object.assign(Object.assign({}, days), amount), percentage);
};