Skip to content

Parse #SKONTO#/#VERZUG# from Description in CII reader#895

Open
PeterSawatzki-MGGM wants to merge 2 commits intostephanstapel:masterfrom
MGGM-Software-GmbH:parse-skonto-verzug-description
Open

Parse #SKONTO#/#VERZUG# from Description in CII reader#895
PeterSawatzki-MGGM wants to merge 2 commits intostephanstapel:masterfrom
MGGM-Software-GmbH:parse-skonto-verzug-description

Conversation

@PeterSawatzki-MGGM
Copy link
Contributor

Summary

  • The CII writer already serializes payment terms as #SKONTO#TAGE=14#PROZENT=2.00# lines in the Description field for XRechnung profile
  • The CII reader did not parse this format back — it only read structured XML elements (ApplicableTradePaymentDiscountTerms / ApplicableTradePaymentPenaltyTerms)
  • This meant that XRechnung invoices from other systems using only the text-based format lost their discount/penalty information on read

Changes

  • Added _tryReadXRechnungPaymentTerms() method to InvoiceDescriptor23CIIReader that:
    • Detects if any SpecifiedTradePaymentTerms/Description contains #SKONTO# or #VERZUG#
    • If found, parses each #SKONTO#TAGE=n#PROZENT=x.xx#BASISBETRAG=y.yy# line into a structured PaymentTerms object
    • Preserves freetext lines as the Description of the first payment term
    • Falls back to the existing structured XML reading if no #SKONTO#/#VERZUG# format is found
  • Updated 4 roundtrip tests to expect structured PaymentTerms objects instead of raw description text

Context

Ported from the Delphi ZUGFeRD-for-Delphi library where this was implemented as TryReadXRechnungPaymentTerms.

Test plan

  • All 295 existing tests pass
  • Roundtrip tests verify write → read preserves PaymentTermsType, DueDays, Percentage, BaseAmount
  • Freetext descriptions between #SKONTO# lines are preserved

@sonarqubecloud
Copy link

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.

1 participant