Closed melo0187 closed 1 week ago
Hello, feel free to PR but the recommended solution would be the much more sophisticated ZUGFeRDInvoiceImporter where you should be able to get it via sth like getRecipient(). PS: it may be "equivalent" but if you have a ZUGFeRD (PDF) you should expect a CII file inside, but XRECHNUNG_Elektron.ubl.xml is the UBL equivalent
Hello, feel free to PR but the recommended solution would be the much more sophisticated ZUGFeRDInvoiceImporter where you should be able to get it via sth like getRecipient(). PS: it may be "equivalent" but if you have a ZUGFeRD (PDF) you should expect a CII file inside, but XRECHNUNG_Elektron.ubl.xml is the UBL equivalent
@jstaerk thank you for your input! Much appreciated. I stumbled on the ZUGFeRDInvoiceImporter and wanted to look into it just yesterday. So I now have even more reason to do so =)
Also, thank you for pointing out that I'm dealing with a CII file in the case of ZUGFeRD. I meant that the files represent the same invoice. However, I am wondering how I would deal with a UBL file. Is there any support for this XRechnung format or do I need to go down another path to handle UBL?
For the record:
I looked into ZUGFeRDInvoiceImporter
. It extends ZUGFeRDImporter
, so it offers all the same access methods.
To me the main difference seems to be in ZUGFeRDInvoiceImporter#extractInvoice
, which reads the data into an Invoice
object.
This object has getters like org.mustangproject.Invoice#getSender
, which in turn has org.mustangproject.TradeParty#getName
.
So using ZUGFeRDInvoiceImporter
to extract the data into an Invoice
object does indeed solve my issue of missing access to the SellerTradeParty
's name, which is why I close this issue. Thanks again @jstaerk for pointing me into the right direction.
However, I noticed some discrepancies for the same invoice file between reading data using an Invoice
object from ZUGFeRDInvoiceImporter
and reading the same data using ZUGFeRDImporter
's methods.
I will open new issues to investigate this further.
Also worth noting, following up on my question how to handle UBL:
It seems as ZUGFeRDInvoiceImporter
will happily take UBL files.
I have a file named XRECHNUNG_Elektron.pdf as an example for a ZUGFeRD 2.2 invoice, which seems to be equivalent to library/src/test/resources/XRECHNUNG_Elektron.ubl.xml. The xrechnung.xml that is embedded in the PDF contains
SellerTradeParty:Name
. HoweverZUGFeRDImporter
does not expose a getter for this property.Are there plans on adding this? Should I just open a PR to add the getter myself? On first look it might be a trivial adaptation of
org.mustangproject.ZUGFeRD.ZUGFeRDImporter#getSellerTradePartyGlobalID
.