Giter VIP home page Giter VIP logo

Comments (6)

rycks avatar rycks commented on June 10, 2024

Hmmm self update, Solution 1 can't be used ! so i start to test all get returns before accessing to supposed values ...

from einvoicing.

josemmo avatar josemmo commented on June 10, 2024

Hello @rycks,

UXML is a different library, UXML::get() must return null if no element is found as per the specification. So yeah, that cannot be changed.

The PR you propose isn't possible either as none of the values you've changed can be null (eInvoicing expects them to be non empty). Probably adding a few null checks and throwing an InvalidArgumentException is the best approach here given it will comply with the current documentation, which would be ideal for backward compatibility.

Will that fit your use case? I'm assuming you're parsing an XML document that doesn't comply with the UBL PEPPOL specs. Or is it a valid invoice using a CIUS that overrides PEPPOL in weird ways?

from einvoicing.

rycks avatar rycks commented on June 10, 2024

you are right, is that a peppol invoice ?

<?xml version="1.0" encoding="UTF-8"?>
<Invoice xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDataty
pes-2" xmlns:ccts="urn:oasis:names:specification:ubl:schema:xsd:CoreComponentPar
ameters-2" xmlns:stat="urn:oasis:names:specification:ubl:schema:xsd:DocumentStat
usCode-1.0" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicC
omponents-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggre
gateComponents-2" xmlns:udt="urn:un:unece:uncefact:data:draft:UnqualifiedDataTyp
esSchemaModule:2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2"
>
  <cbc:UBLVersionID>2.0</cbc:UBLVersionID>
  <cbc:CustomizationID>1.0</cbc:CustomizationID>
  <cbc:ProfileID>FFF.BE ExactOnline</cbc:ProfileID>
  <cbc:ID>20700108</cbc:ID>
  <cbc:InvoiceTypeCode listURI="http://www.FFF.be/ubl/2.0/cl/gc/BE-InvoiceCode-1.0.gc">380</cbc:InvoiceTypeCode>

what could i do before open it with your peppol lib to check if it's a good peppol invoice ?

from einvoicing.

josemmo avatar josemmo commented on June 10, 2024

The UBL snippet you provided appears to have been generated by a software called Exact Online (not a valid EN 16931 invoice).

You can verify this by reading the <cbc:ProfileID /> field and making sure it starts with "urn:cen.eu:en16931:2017#compliant". For instance, PEPPOL BIS 3.0 invoices here have a value of "urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0".

I'm closing the issue now that this has been clarified.

from einvoicing.

rycks avatar rycks commented on June 10, 2024

Ok, thanks
but it could be good idea to make a early test in UXML no and get an error or exception in case of XML is not valid ?

from einvoicing.

josemmo avatar josemmo commented on June 10, 2024

Just added proper error handling to throw an InvalidArgumentException when the XML document is invalid. You can test it by requiring the latest development version:

composer require josemmo/einvoicing:dev-develop

from einvoicing.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.