CheckoutManager
in package
Single entry of the front end into the order core.
Always goes through the Api (api/eshop/order/checkout, /summary); the front end never
touches Doctrine order entities and never computes prices.
NOTE: does not extend App\Core\Base\Front\Models\Managers\Manager; that is for entity CRUD
over a hydrated entity, which checkout is not. See
CheckoutRepository.
Table of Contents
Properties
Methods
- __construct() : mixed
- myOrders() : array<string, mixed>
- Returns the "My orders" list. `$userId` must come from the logged-in identity of the calling presenter ({@see \Nette\Security\User::getId()}), never from GET/POST.
- paymentMethods() : array<int, array{id: int, name: string, gate: ?string}>
- Returns the list of available payment methods in `$languageId` for the e-shop footer (`PaymentMethodListComponent`): only id, name and gateway type, no prices. A failed Api call (guard/bridge) silently degrades to an empty list and the component renders no section at all (`{if $items}` in `Inline.latte`), like {@see setBuyers()}.
- place() : array<string, mixed>
- Submits the order bindingly (strict reservation, payment, state transition).
- preview() : array<string, mixed>
- Returns the cart/checkout preview: recalculation plus shipping and payment offer, without a single write.
- repeatItems() : array<string, mixed>
- Returns the data for "repeat order" (fills the cart, prices are recomputed).
- setBuyers() : array<int, int>
- Returns which of the users bought this set; basis for the "verified purchase" badge on reviews and for allowing a review to be written.
- summary() : array<string, mixed>
Properties
$service read-only
private
CheckoutService
$service
Methods
__construct()
public
__construct(CheckoutService $service) : mixed
Parameters
- $service : CheckoutService
myOrders()
Returns the "My orders" list. `$userId` must come from the logged-in identity of the calling presenter ({@see \Nette\Security\User::getId()}), never from GET/POST.
public
myOrders(int $userId[, int $limit = 20 ][, int $offset = 0 ]) : array<string, mixed>
Parameters
- $userId : int
- $limit : int = 20
- $offset : int = 0
Return values
array<string, mixed>paymentMethods()
Returns the list of available payment methods in `$languageId` for the e-shop footer (`PaymentMethodListComponent`): only id, name and gateway type, no prices. A failed Api call (guard/bridge) silently degrades to an empty list and the component renders no section at all (`{if $items}` in `Inline.latte`), like {@see setBuyers()}.
public
paymentMethods(int $languageId) : array<int, array{id: int, name: string, gate: ?string}>
Parameters
- $languageId : int
Return values
array<int, array{id: int, name: string, gate: ?string}>place()
Submits the order bindingly (strict reservation, payment, state transition).
public
place(array<string, mixed> $payload) : array<string, mixed>
Parameters
- $payload : array<string, mixed>
Return values
array<string, mixed>preview()
Returns the cart/checkout preview: recalculation plus shipping and payment offer, without a single write.
public
preview(array<string, mixed> $payload) : array<string, mixed>
Parameters
- $payload : array<string, mixed>
Return values
array<string, mixed>repeatItems()
Returns the data for "repeat order" (fills the cart, prices are recomputed).
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; basis for the "verified purchase" badge on reviews and for allowing a review to be written.
public
setBuyers(int $setId, array<int, int> $userIds) : array<int, int>
Parameters
- $setId : int
- $userIds : array<int, int>
Return values
array<int, int>summary()
public
summary(int $orderId[, int|null $userId = null ]) : array<string, mixed>
Parameters
- $orderId : int
- $userId : int|null = null