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
Type | Name | Description |
---|---|---|
FacturXDotNet.FacturXDocument | invoice | The invoice to validate. |
System.String | ciiAttachmentName | The name of the attachment containing the Cross-Industry Invoice XML file. If not specified, the default name 'factur-x.xml' will be used. |
System.String | password | The password to open the PDF document. |
System.Threading.CancellationToken | cancellationToken | The 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
Type | Name | Description |
---|---|---|
FacturXDotNet.FacturXDocument | invoice | The invoice to validate. |
System.String | businessRuleName | The name of the business rule to validate, e.g. BR-1 . |
System.String | ciiAttachmentName | The name of the attachment containing the Cross-Industry Invoice XML file. If not specified, the default name 'factur-x.xml' will be used. |
System.String | password | The password to open the PDF document. |
System.Threading.CancellationToken | cancellationToken | The 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
Type | Name | Description |
---|---|---|
FacturXDotNet.FacturXDocument | invoice | The invoice to validate. |
System.String | ciiAttachmentName | The name of the attachment containing the Cross-Industry Invoice XML file. If not specified, the default name 'factur-x.xml' will be used. |
System.String | password | The password to open the PDF document. |
System.Threading.CancellationToken | cancellationToken | The cancellation token. |