Skip to content

Preserve line base price precision in UBL XML generation - #17

Merged
SimonLoir merged 2 commits into
mainfrom
copilot/update-xml-generator-for-pricing
Aug 17, 2026
Merged

Preserve line base price precision in UBL XML generation#17
SimonLoir merged 2 commits into
mainfrom
copilot/update-xml-generator-for-pricing

Conversation

Copilot AI commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Some monetary fields should not be normalized to 2 decimals; line base price (cbc:PriceAmount) must retain the provided precision. This change removes forced .toFixed(2) formatting for line price while keeping existing 2-decimal formatting behavior for other amount fields.

  • Formatting behavior change

    • Updated invoice/credit note line XML generation to serialize cac:Price/cbc:PriceAmount using the raw numeric string value (String(line.price)) instead of forcing two decimals.
  • Coverage added

    • Added builder test cases for both invoice and credit note flows to assert high-precision line prices are emitted unchanged (e.g. 10.129).
'cbc:PriceAmount': {
  '#text': String(line.price),
  ...XMLAttributes({ currencyID: line.currency }),
}

Co-authored-by: SimonLoir <17649337+SimonLoir@users.noreply.github.com>
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@SimonLoir
SimonLoir marked this pull request as ready for review August 17, 2026 17:53
@SimonLoir
SimonLoir merged commit c9c48a1 into main Aug 17, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants