update
This commit is contained in:
@ -2,6 +2,7 @@ import { CIIBaseDecoder } from '../cii.decoder.js';
|
||||
import type { TInvoice, TCreditNote, TDebitNote } from '../../../interfaces/common.js';
|
||||
import { FACTURX_PROFILE_IDS } from './facturx.types.js';
|
||||
import { business, finance, general } from '../../../plugins.js';
|
||||
import { EN16931Validator } from '../../validation/en16931.validator.js';
|
||||
|
||||
/**
|
||||
* Decoder for Factur-X invoice format
|
||||
@ -90,7 +91,7 @@ export class FacturXDecoder extends CIIBaseDecoder {
|
||||
const reverseCharge = this.exists('//ram:SpecifiedTradeAllowanceCharge/ram:ReasonCode[text()="62"]');
|
||||
|
||||
// Create the common invoice data
|
||||
return {
|
||||
const invoiceData = {
|
||||
type: 'accounting-doc' as const,
|
||||
accountingDocType: 'invoice' as const,
|
||||
id: invoiceId,
|
||||
@ -98,7 +99,7 @@ export class FacturXDecoder extends CIIBaseDecoder {
|
||||
date: issueDate,
|
||||
accountingDocStatus: 'issued' as const,
|
||||
versionInfo: {
|
||||
type: 'final',
|
||||
type: 'final' as const,
|
||||
version: '1.0.0'
|
||||
},
|
||||
language: 'en',
|
||||
@ -114,6 +115,11 @@ export class FacturXDecoder extends CIIBaseDecoder {
|
||||
deliveryDate: issueDate,
|
||||
objectActions: []
|
||||
};
|
||||
|
||||
// Validate mandatory EN16931 fields
|
||||
EN16931Validator.validateMandatoryFields(invoiceData);
|
||||
|
||||
return invoiceData;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { CIIBaseDecoder } from '../cii.decoder.js';
|
||||
import type { TInvoice, TCreditNote, TDebitNote } from '../../../interfaces/common.js';
|
||||
import { business, finance } from '../../../plugins.js';
|
||||
import { EN16931Validator } from '../../validation/en16931.validator.js';
|
||||
|
||||
/**
|
||||
* Decoder for ZUGFeRD invoice format
|
||||
@ -89,7 +90,7 @@ export class ZUGFeRDDecoder extends CIIBaseDecoder {
|
||||
const reverseCharge = this.exists('//ram:SpecifiedTradeAllowanceCharge/ram:ReasonCode[text()="62"]');
|
||||
|
||||
// Create the common invoice data
|
||||
return {
|
||||
const invoiceData = {
|
||||
type: 'accounting-doc' as const,
|
||||
accountingDocType: 'invoice' as const,
|
||||
id: invoiceId,
|
||||
@ -97,7 +98,7 @@ export class ZUGFeRDDecoder extends CIIBaseDecoder {
|
||||
date: issueDate,
|
||||
accountingDocStatus: 'issued' as const,
|
||||
versionInfo: {
|
||||
type: 'final',
|
||||
type: 'final' as const,
|
||||
version: '1.0.0'
|
||||
},
|
||||
language: 'en',
|
||||
@ -113,6 +114,11 @@ export class ZUGFeRDDecoder extends CIIBaseDecoder {
|
||||
deliveryDate: issueDate,
|
||||
objectActions: []
|
||||
};
|
||||
|
||||
// Validate mandatory EN16931 fields
|
||||
EN16931Validator.validateMandatoryFields(invoiceData);
|
||||
|
||||
return invoiceData;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2,6 +2,7 @@ import { CIIBaseDecoder } from '../cii.decoder.js';
|
||||
import type { TInvoice, TCreditNote, TDebitNote } from '../../../interfaces/common.js';
|
||||
import { ZUGFERD_V1_NAMESPACES } from '../cii.types.js';
|
||||
import { business, finance } from '../../../plugins.js';
|
||||
import { EN16931Validator } from '../../validation/en16931.validator.js';
|
||||
|
||||
/**
|
||||
* Decoder for ZUGFeRD v1 invoice format
|
||||
@ -104,7 +105,7 @@ export class ZUGFeRDV1Decoder extends CIIBaseDecoder {
|
||||
const reverseCharge = this.exists('//ram:SpecifiedTradeAllowanceCharge/ram:ReasonCode[text()="62"]');
|
||||
|
||||
// Create the common invoice data
|
||||
return {
|
||||
const invoiceData = {
|
||||
type: 'accounting-doc' as const,
|
||||
accountingDocType: 'invoice' as const,
|
||||
id: invoiceId,
|
||||
@ -112,7 +113,7 @@ export class ZUGFeRDV1Decoder extends CIIBaseDecoder {
|
||||
date: issueDate,
|
||||
accountingDocStatus: 'issued' as const,
|
||||
versionInfo: {
|
||||
type: 'final',
|
||||
type: 'final' as const,
|
||||
version: '1.0.0'
|
||||
},
|
||||
language: 'en',
|
||||
@ -128,6 +129,8 @@ export class ZUGFeRDV1Decoder extends CIIBaseDecoder {
|
||||
deliveryDate: issueDate,
|
||||
objectActions: []
|
||||
};
|
||||
|
||||
return invoiceData;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user