ValidateInvoiceBusinessRules

Invoices, Compliance

Description

Validate the selected embedded invoice XML with a versioned provider

Syntax

Delphi

Function TPDFlib.ValidateInvoiceBusinessRules(Const EmbeddedFileName: WideString;
  Const Request: TPDFInvoiceValidationRequest;
  Const Provider: IPDFInvoiceValidationProvider;
  Out Report: TPDFInvoiceValidationReport): Boolean;

Remarks

Finds a document-level embedded attachment by its exact, case-sensitive filename and replaces Request.XMLBytes with the decoded attachment bytes; caller-supplied XML cannot substitute for the actual invoice

Returns true only when every requested stage completes successfully; Report.Complete=true with IsValid=false distinguishes a completed validation that found issues from unavailable engines, malformed inputs, or incomplete runs

Missing, ambiguous, unreadable, or oversized attachments return false with LastErrorCode=401 and an Invoice.Attachment* diagnostic; matching is bounded to 16384 attachments and decoding to 64 MB

Set Request.Rules.Standard and Version explicitly and supply trusted rule files for the exact syntax and profile, including any required profile-specific rules

PLDefaultInvoiceValidationRequest requires both schema and Schematron stages, sets a 30000 ms timeout and an 8 MB output limit; callers can disable a stage explicitly, which remains not_checked and makes no claim about those rules

IPDFInvoiceValidationProvider.ValidateStage receives the selected XML and rule package and must return a complete stage result, engine diagnostics, and structured issues; unavailable and exceptional providers cannot pass

Use PLValidateInvoiceXML directly for standalone invoice XML, PLCreateExternalInvoiceValidationProvider for the built-in tool adapter, and PLInvoiceValidationReportToJSON to serialize typed results

See also

ValidateFacturXInvoice, ValidateInvoiceBusinessRules, ValidateInvoiceBusinessRulesWithTools, ExtractFacturXXMLToString