Skip to content

Commit

Permalink
Merge pull request #296 from itenium-be/peppol-generation-update
Browse files Browse the repository at this point in the history
Peppol generation update
  • Loading branch information
Laoujin authored Jul 9, 2024
2 parents bce5a17 + 17aaff0 commit 8b6f655
Show file tree
Hide file tree
Showing 6 changed files with 475 additions and 190 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,4 @@ React.FC<P & ButtonWithClickOnceProps>

## E-invoice xml

The e-invoices generated by confac should comply with the Peppol BIS Billing 3.0 standard defined by the EU. To doublecheck if the created xml does follow this protocol, you can use this [tool](https://ecosio.com/en/peppol-and-xml-document-validator/). Choose 'OpenPeppol UBL Invoice (2023.05) (aka BIS Billing 3.0.15)' as the ruleset. This is the most current ruleset at the time of writing. Release notes and the general xml structure can be consulted [here]( https://docs.peppol.eu/poacc/billing/3.0)
The e-invoices generated by confac should comply with the Peppol BIS Billing 3.0 standard defined by the EU. To doublecheck if the created xml does follow this protocol, you can use this [tool](https://ecosio.com/en/peppol-and-xml-document-validator/). Choose 'OpenPeppol UBL Invoice (2023.11) (aka BIS Billing 3.0.16)' as the ruleset. This is the most current ruleset at the time of writing. Release notes and the general xml structure can be consulted [here]( https://docs.peppol.eu/poacc/billing/3.0)
122 changes: 92 additions & 30 deletions backend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"express-async-errors": "^3.1.1",
"express-jwt": "^5.3.3",
"express-unless": "^0.5.0",
"fast-xml-parser": "^4.4.0",
"google-auth-library": "^6.0.0",
"html-pdf": "^2.1.0",
"jsonwebtoken": "^8.5.1",
Expand All @@ -52,7 +53,8 @@
"regenerator-runtime": "^0.13.3",
"slugify": "^1.1.0",
"tmp": "^0.2.1",
"ubl-builder": "github:pipesanta/ubl-builder"
"ubl-builder": "github:pipesanta/ubl-builder",
"uuid": "^10.0.0"
},
"devDependencies": {
"@babel/cli": "^7.7.7",
Expand Down Expand Up @@ -82,6 +84,7 @@
"@types/request": "^2.48.4",
"@types/supertest": "^2.0.12",
"@types/tmp": "^0.1.0",
"@types/uuid": "^10.0.0",
"@typescript-eslint/eslint-plugin": "^2.17.0",
"@typescript-eslint/parser": "^2.17.0",
"babel-eslint": "^10.0.3",
Expand Down
6 changes: 3 additions & 3 deletions backend/src/controllers/invoices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const createInvoice = async (invoice: IInvoice, db: Db, pdfBuffer: Buffer, user:


if (!invoice.isQuotation) {
const xmlBuffer = Buffer.from(createXml(createdInvoice));
const xmlBuffer = Buffer.from(createXml(createdInvoice, pdfBuffer));
await db.collection<Pick<IAttachmentCollection, '_id' | 'pdf' | 'xml'>>(CollectionNames.ATTACHMENTS).insertOne({
_id: new ObjectID(createdInvoice._id),
pdf: pdfBuffer,
Expand Down Expand Up @@ -141,10 +141,10 @@ export const updateInvoiceController = async (req: ConfacRequest, res: Response)
}

if (!invoice.isQuotation) {
const updateXmlBuffer = Buffer.from(createXml({_id, ...invoice}));
const updateXmlBuffer = Buffer.from(createXml({_id, ...invoice}, updatedPdfBuffer as Buffer));
await req.db.collection<IAttachment>(CollectionNames.ATTACHMENTS)
.findOneAndUpdate({_id: new ObjectID(_id)}, {$set: {xml: updateXmlBuffer}});
}
}

if (!invoice.projectMonth) {
// Makes sure projectMonth is overwritten in the db if already present there
Expand Down
Loading

0 comments on commit 8b6f655

Please sign in to comment.