Make pay.DueDate amount optional - #951
Draft
migueltorresvalls wants to merge 1 commit into
Draft
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #951 +/- ##
==========================================
- Coverage 95.02% 94.99% -0.03%
==========================================
Files 327 321 -6
Lines 17773 17338 -435
==========================================
- Hits 16888 16471 -417
+ Misses 546 539 -7
+ Partials 339 328 -11 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
migueltorresvalls
marked this pull request as draft
September 2, 2026 14:48
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Relax
GOBL-PAY-DUEDATE-02so a due date without an amount is valid.Use case: when parsing CII documents into GOBL,
ram:PartialPaymentAmountandram:PartialPaymentPercentare optional fields that gobl.cii treats as parse-only — they are not part of the EN16931 / Factur-X / ZUGFeRD schemas, so they're read when present but never emitted. A payment term carrying only aram:DueDateDateTimeis therefore a perfectly valid source document, yet the converted GOBL invoice failed validation:DueDate.Amountwas a non-pointernum.Amount, so the missing amount materialized as zero,CalculateDuesrescaled it to0.00, andGOBL-PAY-DUEDATE-02("amount must not be zero") rejected the whole document. The fix stops inventing a zero amount for due dates that never declared one, instead of loosening the check on amounts that are actually set.How gobl.ubl handles the same situation: instead of leaving the amount unset, it assumes a single due date covers the full amount (
payment_parse.go), whichCalculateDuesthen turns into the payable total:invopop/gobl.cii#88 (draft) ports that same behavior to gobl.cii.
Changes:
pay:DueDate.Amountis now*num.Amountwithomitempty, matching the other optional amounts; an absent amount stays absentpay:CalculateDuesleaves due dates without an amount or percent untouched; percent-derived amounts are still calculated and rescaledGOBL-PAY-DUEDATE-02now only fires for an explicitly set zero amount (num.NotZeroalready skips nil)data/schemas/pay/terms.json:amountno longer required onpay.DueDateNotes:
dd.Amountfrom a parsed value; it needs a one-line pointer change when bumping to a gobl version including this.Generated with Claude Code — https://claude.ai/code/ecc6fcbb-f34f-4ab9-bc09-90ec8cc9c4ae