Repository navigation
Conversation
Drops the "Paid" default for BT-20; a due date alone is enough (BR-CO-25), and no terms at all omit the element.
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.
Problem
Invoice#to_xmlalways writesSpecifiedTradePaymentTermswith aDescription(BT-20, payment terms). Without apayment_terms_text, the description defaults to "Paid". That states something the invoice doesn't know: an unpaid invoice tells its receiver it has been paid. BT-20 is optional in EN 16931; a due date (BT-9) alone satisfies BR-CO-25.Change
Descriptionis written only whenpayment_terms_textis given.SpecifiedTradePaymentTermsis written only when there is a text, a due date or a direct debit mandate reference; with none of them it's left out instead of written empty.Callers that pass a text get the same XML as before. A caller passing no text no longer gets "Paid".
Tests
Three new tests in
test/invoice_test.rb: the text is still written when given; without one, there's no description but the due date stays, validated against the schematron; with no text, due date or mandate, the element is left out. The full suite passes.