Documentation Index
Fetch the complete documentation index at: https://mintlify.com/mdiago/VeriFactu/llms.txt
Use this file to discover all available pages before exploring further.
InvoiceEntry is the primary class for submitting new invoice records to the AEAT. It wraps an Invoice object, validates it against VERI*FACTU business rules at construction time, adds the record to the seller’s local blockchain, serializes it to a SOAP/XML envelope, and submits it to the AEAT endpoint — all in a single call to .Save().
Namespace
VeriFactu.Business
Herencia
Constructor
InvoiceEntry(Invoice invoice)
Creates a new entry and immediately validates the Invoice against business rules.
A fully populated
Invoice instance. SellerName must be set. Validation runs synchronously in the constructor; if any rule is violated an InvalidOperationException is thrown before the object is usable.GetBusErrors()):
- An entry for the same seller + year + invoice number must not already exist on disk.
Invoice.SellerNamemust not be null or empty.Invoice.RectificationItems.Countmust be ≤ 1 000.Invoice.TaxItems.Countmust be ≤ 12.- Each
TaxItemwith aTaxExceptionset must have zero values for rate/amount fields. - All AEAT specification validation rules via
InvoiceValidation.
InvalidOperationException listing all validation errors if any are found.
Método Save()
- Validates that
Save()has not already been called on this instance. - Verifies the configured AEAT certificate is present and valid.
- Adds the
RegistroAltato the seller’s blockchain (assigns the chain link ID and timestamp). - Regenerates the SOAP/XML payload with the now-populated blockchain hash fields.
- Writes the XML file to the outbox directory (
OutboxPath). - Sends the XML to the AEAT VERI*FACTU SOAP endpoint.
- Processes the AEAT response: populates
Status,CSV,ErrorCode,ErrorDescription. - On success, saves both the request and response XML files to disk.
- On failure, automatically rolls back the blockchain entry (
ClearPost()), renames affected files to.ERR.*suffixes, and re-throws aSendException.
Optional. An
X509Certificate2 to use for the HTTPS request. If omitted, the certificate configured in Settings.Current is used.InvalidOperationException if called more than once on the same instance.Throws
SendException (wrapping the original exception) on any communication or processing failure.
Propiedades de respuesta
These properties are populated afterSave() completes.
Overall submission status returned by the AEAT (
EstadoEnvio). Common values:"Correcto"— all records accepted."ParcialmenteCorrecto"— accepted with errors on individual lines."Incorrecto"— submission rejected.
null before Save() is called.Secure Verification Code (
Código Seguro de Verificación) assigned by the AEAT to the submission. Non-null only when the submission is accepted ("Correcto" or "ParcialmenteCorrecto" with "AceptadoConErrores" on the line).AEAT error code. Populated from the SOAP Fault
faultcode or from CodigoErrorRegistro on the response line. null when there is no error.Human-readable error message. Populated from the SOAP Fault
faultstring or from DescripcionErrorRegistro. null when there is no error.Raw XML string of the AEAT SOAP response. Useful for debugging or archiving.
null before Save() is called.true after the record has been successfully added to the local blockchain. Set to false again if ClearPost() is triggered during a rollback.true after the SOAP request has been dispatched to the AEAT (regardless of the AEAT’s response status).Binary content of the SOAP/XML envelope sent to the AEAT. Regenerated after the blockchain step so it includes the correct hash chain fields.
Blockchain link ID zero-padded to 20 characters (e.g.
"00000000000000000042"). null until the blockchain step completes.The blockchain manager instance handling the seller’s chain. Resolved from
Blockchain.Blockchain.Get(Invoice.SellerID) at construction time.Método GetBusErrors()
InvoiceAction (the base class) and called automatically during construction. Call it explicitly on an InvoiceAction instance before constructing InvoiceEntry if you want to inspect errors programmatically rather than catching an exception.
Returns: List<string> — empty if the invoice is valid; one entry per violated rule otherwise.