CoolCMS API

SellerTaxProfileManager
in package

The only place the VAT engine learns who the seller is for tax purposes (status on a date, country, VAT id); backs `sellerStatusAt()`.

Status history:

  • status = cms_mod_invoicer_seller_tax_statuses, the row with the newest valid_from <= date; a history that starts after the date gives null (SELLER_STATUS_MISSING),
  • a seller without any history row (created by a harness or before the history table) is derived from the flat sellers.use_vat (payer / non_payer, source SellerTaxProfile::SOURCE_USE_VAT),
  • country = sellers.country_code,
  • VAT id = first seller contact (seller_contacts.vat_id).

Reads go through SellerManager::findTaxData() / getSellerSnapshot() = raw DBAL (no UoW::clear() in the middle of a checkout graph). Cache: seller data per id, profile per id and day; call resetCache() in a long CLI process after a status change.

Explicit status (tests, harness): setStatusOverride() injects a status (typically identified) for one seller in this process. It is not reachable from any request or bridge parameter.

Table of Contents

Constants

DEFAULT_COUNTRY_CODE  : string = 'CZ'
Fallback seller country (placeholder when the country table is empty).

Properties

$profiles  : array<string, SellerTaxProfile|false>
$sellerManager  : SellerManager
$sellers  : array<int, array{countryCode: string, useVat: bool, statuses: list, vatId: string|null}|false>
$statusOverrides  : array<int, SellerVatStatus>

Methods

__construct()  : mixed
findProfile()  : SellerTaxProfile|null
Tax profile of the seller valid on `$at`; null = no seller / no status on that date (the engine flags `SELLER_STATUS_MISSING`).
resetCache()  : void
Drops the request cache (long-running CLI after an admin change of a seller).
setStatusOverride()  : void
Test / harness seam: force a status for one seller in this process (null removes it).
buildProfile()  : SellerTaxProfile|null
loadSeller()  : array{countryCode: string, useVat: bool, statuses: list, vatId: string|null}|null

Constants

DEFAULT_COUNTRY_CODE

Fallback seller country (placeholder when the country table is empty).

public string DEFAULT_COUNTRY_CODE = 'CZ'

Properties

$sellers

private array<int, array{countryCode: string, useVat: bool, statuses: list, vatId: string|null}|false> $sellers = []

false = seller not found

Methods

findProfile()

Tax profile of the seller valid on `$at`; null = no seller / no status on that date (the engine flags `SELLER_STATUS_MISSING`).

public findProfile(int $sellerId, DateTimeInterface $at) : SellerTaxProfile|null
Parameters
$sellerId : int
$at : DateTimeInterface
Return values
SellerTaxProfile|null

resetCache()

Drops the request cache (long-running CLI after an admin change of a seller).

public resetCache() : void

loadSeller()

private loadSeller(int $sellerId) : array{countryCode: string, useVat: bool, statuses: list, vatId: string|null}|null
Parameters
$sellerId : int
Return values
array{countryCode: string, useVat: bool, statuses: list, vatId: string|null}|null
On this page

Search results