From 5fc30bd1b6458dd55118c9ca0de1a972f7ef043b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 17 Aug 2026 17:43:50 +0000 Subject: [PATCH 1/2] Preserve precision for line PriceAmount and add builder tests Co-authored-by: SimonLoir <17649337+SimonLoir@users.noreply.github.com> --- src/builder/DocumentBuilder.ts | 2 +- tests/builder-creditnote.test.ts | 16 ++++++++++++++++ tests/builder-invoice.test.ts | 16 ++++++++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/builder/DocumentBuilder.ts b/src/builder/DocumentBuilder.ts index 85c7b4a..dae180f 100644 --- a/src/builder/DocumentBuilder.ts +++ b/src/builder/DocumentBuilder.ts @@ -1143,7 +1143,7 @@ export class DocumentBuilder { }, 'cac:Price': { 'cbc:PriceAmount': { - '#text': line.price.toFixed(2), + '#text': String(line.price), ...XMLAttributes({ currencyID: line.currency, }), diff --git a/tests/builder-creditnote.test.ts b/tests/builder-creditnote.test.ts index 3e87a3a..1e8c9fb 100644 --- a/tests/builder-creditnote.test.ts +++ b/tests/builder-creditnote.test.ts @@ -132,4 +132,20 @@ describe('Creditnote Builder', () => { /\s*/ ); }); + + it('should preserve line price precision in PriceAmount', () => { + const creditNoteXML = toolkit.creditNoteToPeppolUBL({ + ...basicCreditNote, + creditNoteLines: [ + { + ...basicCreditNote.creditNoteLines[0], + price: 10.129, + }, + ], + }); + + expect(creditNoteXML).toContain( + '10.129' + ); + }); }); diff --git a/tests/builder-invoice.test.ts b/tests/builder-invoice.test.ts index 341d0f4..11f06a8 100644 --- a/tests/builder-invoice.test.ts +++ b/tests/builder-invoice.test.ts @@ -148,4 +148,20 @@ describe('Invoices Builder', () => { /\s*/ ); }); + + it('should preserve line price precision in PriceAmount', () => { + const invoiceXML = toolkit.invoiceToPeppolUBL({ + ...basicInvoice, + invoiceLines: [ + { + ...basicInvoice.invoiceLines[0], + price: 10.129, + }, + ], + }); + + expect(invoiceXML).toContain( + '10.129' + ); + }); }); From 829093a7877e978446ac52350d988b25c5ba96e2 Mon Sep 17 00:00:00 2001 From: Simon Loir Date: Mon, 17 Aug 2026 19:54:10 +0200 Subject: [PATCH 2/2] Bump version from 0.8.3 to 0.8.4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index dbda76f..75965a9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@pixeldrive/peppol-toolkit", - "version": "0.8.3", + "version": "0.8.4", "description": "A TypeScript toolkit for building and reading peppol UBL documents", "keywords": [ "peppol",