CoolCMS API

TaxResolveTrait

VAT engine bridge: `api/system/tax/resolve` and `api/system/tax/resolve-display`.

The front end never computes a rate and cannot read Invoicer tables (seller status), so it asks here.

Internal only: there is no actionResolve() / actionResolveDisplay(), and they must not get one. Without action* Nette rejects an external request with 404 before anything loads, so resolve with vatIdPolicy=refresh_stale (an online VIES call) cannot be triggered from the internet directly. The RBAC keys :Api:System:Tax:resolve / :Api:System:Tax:resolveDisplay (guest, registrated and admin) are a decision about the bridge path only. IMPORTANT: without these grants the guard (internalMode: enforce) returns a silent empty envelope; the front traits then fall back to "no VAT info" and consumers must treat it as a failure, never as "no VAT".

Online VIES safety cap: refresh_stale may call VIES (a stale, missing or invalid answer is refreshed). Those real calls count against a per-IP cap (ratelimit.vatIdCheck.autoIp*), separate from the quota of the "verify VAT id" button, see VatIdCheckManager::buildAutoCheckLimit(). When exhausted, the resolution treats the VAT id as not verified and carries VAT_ID_CHECK_LIMIT_REACHED. A privileged role is not capped.

Seller: sellerId null means the portal seller 7/invoice.default.sellerId (the chain of InvoiceGenerator). Seller status is derived through SellerTaxProfileManager (status history on the tax date; no history = sellers.use_vat). A status override is not a request parameter.

Table of Contents

Methods

internalActionResolve()  : array<string, mixed>|ApiPermissionDeniedShape
internalActionResolveDisplay()  : array<string, mixed>|ApiPermissionDeniedShape
Batch display for catalogs: `{supplyKindId: {chargeVat, vatPercents, code, flags}}` for an anonymous consumer in the country of the payment region.
buildTaxFailure()  : array<string, mixed>
buildTaxLine()  : TaxLine
buildTaxVatIdCheckLimit()  : VatIdCheckLimit|null
findString()  : string|null
findTaxSellerId()  : int|null
Portal seller — `7/invoice.default.sellerId`, the same chain as the payment invoicing.
parseTaxDate()  : DateTimeImmutable|null

Methods

internalActionResolve()

public internalActionResolve([int|null $sellerId = null ][, int|null $paymentRegionId = null ][, string|null $taxDate = null ][, array{countryCode?: string|null, dlvCountryCode?: string|null, isBusiness?: bool|int|string|null, vatId?: string|null, regNo?: string|null, supplyPlaceCountryCode?: string|null} $customer = [] ][, array<int, array{supplyKindId?: int|string|null, amount?: string|int|float, grossPrice?: bool|int|string, currencyId?: int|string|null}> $lines = [] ][, array{amount?: string|int|float, grossPrice?: bool|int|string}|null $ancillary = null ][, string $vatIdPolicy = 'cache_only' ]) : array<string, mixed>|ApiPermissionDeniedShape
Parameters
$sellerId : int|null = null
$paymentRegionId : int|null = null
$taxDate : string|null = null
$customer : array{countryCode?: string|null, dlvCountryCode?: string|null, isBusiness?: bool|int|string|null, vatId?: string|null, regNo?: string|null, supplyPlaceCountryCode?: string|null} = []
$lines : array<int, array{supplyKindId?: int|string|null, amount?: string|int|float, grossPrice?: bool|int|string, currencyId?: int|string|null}> = []

a line without supplyKindId (null / 0) gets the default supply kind (is_default: paid category, item without a kind)

$ancillary : array{amount?: string|int|float, grossPrice?: bool|int|string}|null = null
$vatIdPolicy : string = 'cache_only'
Return values
array<string, mixed>|ApiPermissionDeniedShape

internalActionResolveDisplay()

Batch display for catalogs: `{supplyKindId: {chargeVat, vatPercents, code, flags}}` for an anonymous consumer in the country of the payment region.

public internalActionResolveDisplay([int|null $sellerId = null ][, int|null $paymentRegionId = null ][, array<int, int|string> $supplyKindIds = [] ][, string|null $taxDate = null ]) : array<string, mixed>|ApiPermissionDeniedShape
Parameters
$sellerId : int|null = null
$paymentRegionId : int|null = null
$supplyKindIds : array<int, int|string> = []
$taxDate : string|null = null
Return values
array<string, mixed>|ApiPermissionDeniedShape

buildTaxFailure()

private buildTaxFailure(string $message) : array<string, mixed>
Parameters
$message : string
Return values
array<string, mixed> —

failure envelope (same shape as every Api Result)

findString()

private findString(array<string, mixed> $values, string $key) : string|null
Parameters
$values : array<string, mixed>
$key : string
Return values
string|null

findTaxSellerId()

Portal seller — `7/invoice.default.sellerId`, the same chain as the payment invoicing.

private findTaxSellerId() : int|null
Return values
int|null

parseTaxDate()

private parseTaxDate(string|null $taxDate) : DateTimeImmutable|null
Parameters
$taxDate : string|null
Return values
DateTimeImmutable|null
On this page

Search results