CoolCMS API

PaymentRepository extends ApiRepository
in package
uses SaveTrait, PaymentCreateTrait, TaxResolveTrait, ExpressOffersTrait, VatIdCheckTrait

FinalYes

Front repository that reads through the Api bridge and uses the query cache when the service has it enabled (`cache.config.enabledServices`).

This is the deliberate opposite of ApiRepository: the front end only displays data, so a 5 minute old number is at most cosmetic, whereas the admin reads it into a form that is written back to the DB.

->useCache(false) on the query object overrides the policy for one query; it travels to the payload as ApiBridge::PARAM_USE_CACHE.

IMPORTANT: null is passed on as null (no opinion), not as true. If this layer substituted true, it would override QueryCacheContext, and reads through a front manager inside an admin request (AssetManager, ThemeManager, UserManager) would still be served from the cache. The true default therefore lives in the bridge.

Table of Contents

Constants

TAX_RESOLVE_KEYS  : array<string|int, mixed> = ['sellerId', 'paymentRegionId', 'taxDate', 'cus...
Keys the Api action accepts (named arguments — an unknown key would be a fatal error).

Properties

$apiEndpoint  : string
Api presenter path (e.g. `api/system/page`); set by each concrete repository.
$bridge  : ApiBridge

Methods

__construct()  : mixed
create()  : Result
fetchExpressOffers()  : array<int, array<string|int, mixed>>
fetchTaxDisplay()  : array<int, array<string, mixed>>
fetchTaxResolution()  : array<string|int, mixed>
fetchVatIdVerification()  : array<string, mixed>
find()  : array<string|int, mixed>
The payment page does not read `:Api:System:Payment:get` but the dedicated internal action `:Api:System:Payment:payPage` ({@see \App\UI\Api\System\Presenters\Traits\Actions\PaymentPayPageTrait}).
findAll()  : array<string|int, mixed>
findBy()  : array<string|int, mixed>
save()  : Result
updateColumns()  : Result
failSoftRead()  : array<string|int, mixed>
Normalizes a bridge response to plain data; a failed envelope or a non-array gives `[]`.
getApiCallSource()  : string
Returns the caller branch ({@see \App\Core\Bridge\ApiBridge::PARAM_SOURCE}); implemented by the Front and Admin base `ApiRepository`.

Constants

TAX_RESOLVE_KEYS

Keys the Api action accepts (named arguments — an unknown key would be a fatal error).

private array<string|int, mixed> TAX_RESOLVE_KEYS = ['sellerId', 'paymentRegionId', 'taxDate', 'customer', 'lines', 'ancillary', 'vatIdPolicy']

Properties

$apiEndpoint

Api presenter path (e.g. `api/system/page`); set by each concrete repository.

protected string $apiEndpoint = 'api/system/payment'

Methods

create()

public create(int $paymentId[, array<string|int, mixed> $urls = [] ]) : Result
Parameters
$paymentId : int
$urls : array<string|int, mixed> = []
Return values
Result

fetchExpressOffers()

public fetchExpressOffers(string $moduleCode, int $objectId) : array<int, array<string|int, mixed>>
Parameters
$moduleCode : string
$objectId : int
Return values
array<int, array<string|int, mixed>> —

empty on a bridge failure (RBAC deny, no gateway)

fetchTaxDisplay()

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

fetchTaxResolution()

public fetchTaxResolution(array<string, mixed> $request) : array<string|int, mixed>
Parameters
$request : array<string, mixed>
Return values
array<string|int, mixed> —

empty on a bridge failure (RBAC deny, invalid input)

fetchVatIdVerification()

public fetchVatIdVerification(string $vatId, bool $forceOnline, string|null $countryCode[, bool $automatic = false ]) : array<string, mixed>
Parameters
$vatId : string
$forceOnline : bool
$countryCode : string|null
$automatic : bool = false
Return values
array<string, mixed> —

empty on a bridge failure (RBAC deny, invalid input)

find()

The payment page does not read `:Api:System:Payment:get` but the dedicated internal action `:Api:System:Payment:payPage` ({@see \App\UI\Api\System\Presenters\Traits\Actions\PaymentPayPageTrait}).

public find(int $id[, string|array<int, string> $includes = [] ][, bool|null $useCache = null ]) : array<string|int, mixed>

Reason (see that trait): get is admin-only and cannot be opened to guest, because it has actionGet (reachable externally) and the Payment entity carries email, ip and encryptedSignature, which the read path cannot strip. payPage returns a positive allowlist of fields and the server does the authorization (a completed payment no, a foreign account no, an anonymous payment yes), not the caller.

$includes are deliberately ignored: the allowlist exposes no association.

Parameters
$id : int
$includes : string|array<int, string> = []
$useCache : bool|null = null
Return values
array<string|int, mixed>

findAll()

public findAll([array<string|int, mixed>|null $filters = [] ][, array<string|int, mixed>|null $orderBys = null ][, int|null $offset = null ][, int|null $limit = null ][, array<string|int, mixed>|null $columns = null ][, bool $computeTotalCount = false ][, string|array<string|int, mixed> $includes = [] ][, bool|null $useCache = null ]) : array<string|int, mixed>
Parameters
$filters : array<string|int, mixed>|null = []
$orderBys : array<string|int, mixed>|null = null
$offset : int|null = null
$limit : int|null = null
$columns : array<string|int, mixed>|null = null
$computeTotalCount : bool = false
$includes : string|array<string|int, mixed> = []
$useCache : bool|null = null
Return values
array<string|int, mixed>

findBy()

public findBy([array<string|int, mixed>|null $filters = [] ][, string|array<string|int, mixed> $includes = [] ][, bool|null $useCache = null ]) : array<string|int, mixed>
Parameters
$filters : array<string|int, mixed>|null = []
$includes : string|array<string|int, mixed> = []
$useCache : bool|null = null
Return values
array<string|int, mixed>

save()

public save(array<string, mixed> $data[, array<string, mixed> $meta = [] ][, array<int, string> $skipFields = [] ]) : Result
Parameters
$data : array<string, mixed>

extracted entity payload

$meta : array<string, mixed> = []
$skipFields : array<int, string> = []
Return values
Result

updateColumns()

public updateColumns(array<string|int, mixed> $ids, array<string, mixed> $values) : Result
Parameters
$ids : array<string|int, mixed>

ids or composite-id arrays

$values : array<string, mixed>

property name => new value

Return values
Result

failSoftRead()

Normalizes a bridge response to plain data; a failed envelope or a non-array gives `[]`.

protected failSoftRead(mixed $response, string $endpoint) : array<string|int, mixed>

NOTE: it does not log on purpose. ApiBridge::call(), which sees both the endpoint and the caller, has already written the API_FAILSOFT source=bridge line; a second copy would turn one failure into three lines in auth.log.

Parameters
$response : mixed
$endpoint : string

only for call readability; the log takes the endpoint from the bridge

Return values
array<string|int, mixed>

getApiCallSource()

Returns the caller branch ({@see \App\Core\Bridge\ApiBridge::PARAM_SOURCE}); implemented by the Front and Admin base `ApiRepository`.

protected abstract getApiCallSource() : string
Return values
string
On this page

Search results