CoolCMS API

VatIdCheckVerifyTrait

VAT id verification actions: `api/system/vat-id-check/verify` and `.../save-manual`.

Internal only (no action*(), same reasoning as TaxResolveTrait): an online VIES call must not be reachable from the internet. RBAC:

  • :Api:System:VatIdCheck:verify - registrated + admin (profile / address book save, admin button),
  • :Api:System:VatIdCheck:saveManual - admin only (manual evidence, "prove the company").

Online rate limit (ratelimit.vatIdCheck.user*, default 5 per 24 h per user): only a real VIES call counts (forceOnline, or a stale answer refreshed); an answer from the evidence does not. When exhausted there is no VIES call, the stored row decides and the flag VAT_ID_CHECK_LIMIT_REACHED is set. A privileged role (admin) is not limited; saveManual never calls VIES and never counts.

Every verify response carries onlineChecks = {unlimited, canCheckOnline, limit, remaining, resetsAt} after the call; the UI hides the "verify VAT id" button when canCheckOnline is false. There is no separate quota action (and no extra RBAC key): vatId = '' returns just a "not verified" shell with onlineChecks, with no DB read and no VIES.

Automatic check on save (automatic = true: registration, profile save, address book save): the rules are in VatIdAutoCheckManager. Online only for a VAT id of another EU member state than the seller country (automaticOnline false otherwise, the stored evidence answers), policy RefreshStale, counter = the per-IP safety cap VatIdCheckManager::buildAutoCheckLimit(); onlineChecks still reports the button quota. forceOnline is ignored in this mode. A save is never blocked, the caller only shows the state.

Table of Contents

Methods

internalActionSaveManual()  : array<string, mixed>|ApiPermissionDeniedShape
internalActionVerify()  : array<string, mixed>|ApiPermissionDeniedShape

Methods

internalActionSaveManual()

public internalActionSaveManual(string $countryCode, string $vatNumber, bool $valid, string $note[, string|null $name = null ][, string|null $address = null ]) : array<string, mixed>|ApiPermissionDeniedShape
Parameters
$countryCode : string
$vatNumber : string
$valid : bool
$note : string
$name : string|null = null
$address : string|null = null
Return values
array<string, mixed>|ApiPermissionDeniedShape

internalActionVerify()

public internalActionVerify(string $vatId[, bool $forceOnline = false ][, int|null $sellerId = null ][, string|null $countryCode = null ][, bool $automatic = false ]) : array<string, mixed>|ApiPermissionDeniedShape
Parameters
$vatId : string
$forceOnline : bool = false
$sellerId : int|null = null
$countryCode : string|null = null
$automatic : bool = false
Return values
array<string, mixed>|ApiPermissionDeniedShape
On this page

Search results