BazaarExpressServiceProvider
extends AbstractQuickPriceExpressServiceProvider
in package
Express SMS services of the Bazaar: `<KEYWORD> INZ <SERVICE> <advert id>`, services = Bazaar tariffs with an active quick price. Activation = callback `BAZAAR_PAYMENT` ({@see PaymentItemManager::updateStatusForPayment()}), same as a payment from the payment form.
Table of Contents
Properties
- $advertManager : AdvertManager
- $paymentItemManager : PaymentItemManager
- $tariffManager : TariffManager
Methods
- __construct() : mixed
- createPaymentItems() : bool
- Create the module payment items (inactive) for a payment the System layer just created.
- describe() : array<int, ExpressServiceDescription>
- Every express service the module offers right now through the gateway, for the administration overview and the Front offers.
- getModuleCode() : string
- Module word of the SMS text, one of {@see ExpressModuleCode}.
- hasPaymentItems() : bool
- Does the payment already have the module payment items? Read straight from the DB. The resumed processing of a redelivered SMS (the first run crashed after the payment was saved) asks before {@see createPaymentItems()} — a second set of items would activate twice.
- resolve() : ExpressResolution
- Validate the untrusted SMS data: the service must be one the module offers right now (an active quick price, or a tariff price for the gateway), the object must exist and be active.
- bindPaymentItemObject() : bool
- Point the new payment item at the object. Advert default: `setAdvertId()`.
- buildObjectLabel() : string
- Short label of the object for the customer reply, e.g. `inzerat 956` (SMS = `ASCII`).
- createPaymentItemEntity() : BaseEntity
- New, empty module payment item entity.
- findActiveTariffs() : iterable<string|int, BaseEntity>
- Active tariffs with `translations` and `quickPrices` loaded.
- findObject() : BaseEntity|null
- Object by id (module Api manager), null = does not exist.
- findPaymentItemByPayment() : BaseEntity|null
- Any module payment item of the payment (module Api manager), null = none yet.
- getCallbackKey() : string
- `cms_system_payment_callbacks.callback_key` of the module (activates its payment items).
- isObjectActive() : bool
- Can the object still be paid for? Advert default: `active = 1` (approved, paid, not banned, deactivated nor sold — the advert entity folds that into one column).
- savePaymentItem() : bool
- Persist a new module payment item through the module manager (its save hooks included).
Properties
$advertManager read-only
private
AdvertManager
$advertManager
$paymentItemManager read-only
private
PaymentItemManager
$paymentItemManager
$tariffManager read-only
private
TariffManager
$tariffManager
Methods
__construct()
public
__construct(AdvertManager $advertManager, TariffManager $tariffManager, PaymentItemManager $paymentItemManager) : mixed
Parameters
- $advertManager : AdvertManager
- $tariffManager : TariffManager
- $paymentItemManager : PaymentItemManager
createPaymentItems()
Create the module payment items (inactive) for a payment the System layer just created.
public
createPaymentItems(ExpressTarget $target, int $paymentId) : bool
The payment callback activates them once the payment is completed.
Parameters
- $target : ExpressTarget
- $paymentId : int
Return values
booldescribe()
Every express service the module offers right now through the gateway, for the administration overview and the Front offers.
public
describe(int $paymentGateId) : array<int, ExpressServiceDescription>
Parameters
- $paymentGateId : int
Return values
array<int, ExpressServiceDescription>getModuleCode()
Module word of the SMS text, one of {@see ExpressModuleCode}.
public
getModuleCode() : string
Return values
stringhasPaymentItems()
Does the payment already have the module payment items? Read straight from the DB. The resumed processing of a redelivered SMS (the first run crashed after the payment was saved) asks before {@see createPaymentItems()} — a second set of items would activate twice.
public
hasPaymentItems(int $paymentId) : bool
Parameters
- $paymentId : int
Return values
boolresolve()
Validate the untrusted SMS data: the service must be one the module offers right now (an active quick price, or a tariff price for the gateway), the object must exist and be active.
public
resolve(string $serviceCode, int $objectId, int $paymentGateId) : ExpressResolution
Returns one target per payment region / tariff offering it — the System layer then picks the one whose price and currency equal the number the SMS was sent to.
$paymentGateId = the SMS gateway that received the message; modules whose prices differ per
gateway (user tariffs) read their price for it, quick price modules ignore it.
Parameters
- $serviceCode : string
- $objectId : int
- $paymentGateId : int
Return values
ExpressResolutionbindPaymentItemObject()
Point the new payment item at the object. Advert default: `setAdvertId()`.
protected
bindPaymentItemObject(BaseEntity $paymentItem, int $objectId) : bool
False = the item entity has no such setter (wrong wiring) → the SMS fails with a claim code.
Parameters
- $paymentItem : BaseEntity
- $objectId : int
Return values
boolbuildObjectLabel()
Short label of the object for the customer reply, e.g. `inzerat 956` (SMS = `ASCII`).
protected
buildObjectLabel(int $objectId) : string
Parameters
- $objectId : int
Return values
stringcreatePaymentItemEntity()
New, empty module payment item entity.
protected
createPaymentItemEntity() : BaseEntity
Return values
BaseEntityfindActiveTariffs()
Active tariffs with `translations` and `quickPrices` loaded.
protected
findActiveTariffs() : iterable<string|int, BaseEntity>
Return values
iterable<string|int, BaseEntity>findObject()
Object by id (module Api manager), null = does not exist.
protected
findObject(int $objectId) : BaseEntity|null
Parameters
- $objectId : int
Return values
BaseEntity|nullfindPaymentItemByPayment()
Any module payment item of the payment (module Api manager), null = none yet.
protected
findPaymentItemByPayment(int $paymentId) : BaseEntity|null
Parameters
- $paymentId : int
Return values
BaseEntity|nullgetCallbackKey()
`cms_system_payment_callbacks.callback_key` of the module (activates its payment items).
protected
getCallbackKey() : string
Return values
stringisObjectActive()
Can the object still be paid for? Advert default: `active = 1` (approved, paid, not banned, deactivated nor sold — the advert entity folds that into one column).
protected
isObjectActive(BaseEntity $object) : bool
Parameters
- $object : BaseEntity
Return values
boolsavePaymentItem()
Persist a new module payment item through the module manager (its save hooks included).
protected
savePaymentItem(BaseEntity $paymentItem) : bool
Parameters
- $paymentItem : BaseEntity