Tax number check – system description

Endpoints of the tax authority and VIES checks, the validation log, the context-based validation cache, bulk re-validation and the bank account import.

The partner module runs tax authority (queryTaxpayer XML) and VIES checks, logs the result as an audit row and writes it to the partner's validity. Supplementary endpoints take addresses and bank accounts from invoices.

Data model

Table names carry the installation's own prefix in the database.

TableRole
company_validationvalidation log (e.g. check_type = nav_taxpayer)
company, company_address, addressvalidity, addresses
invoice_ctrlinvoice control data (source of addresses and bank accounts)
bankaccount, company_bankaccountbank accounts

Endpoints

  1. querytaxpayer: tax authority call with the 8-digit tax number (nav/xml model); credentials come from the tax authority row of the company with fixed id 10; returns name, short name, full tax number, group VAT id, addresses, validity; for an in-scope company it records validity (updateValidity) and writes an audit row.
  2. queryvies: VIES check via cURL; error when unavailable.
  3. taxpayercompare: field-by-field comparison (name, short name, tax number, registered office) with the taxpayerupdate URL; taxpayerupdate (edit): rewrites the chosen fields, optionally inserts the registered office.
  4. validate: tax number and optional VIES with a context (manual/cron/pre_invoice/pre_contract/pre_bank); outside the manual context an earlier valid validation is used as cache; audit, validity, address sync (syncCompanyAddresses).
  5. revalidatestale: info=1 → a stable list of unchecked / invalid partners (findStaleCompanies); POST ids[] → one batch (revalidateIds, manual); the library narrows to the scope.
  6. importinvoicebanks: info=1 → number of rows to process; otherwise batches with start/limit (default 200) via importInvoiceBankaccounts() for in-scope suppliers.
  7. syncinvoice: syncFromInvoiceCtrl() adds addresses and links normalised, de-duplicated bank accounts (saveBankaccountForCompany); summary.

Permissions

  • Function rights: taxpayer, revalidate, import_banks, sync_invoice; scope: validate, the validity write and syncinvoice with companyInScope.
  • Prerequisite: a tax authority technical user; outbound HTTP for VIES.

Known limitations

  • The body of the bulk tax authority refresh (taxpayer endpoint) is commented out; it always returns success with a "- teszt" suffix.
  • taxpayercompare and taxpayerupdate do not check the scope.
  • The credentials come from a fixed id.
Related topics: tax number check bank account