open-nav
    Preparing search index...

    Function validateInvoice

    • Check an invoice data report before sending it.

      Two layers run: the schema, derived from NAV's XSDs, and the business rules that are decidable from the document alone. Every finding carries NAV's own fault code where one exists, so a failure here reads the same as the rejection it prevents.

      Warnings do not make a report invalid. The distinction matters: a tax number whose check digit is wrong is worth flagging, but NAV validates tax numbers against its registry, so treating it as an error would reject documents the service accepts.

      const report = validateInvoice(invoice, { operation: 'CREATE' });
      if (!report.valid) console.error(report.errors);

      Parameters

      Returns ValidationReport