Skip to content

Conversation

@alvarolivie
Copy link
Collaborator

@alvarolivie alvarolivie commented Jul 18, 2025

This was originally tackled due to an issue with CII not having a field that specified an ammount and gobl parsed that as an empty amount which is 0. This has led me down a rabbit hole where we there where a few issues parsing. I'll describe these in more detail bellow:

  • Advances, when paid in full, are not set so we were parsing it as 0. In these cases the real amount should be the whole invoice.
  • Advances need a description that CII does not provide
  • We were checking for the pointer to an ID but not the actual value.
  • When we have a base and an amount we need to create a fake percentage from the two as base only works with percent.
  • Legal Organization was not being parsed. Can contain identities.

@alvarolivie alvarolivie requested a review from Copilot July 18, 2025 14:27
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes several validation errors and parsing issues in the CII (Cross Industry Invoice) parser, particularly around handling advances, allowances/charges, and party identities. The changes ensure that empty amounts are properly handled, missing descriptions are provided, and percentage calculations are correctly derived when only base amounts are available.

  • Fixes advance payment parsing to handle full payments and provide required descriptions
  • Adds validation check to test suite to catch parsing errors earlier
  • Implements percentage calculation from base amounts when percentage is not explicitly provided
  • Adds support for parsing Legal Organization identities from party data

Reviewed Changes

Copilot reviewed 13 out of 28 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
settlement_parse.go Adds descriptions for advances and improves payment term parsing logic
allowance_charge_parse.go Implements percentage calculation from base amounts for charges and discounts
party_parse.go Adds support for parsing Legal Organization identities
lines_parse.go Adds null checks for product ID fields before assignment
examples_test.go Adds validation check to test suite
party_parse_test.go Updates test expectations for new identity parsing
test/data/convert/xrechnung/invoice-partial-payment.json New test data file for partial payment scenarios
test/data/parse/*.xml Test data updates with consistent tax registration IDs

@alvarolivie alvarolivie requested a review from cavalle July 21, 2025 14:30
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 56.92308% with 28 lines in your changes missing coverage. Please review.

Project coverage is 71.54%. Comparing base (41ef19b) to head (7c5c55a).

Files with missing lines Patch % Lines
allowance_charge_parse.go 47.05% 16 Missing and 2 partials ⚠️
party_parse.go 68.75% 4 Missing and 1 partial ⚠️
settlement_parse.go 69.23% 4 Missing ⚠️
lines_parse.go 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@                   Coverage Diff                   @@
##           fix-buyer-reference      #34      +/-   ##
=======================================================
- Coverage                72.75%   71.54%   -1.22%     
=======================================================
  Files                       23       23              
  Lines                     1681     1743      +62     
=======================================================
+ Hits                      1223     1247      +24     
- Misses                     376      410      +34     
- Partials                    82       86       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@alvarolivie alvarolivie requested a review from samlown July 23, 2025 10:44
Base automatically changed from fix-buyer-reference to main July 28, 2025 14:08
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.

3 participants