pzs / nav-online-invoice

PHP interface for Online Invoice Data Reporting System of Hungarian Tax Office (NAV)
MIT License
146 stars 52 forks source link

queryInvoiceData bug? #29

Closed davidsarkany closed 4 years ago

davidsarkany commented 4 years ago

Hi!

I tried get a invoice with queryInvoiceData method. I got a SimpleXML object, but the invoiceData property is a base64 encoded XML string.

I need decode manually : simplexml_load_string(base64_decode($invoiceDataResult->invoiceData));

It's bug or feature?

pzs commented 4 years ago

Hi,

this library doesn't do too much post-processing on the response data (above handling errors), it just returns the whole or the relevant part of the response XML, what is received from NAV.

Personally I have not used this method yet, but indeed, it would be a nice feature to (optionally?) parse the $invoiceDataResult->invoiceData and return as an XML object. However for that we also have to check the $invoiceDataResult->compressedContentIndicator field and apply decompressing on the data if it's needed.

PRs are welcome :) but next month I also planning to work on this topic, since the 3.0 API is here, so I may implement this feature as well.

pzs commented 4 years ago

I've just added this feature in the version 2.0.4: https://github.com/pzs/nav-online-invoice/releases/tag/v2.0.4

Example: https://github.com/pzs/nav-online-invoice/blob/v2.0.4/examples/queryInvoiceData.php#L30-L34