node-zugferd
Version:
A Node.js library for creating ZUGFeRD/Factur-X compliant documents. Generating XML and embedding it into PDF/A files, enabling seamless e-invoicing and digital document compliance.
70 lines (68 loc) • 2.17 kB
JavaScript
// src/codelists/index.ts
var getByPath = (obj, path) => path.split(".").reduce((acc, key) => acc?.[key], obj);
var createEnum = (data, options) => {
return Object.fromEntries(
data.map((item) => [
getByPath(item, options.keyProp),
getByPath(item, options.valueProp)
])
);
};
// src/codelists/allowance.gen.ts
var PUBLISHED = /* @__PURE__ */ new Date("2019-03-11T23:00:00.000Z");
var ALLOWANCE = [
{
key: "BONUS_FOR_WORKS_AHEAD_OF_SCHEDULE",
name: "Bonus for works ahead of schedule",
value: "41"
},
{ key: "OTHER_BONUS", name: "Other bonus", value: "42" },
{
key: "MANUFACTURERS_CONSUMER_DISCOUNT",
name: "Manufacturer\u2019s consumer discount",
value: "60"
},
{
key: "DUE_TO_MILITARY_STATUS",
name: "Due to military status",
value: "62"
},
{ key: "DUE_TO_WORK_ACCIDENT", name: "Due to work accident", value: "63" },
{ key: "SPECIAL_AGREEMENT", name: "Special agreement", value: "64" },
{
key: "PRODUCTION_ERROR_DISCOUNT",
name: "Production error discount",
value: "65"
},
{ key: "NEW_OUTLET_DISCOUNT", name: "New outlet discount", value: "66" },
{ key: "SAMPLE_DISCOUNT", name: "Sample discount", value: "67" },
{ key: "END_OF_RANGE_DISCOUNT", name: "End-of-range discount", value: "68" },
{ key: "INCOTERM_DISCOUNT", name: "Incoterm discount", value: "70" },
{
key: "POINT_OF_SALES_THRESHOLD_ALLOWANCE",
name: "Point of sales threshold allowance",
value: "71"
},
{
key: "MATERIAL_SURCHARGEDEDUCTION",
name: "Material surcharge/deduction",
value: "88"
},
{ key: "DISCOUNT", name: "Discount", value: "95" },
{ key: "SPECIAL_REBATE", name: "Special rebate", value: "100" },
{ key: "FIXED_LONG_TERM", name: "Fixed long term", value: "102" },
{ key: "TEMPORARY", name: "Temporary", value: "103" },
{ key: "STANDARD", name: "Standard", value: "104" },
{ key: "YEARLY_TURNOVER", name: "Yearly turnover", value: "105" }
];
var allowanceCode = ALLOWANCE.map(({ value }) => value);
var Allowance = createEnum(ALLOWANCE, {
keyProp: "key",
valueProp: "value"
});
export {
ALLOWANCE,
Allowance,
PUBLISHED,
allowanceCode
};