xinvoice/ts/classes.decoder.ts
2024-12-31 13:38:41 +01:00

18 lines
487 B
TypeScript

import * as plugins from './plugins.js';
/**
* A class to convert a given ZUGFeRD XML string
* into a structured ILetter with invoice data.
*/
export class ZUGFeRDXmlDecoder {
private xmlString: string;
constructor(xmlString: string) {
this.xmlString = xmlString;
}
public async getLetterData(): Promise<plugins.tsclass.business.ILetter> {
const smartxmlInstance = new plugins.smartxml.SmartXml();
return smartxmlInstance.parseXmlToObject(this.xmlString);
}
}