VatIdCheckTrait
VAT id verification bridge for Front managers; same four-layer shape as {@see TaxResolveTrait}, asks `api/system/vat-id-check/verify`.
The online VIES calls of a user are rate limited (ratelimit.vatIdCheck.user*). The verify-VAT-id button is
rendered only when findVatIdOnlineChecks() says canCheckOnline, and a verifyVatId() answer carries
the updated onlineChecks to hide it after the last allowed check.
Table of Contents
Properties
- $vatIdOnlineChecks : array{unlimited: bool, canCheckOnline: bool, limit: int|null, remaining: int|null, resetsAt: string|null}|null
Methods
- findVatIdOnlineChecks() : array{unlimited: bool, canCheckOnline: bool, limit: int|null, remaining: int|null, resetsAt: string|null}
- Remaining online checks of the current user without consuming one (request cache).
- verifyVatId() : array<string, mixed>
- `forceOnline` = the button (calls VIES, counts against the limit); false = the stored evidence only.
- buildVatIdOnlineChecks() : array{unlimited: bool, canCheckOnline: bool, limit: int|null, remaining: int|null, resetsAt: string|null}
Properties
$vatIdOnlineChecks
private
array{unlimited: bool, canCheckOnline: bool, limit: int|null, remaining: int|null, resetsAt: string|null}|null
$vatIdOnlineChecks
= null
Methods
findVatIdOnlineChecks()
Remaining online checks of the current user without consuming one (request cache).
public
findVatIdOnlineChecks() : array{unlimited: bool, canCheckOnline: bool, limit: int|null, remaining: int|null, resetsAt: string|null}
A bridge failure (guest without the grant) → canCheckOnline false: hide the button.
Return values
array{unlimited: bool, canCheckOnline: bool, limit: int|null, remaining: int|null, resetsAt: string|null}verifyVatId()
`forceOnline` = the button (calls VIES, counts against the limit); false = the stored evidence only.
public
verifyVatId(string $vatId[, bool $forceOnline = false ][, string|null $countryCode = null ][, bool $automatic = false ]) : array<string, mixed>
automatic = check after a save (registration, profile): online only for a VAT id of another EU state than
the seller's, stale / missing evidence refreshed, per-IP safety cap instead of the button quota.
An exhausted limit is not an error: verified false + flag VAT_ID_CHECK_LIMIT_REACHED + onlineChecks.resetsAt.
Parameters
- $vatId : string
- $forceOnline : bool = false
- $countryCode : string|null = null
- $automatic : bool = false
Return values
array<string, mixed> —verification (verified, valid, flags, name, onlineChecks, automaticOnline, …), empty on a bridge failure
buildVatIdOnlineChecks()
private
buildVatIdOnlineChecks(array<string|int, mixed> $onlineChecks) : array{unlimited: bool, canCheckOnline: bool, limit: int|null, remaining: int|null, resetsAt: string|null}
Parameters
- $onlineChecks : array<string|int, mixed>