Skip to content

API reference

Quittio\Core\Validation

quittio/core#

Quittio\Core\Validation

  • InvoiceValidatorRuns all configured validation drivers and merges their results.
  • MessagesCreates validation messages from the message catalog.
  • Rule interfaceA business or plausibility rule checked in PHP (levels L1 to L3 and L7).
  • RuleOverridesChanges to the PHP rules by rule code: rules switched off, findings with another severity and rules replaced by own implementations. Codes match exactly or, with a trailing "*", by prefix (e.g. "DE-USTG-*"). The overrides apply to the PHP rules only; the findings of the XSD schema, KoSIT and veraPDF are never changed.
  • Severity enum
  • ValidationContextInformation available to rules while validating an invoice.
  • ValidationDriver interfaceA validation driver checks one or more levels (PHP rules, XSD, KoSIT, veraPDF, …).
  • ValidationExceptionThrown when an invoice does not pass validation. The full result is attached.
  • ValidationLevel enumValidation levels.
  • ValidationMessageA single validation finding.
  • ValidationResultResult of a validation run.
  • ValidationSubjectWhat is validated: the calculated data and, where available, the generated XML and PDF.

Quittio\Core\Validation\Drivers

  • KositArtifactsDownloads the KoSIT validator and the XRechnung validator configuration (level L5) and compiles the Peppol BIS Billing 3.0 Schematron to XSLT with the Saxon bundled in the validator (requires Java).
  • KositReportParserConverts a KoSIT validator report (VARL) into validation messages.
  • KositValidatorOfficial Schematron validation (level L5) with the KoSIT validator.
  • PhpRulesDriverBuilt-in PHP rules: levels L1 (structure), L2 (profile), L3 (business rules) and L7 (plausibility).
  • VeraPdfValidatorPDF/A conformance check (level L6) with veraPDF.
  • XsdValidatorXML schema validation (level L4) with the bundled CII D16B and UBL 2.1 schemas. XML of another syntax read by the reader of a country pack (e.g. ebInterface) is not checked here: the reader checks its structure.

Quittio\Core\Validation\Plausibility

  • IbanIBAN check digit validation (ISO 13616, mod 97-10) without extensions.
  • VatIdFormatFormat of VAT identification numbers by country prefix (structure only, no check digits).
  • VatIdVerificationResult of an online VAT identifier check. $valid is null if no statement is possible: the service was not reachable or answered with an error, or it does not cover the identifier ($supported = false).
  • VatIdVerifier interfaceOnline check of VAT identifiers (e.g. EU VIES). Implementations must never throw because a service is unavailable; they return a result with $valid = null instead.
  • ViesVerifierVAT identifier check via the REST interface of the EU VIES service.

Quittio\Core\Validation\Rules

  • CallbackRuleA rule defined by a closure. The closure receives the invoice and a reporter.
  • CodeListRulesCode list rules of EN 16931 (BR-CL-…), based on the official code lists.
  • En16931RulesEN 16931 business rules (BR-…) and conditions (BR-CO-…) checked on the data model.
  • FieldMatrixRuleMandatory and allowed fields of the selected profile (level L2), derived from the mapping attributes of the data model and the profile's additional requirements.
  • InspectHelpers shared by the rule sets.
  • PeppolRulesThe Peppol BIS Billing 3.0 rules (PEPPOL-EN16931-…, PEPPOL-COMMON-…) that the data of an invoice can violate, with readable messages. Rules that the UBL writer always satisfies and rules covered by an identical EN 16931 rule are not repeated (docs/validation.md lists them). The complete rule set is checked with the official artifacts (level L5).
  • PlausibilityRulesPlausibility checks (level L7): IBAN check digits, BIC and VAT identifier formats, e-mail addresses, date logic and the VAT category against the destination country. The VIES check is added only if a verifier is given.
  • QuittioRulesPackage rules (QUITTIO-…) that go beyond EN 16931.
  • RuleReporterCollects the findings of one rule.
  • StructureRulesStructure and data format checks of the data model (level L1).
  • VatCategoryRulesVAT category rules of EN 16931 (BR-S, BR-Z, BR-E, BR-AE, BR-IC, BR-G, BR-O, BR-AF, BR-AG, BR-B).

The open core packages are MIT licensed. The legal wording of the country packs must be confirmed by a tax adviser.