BREAKING CHANGE(core): Refactor contact and PDF handling across the library by replacing IContact with TContact and updating PDF processing to use a structured IPdf object. These changes ensure that empty contact objects include registration details, founded/closed dates, and status, and that PDF loading/exporting uniformly wraps buffers in a proper object.
This commit is contained in:
@ -97,21 +97,37 @@ export class FacturXDecoder extends BaseDecoder {
|
||||
}
|
||||
|
||||
// Create seller
|
||||
const seller: plugins.tsclass.business.IContact = {
|
||||
const seller: plugins.tsclass.business.TContact = {
|
||||
name: sellerName,
|
||||
type: 'company',
|
||||
description: sellerName,
|
||||
address: {
|
||||
streetName: this.getElementText('ram:LineOne') || 'Unknown',
|
||||
houseNumber: '0', // Required by IAddress interface
|
||||
houseNumber: '0',
|
||||
city: this.getElementText('ram:CityName') || 'Unknown',
|
||||
country: this.getElementText('ram:CountryID') || 'Unknown',
|
||||
postalCode: this.getElementText('ram:PostcodeCode') || 'Unknown',
|
||||
},
|
||||
registrationDetails: {
|
||||
vatId: this.getElementText('ram:ID') || 'Unknown',
|
||||
registrationId: this.getElementText('ram:ID') || 'Unknown',
|
||||
registrationName: sellerName
|
||||
},
|
||||
foundedDate: {
|
||||
year: 2000,
|
||||
month: 1,
|
||||
day: 1
|
||||
},
|
||||
closedDate: {
|
||||
year: 9999,
|
||||
month: 12,
|
||||
day: 31
|
||||
},
|
||||
status: 'active'
|
||||
};
|
||||
|
||||
// Create buyer
|
||||
const buyer: plugins.tsclass.business.IContact = {
|
||||
const buyer: plugins.tsclass.business.TContact = {
|
||||
name: buyerName,
|
||||
type: 'company',
|
||||
description: buyerName,
|
||||
@ -122,6 +138,22 @@ export class FacturXDecoder extends BaseDecoder {
|
||||
country: 'Unknown',
|
||||
postalCode: 'Unknown',
|
||||
},
|
||||
registrationDetails: {
|
||||
vatId: 'Unknown',
|
||||
registrationId: 'Unknown',
|
||||
registrationName: buyerName
|
||||
},
|
||||
foundedDate: {
|
||||
year: 2000,
|
||||
month: 1,
|
||||
day: 1
|
||||
},
|
||||
closedDate: {
|
||||
year: 9999,
|
||||
month: 12,
|
||||
day: 31
|
||||
},
|
||||
status: 'active'
|
||||
};
|
||||
|
||||
// Extract invoice type
|
||||
|
Reference in New Issue
Block a user