Skip to content

Class FacturXValidator

Validates a Factur-X against the business rules defined in the Factur-X specification.

Assembly: FacturXDotNet.dll
csharp
public class FacturXValidator

Methods

ValidateAsync(FacturXDocument, string?, string?, CancellationToken)

Determines whether the given invoice satisfies all applicable business rules.

csharp
public Task<bool> ValidateAsync(FacturXDocument invoice, string? ciiAttachmentName = null, string? password = null, CancellationToken cancellationToken = default)
Returns

System.Threading.Tasks.Task<System.Boolean>: true if the invoice meets all required business rules; otherwise, false.

Parameters
TypeNameDescription
FacturXDotNet.FacturXDocumentinvoiceThe invoice to validate.
System.StringciiAttachmentNameThe name of the attachment containing the Cross-Industry Invoice XML file. If not specified, the default name 'factur-x.xml' will be used.
System.StringpasswordThe password to open the PDF document.
System.Threading.CancellationTokencancellationTokenThe cancellation token.

ValidateRuleAsync(FacturXDocument, string, string?, string?, CancellationToken)

Determines wheter the given invoice satisfies the specified business rule.

csharp
public Task<bool> ValidateRuleAsync(FacturXDocument invoice, string businessRuleName, string? ciiAttachmentName = null, string? password = null, CancellationToken cancellationToken = default)
Returns

System.Threading.Tasks.Task<System.Boolean>: true if the invoice meets the specified business rule; otherwise, false.

Parameters
TypeNameDescription
FacturXDotNet.FacturXDocumentinvoiceThe invoice to validate.
System.StringbusinessRuleNameThe name of the business rule to validate, e.g. BR-1.
System.StringciiAttachmentNameThe name of the attachment containing the Cross-Industry Invoice XML file. If not specified, the default name 'factur-x.xml' will be used.
System.StringpasswordThe password to open the PDF document.
System.Threading.CancellationTokencancellationTokenThe cancellation token.

GetValidationResultAsync(FacturXDocument, string?, string?, CancellationToken)

Computes a detailed validation result for the given invoice.

csharp
public Task<FacturXValidationResult> GetValidationResultAsync(FacturXDocument invoice, string? ciiAttachmentName = null, string? password = null, CancellationToken cancellationToken = default)
Returns

System.Threading.Tasks.Task<FacturXDotNet.Validation.FacturXValidationResult>: A FacturXDotNet.Validation.FacturXValidationResult containing details of passed, failed, and skipped business rules.

Parameters
TypeNameDescription
FacturXDotNet.FacturXDocumentinvoiceThe invoice to validate.
System.StringciiAttachmentNameThe name of the attachment containing the Cross-Industry Invoice XML file. If not specified, the default name 'factur-x.xml' will be used.
System.StringpasswordThe password to open the PDF document.
System.Threading.CancellationTokencancellationTokenThe cancellation token.

The tools are open source and released under the MIT License, feel free to use, modify, and share.