CoolCMS API

ExpressPaymentTrait

Wires the express-payment (premium SMS) section into a module presenter.

The mapping tariff + quick price -> ExpressPaymentItemDto is identical in every module that has quick prices, so it lives here; the two module-specific bits are the tariff source and the reference that identifies what is being paid for. The trait sits in Core/Traits/Front and therefore injects only Front types — the module tariff manager stays in the module's own trait (see the layering rule for #[Inject] traits).

Sending the SMS activates the tariff through the operator's callback, so nothing is persisted here — this section only tells the visitor what to send and where.

Text and number come from the receiving end (api/system/payment/express-offers): text = <gateway keyword> <module> <service> <id>, number = the gateway number whose price equals the quick price. The Api composes both because the keyword sits in gateway settings next to the shared secret. A quick price without an offer (no number for its price, gateway off) is not shown — the SMS could never activate it.

Table of Contents

Properties

$expressPaymentFactory  : ExpressPaymentFactory
$expressPaymentManager  : PaymentManager
$expressPaymentCurrencies  : array<int, object|null>

Methods

createComponentExpressPayment()  : ExpressPayment
findExpressPaymentTariffs()  : iterable<string|int, ExpressTariffInterface>
Tariffs whose quick prices may be offered — module manager, module entity.
getExpressPaymentHeading()  : string|null
Section heading, or null for the component's own generic one.
getExpressPaymentModuleCode()  : string
Module word of the SMS, one of {@see \App\Core\Payments\Express\ExpressModuleCode}.
getExpressPaymentReference()  : string|null
Id of the object the SMS pays for — the last word of the text, e.g. `VYTVORWEB INZ TOP 956`.
getExpressPaymentRegionId()  : int|null
Payment region to offer, or null for every region that has the quick price switched on. Null is the default because an advert detail — unlike the payment page — carries no `pr` parameter, and `active` is already the per-region switch the administrator sets on the tariff.
buildExpressPaymentItems()  : array<int, ExpressPaymentItemDto>
findExpressPaymentCurrency()  : object|null
findExpressPaymentOffers()  : array<string, array{smsText: string, phone: string}>
Offers keyed by `tariffId|paymentRegionId` — the identity of a quick price row.
isExpressPaymentOffered()  : bool
A row exists for every region the moment a tariff is saved, so `active` alone is not enough — an untouched region row is active-less but also keyword-less, and without a keyword or a number there is nothing the visitor could send.

Properties

$expressPaymentCurrencies

private array<int, object|null> $expressPaymentCurrencies = []

Currency per id, resolved once per request.

Methods

getExpressPaymentHeading()

Section heading, or null for the component's own generic one.

protected getExpressPaymentHeading() : string|null
Return values
string|null

getExpressPaymentModuleCode()

Module word of the SMS, one of {@see \App\Core\Payments\Express\ExpressModuleCode}.

protected abstract getExpressPaymentModuleCode() : string
Return values
string

getExpressPaymentReference()

Id of the object the SMS pays for — the last word of the text, e.g. `VYTVORWEB INZ TOP 956`.

protected abstract getExpressPaymentReference() : string|null

Null switches the whole section off (no advert on the page, nothing to top).

Return values
string|null

getExpressPaymentRegionId()

Payment region to offer, or null for every region that has the quick price switched on. Null is the default because an advert detail — unlike the payment page — carries no `pr` parameter, and `active` is already the per-region switch the administrator sets on the tariff.

protected getExpressPaymentRegionId() : int|null
Return values
int|null

findExpressPaymentCurrency()

private findExpressPaymentCurrency(int|null $currencyId) : object|null
Parameters
$currencyId : int|null
Return values
object|null

findExpressPaymentOffers()

Offers keyed by `tariffId|paymentRegionId` — the identity of a quick price row.

private findExpressPaymentOffers(int $objectId) : array<string, array{smsText: string, phone: string}>
Parameters
$objectId : int
Return values
array<string, array{smsText: string, phone: string}>

isExpressPaymentOffered()

A row exists for every region the moment a tariff is saved, so `active` alone is not enough — an untouched region row is active-less but also keyword-less, and without a keyword or a number there is nothing the visitor could send.

private isExpressPaymentOffered(TariffQuickPriceInterface $quickPrice, int|null $regionId) : bool
Parameters
$quickPrice : TariffQuickPriceInterface
$regionId : int|null
Return values
bool
On this page

Search results