update
This commit is contained in:
37
ts/formats/base/base.decoder.ts
Normal file
37
ts/formats/base/base.decoder.ts
Normal file
@ -0,0 +1,37 @@
|
||||
import type { TInvoice } from '../../interfaces/common.js';
|
||||
import { ValidationLevel } from '../../interfaces/common.js';
|
||||
import type { ValidationResult } from '../../interfaces/common.js';
|
||||
|
||||
/**
|
||||
* Base decoder class that defines common decoding functionality
|
||||
* for all invoice format decoders
|
||||
*/
|
||||
export abstract class BaseDecoder {
|
||||
protected xml: string;
|
||||
|
||||
constructor(xml: string) {
|
||||
this.xml = xml;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decodes XML into a TInvoice object
|
||||
* @returns Promise resolving to a TInvoice object
|
||||
*/
|
||||
abstract decode(): Promise<TInvoice>;
|
||||
|
||||
/**
|
||||
* Gets letter data in the standard format
|
||||
* @returns Promise resolving to a TInvoice object
|
||||
*/
|
||||
public async getLetterData(): Promise<TInvoice> {
|
||||
return this.decode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the raw XML content
|
||||
* @returns XML string
|
||||
*/
|
||||
public getXml(): string {
|
||||
return this.xml;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user