CheckoutRepository
extends ApiRepository
in package
Bridge to the order orchestration actions (`api/eshop/order/checkout` and `/summary`).
Both actions return ready scalar data, not entities, so there is nothing to hydrate:
CheckoutMapper is a thin passthrough without
changing the data shape, not a wrapper over an invented front Order entity (that would need
the whole front graph of OrderItem/Unit/Fee/Shipper/PaymentMethod/Voucher for ten numbers on
the confirmation page).
ApiBridge lives only here: nothing else in app/UI/Front holds it except repositories.
Table of Contents
Properties
- $apiEndpoint : string
- Api presenter path (e.g. `api/system/page`); set by each concrete repository.
- $bridge : ApiBridge
Methods
- __construct() : mixed
- checkout() : array<string, mixed>
- find() : array<string|int, mixed>
- findAll() : array<string|int, mixed>
- findBy() : array<string|int, mixed>
- myOrders() : array<string, mixed>
- Returns the "My orders" list.
- paymentMethods() : array<string, mixed>
- Returns the list of available payment methods (only id, name, gateway type) for the e-shop footer.
- repeatItems() : array<string, mixed>
- Returns the data for "repeat order".
- setBuyers() : array<string, mixed>
- Returns which of the users bought this set (the "verified purchase" badge on reviews).
- summary() : array<string, mixed>
- failSoftRead() : array<string|int, mixed>
- Normalizes a bridge response to plain data; a failed envelope or a non-array gives `[]`.
- getApiCallSource() : string
- Branch marker for writes ({@see ApiBridge::PARAM_SOURCE}), read by the shared repository `SaveTrait`.
Properties
$apiEndpoint
Api presenter path (e.g. `api/system/page`); set by each concrete repository.
protected
string
$apiEndpoint
= 'api/eshop/order'
$bridge read-only
protected
ApiBridge
$bridge
Methods
__construct()
public
__construct(ApiBridge $bridge) : mixed
Parameters
- $bridge : ApiBridge
checkout()
public
checkout(array<string, mixed> $payload) : array<string, mixed>
Parameters
- $payload : array<string, mixed>
Return values
array<string, mixed>find()
public
find(int $id[, string|array<string|int, mixed> $includes = [] ][, bool|null $useCache = null ]) : array<string|int, mixed>
Parameters
- $id : int
- $includes : string|array<string|int, mixed> = []
- $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>myOrders()
Returns the "My orders" list.
public
myOrders(int $userId, int $limit, int $offset) : array<string, mixed>
Parameters
- $userId : int
- $limit : int
- $offset : int
Return values
array<string, mixed>paymentMethods()
Returns the list of available payment methods (only id, name, gateway type) for the e-shop footer.
public
paymentMethods(int $languageId) : array<string, mixed>
Bridge-only OrderPresenter::internalActionPaymentMethods() (api/eshop/order/payment-methods);
it reuses the RBAC key checkout, see its docblock.
Parameters
- $languageId : int
Return values
array<string, mixed>repeatItems()
Returns the data for "repeat order".
public
repeatItems(int $orderId, int $userId) : array<string, mixed>
Parameters
- $orderId : int
- $userId : int
Return values
array<string, mixed>setBuyers()
Returns which of the users bought this set (the "verified purchase" badge on reviews).
public
setBuyers(int $setId, array<int, int> $userIds) : array<string, mixed>
IMPORTANT: userIds is sent as a comma-separated string, not an array, because the bridge
sends scalars only (same pattern as
UserRepository::findPublicProfiles()).
Parameters
- $setId : int
- $userIds : array<int, int>
Return values
array<string, mixed>summary()
public
summary(int $orderId[, int|null $userId = null ]) : array<string, mixed>
Parameters
- $orderId : int
- $userId : int|null = null
Return values
array<string, mixed>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()
Branch marker for writes ({@see ApiBridge::PARAM_SOURCE}), read by the shared repository `SaveTrait`.
protected
getApiCallSource() : string