anskaffelser / ehf-postaward-g2

Specifications part of EHF Post-Award, 2nd generation.
33 stars 37 forks source link

EHF2.0 invoice files with NO AccountingSupplierParty/Party/PartyLegalEntity is validated OK #29

Closed christian-andersson closed 9 years ago

christian-andersson commented 9 years ago

According to the documentation, AccountingSupplierParty/Party/PartyLegalEntity is Mandatory, but the Validator does not fail when validating EHF2.0 files without this entity.

SiwMeckelborg commented 9 years ago

Could you provide me the file you have used to test this? When I test a file without PartyLegalEntity, I do get validation errors. /Siw

christian-andersson commented 9 years ago

I just noticed that on http://validator.vefa.difi.no/validation.jsp I got no errors/warnings when PartyLegalEntity is missing from AccountingSupplierParty, and when it is removed from AccountingCustomerParty, there is also no errors/warnings, BUT when it is removed from BOTH, I get warnings that these SHOULD be in the file (for both of them)

christian-andersson commented 9 years ago

The below xml has the above problem (among others) (this is an xml that I use to test many errors in the validator, hopefully many of them will be fixed in the next version.

<?xml version="1.0" encoding="UTF-8"?>
<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:sdt="urn:oasis:names:specification:ubl:schema:xsd:SpecializedDatatypes-2" xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <cbc:UBLVersionID>2.1</cbc:UBLVersionID>
    <cbc:CustomizationID>urn:www.cenbii.eu:transaction:biitrns010:ver2.0:extended:urn:www.peppol.eu:bis:peppol4a:ver2.0:extended:urn:www.difi.no:ehf:faktura:ver2.0</cbc:CustomizationID>
    <cbc:ProfileID>urn:www.cenbii.eu:profile:bii04:ver2.0</cbc:ProfileID>
    <cbc:ID>1</cbc:ID>
    <cbc:IssueDate>2014-11-01</cbc:IssueDate>
    <cbc:InvoiceTypeCode listAgencyID="6" listID="UNCL1001">380</cbc:InvoiceTypeCode>
    <cbc:DocumentCurrencyCode listID="ISO4217">NOK</cbc:DocumentCurrencyCode>
    <cac:AccountingSupplierParty>
        <cac:Party>
            <cac:PartyName>
                <cbc:Name>TEST AS</cbc:Name>
            </cac:PartyName>
            <cac:PostalAddress>
                <cbc:StreetName></cbc:StreetName>
                <cbc:CityName></cbc:CityName>
                <cbc:PostalZone></cbc:PostalZone>
            </cac:PostalAddress>
            <cac:PartyTaxScheme>
                <cbc:CompanyID schemeID="NO:VAT"></cbc:CompanyID>
                <cac:TaxScheme>
                    <cbc:ID>VAT</cbc:ID>
                </cac:TaxScheme>
            </cac:PartyTaxScheme>
        </cac:Party>
    </cac:AccountingSupplierParty>
    <cac:AccountingCustomerParty>
        <cac:Party>
            <cac:PartyName>
                <cbc:Name>TEST AS</cbc:Name>
            </cac:PartyName>
            <cac:PostalAddress>
                <cbc:StreetName></cbc:StreetName>
                <cbc:CityName></cbc:CityName>
                <cbc:PostalZone></cbc:PostalZone>
            </cac:PostalAddress>
            <cac:PartyLegalEntity>
                <cbc:RegistrationName>TEST AS</cbc:RegistrationName>
                <cbc:CompanyID schemeID="NO:ORGNR">121212129</cbc:CompanyID>
            </cac:PartyLegalEntity>
        </cac:Party>
    </cac:AccountingCustomerParty>
    <cac:PaymentMeans>
        <cbc:PaymentMeansCode listAgencyID="NES" listID="UNCL4461">31</cbc:PaymentMeansCode>
        <cbc:PaymentDueDate>2014-11-30</cbc:PaymentDueDate>
        <cbc:PaymentID></cbc:PaymentID>
        <cac:PayeeFinancialAccount>
            <cbc:ID schemeID="BBAN"></cbc:ID>
        </cac:PayeeFinancialAccount>
    </cac:PaymentMeans>
    <cac:PaymentTerms/>
    <cac:TaxTotal>
        <cbc:TaxAmount currencyID="NOK">250</cbc:TaxAmount>
        <cac:TaxSubtotal>
            <cbc:TaxableAmount currencyID="NOK">1000</cbc:TaxableAmount>
            <cbc:TaxAmount currencyID="NOK">250</cbc:TaxAmount>
            <cac:TaxCategory>
                <cbc:ID schemeAgencyID="6" schemeID="UNCL5305">S</cbc:ID>
                <cbc:Percent>25</cbc:Percent>
                <cac:TaxScheme>
                    <cbc:ID>VAT</cbc:ID>
                </cac:TaxScheme>
            </cac:TaxCategory>
        </cac:TaxSubtotal>
    </cac:TaxTotal>
    <cac:LegalMonetaryTotal>
        <cbc:LineExtensionAmount currencyID="NOK">1000</cbc:LineExtensionAmount>
        <cbc:TaxExclusiveAmount currencyID="NOK">1000</cbc:TaxExclusiveAmount>
        <cbc:TaxInclusiveAmount currencyID="NOK">1250</cbc:TaxInclusiveAmount>
        <cbc:AllowanceTotalAmount currencyID="NOK">0.00</cbc:AllowanceTotalAmount>
        <cbc:ChargeTotalAmount currencyID="NOK">0.00</cbc:ChargeTotalAmount>
        <cbc:PayableAmount currencyID="NOK">1250</cbc:PayableAmount>
    </cac:LegalMonetaryTotal>
    <cac:InvoiceLine>
        <cbc:ID>1</cbc:ID>
        <cbc:InvoicedQuantity unitCode="C62" unitCodeListID="UNECERec20">1</cbc:InvoicedQuantity>
        <cbc:LineExtensionAmount currencyID="NOK">1000</cbc:LineExtensionAmount>
        <cac:TaxTotal>
            <cbc:TaxAmount currencyID="NOK">250</cbc:TaxAmount>
        </cac:TaxTotal>
        <cac:Item>
            <cbc:Name>Test</cbc:Name>
            <cac:ClassifiedTaxCategory>
                <cbc:ID schemeAgencyID="6" schemeID="UNCL5305">Z</cbc:ID>
                <cbc:Percent>25</cbc:Percent>
                <cac:TaxScheme>
                    <cbc:ID>VAT</cbc:ID>
                </cac:TaxScheme>
            </cac:ClassifiedTaxCategory>
        </cac:Item>
        <cac:Price>
            <cbc:PriceAmount currencyID="NOK">1000</cbc:PriceAmount>
        </cac:Price>
    </cac:InvoiceLine>
</Invoice>
SiwMeckelborg commented 9 years ago

The reason why this validates ok, is that we do a check if the supplier is Norwegian (countrycode = NO), and in your example-file, you have no information on the supplier other than the name. With the changes that empty elements will generate an error + the updated check for mandatory fields, this file will generate lots of errors. /Siw

christian-andersson commented 9 years ago

The documentation does not Mention that the country has to be Norway, it only mentions that it is mandatory... and if it is mandatory, the country for an supplier in an EHF document does not matter.

SiwMeckelborg commented 9 years ago

We are working on a solution for this issue, and this will be changed in revision 2.0.3

SiwMeckelborg commented 9 years ago

This is fixed in the 2.0.3 files