CoolCMS API

PaymentCallbackRegistry
in package

FinalYes

Single source of truth for where a paid payment may call back.

IMPORTANT: only callback_key decides, and the handler is fixed in code. The dispatcher (PaymentProcessorTrait::doCallback()) must never build the class and method from the DB row cms_system_payment_callbacks, otherwise a configuration editor could redirect payment processing to any container type and its public method. The DB namespace/class/function triple stays only as diagnostics (and for OrderPaymentManager::checkCallbackWiring()) and is overwritten with the registry value on save (PaymentCallbackManager::beforeSave()). A new module with payments needs a new row here and a callback seed with the same key.

Table of Contents

Constants

HANDLERS  : array<string|int, mixed> = ['ESHOP_ORDER' => [\App\UI\Api\Eshop\Models\Man...
PAYABILITY_CHECKS  : array<string|int, mixed> = ['ESHOP_ORDER' => [\App\UI\Api\Eshop\Models\Man...
Optional pre-gateway check per callback key: may this payment still be started? (`false` = its target, e.g. a cancelled order, will never be fulfilled.)
REPEATABLE  : array<string|int, mixed> = ['BAZAAR_PAYMENT', 'COMCAT_PAYMENT', 'DISCUSSIO...
Callbacks of tariffs (time / credits) that a further, different paid transaction of the same payment activates again: the money came again, so the period is added once more. Others (an e-shop order) are run once per payment; a second payment of them is money to refund, not a second order.

Methods

columnsFor()  : array{namespace: string, class: string, function: string}|null
Returns values for the DB columns (`namespace` with both leading and trailing backslash).
handlerFor()  : array{0: class-string, 1: string}|null
isRegisteredTarget()  : bool
Tells whether `class::method` (FQCN with or without a leading backslash) is an approved handler.
isRepeatableTarget()  : bool
Tells whether the handler `class::method` may run again for a further paid transaction ({@see self::REPEATABLE}).
keys()  : array<int, string>
payabilityCheckFor()  : array{0: class-string, 1: string}|null

Constants

HANDLERS

public array<string|int, mixed> HANDLERS = ['ESHOP_ORDER' => [\App\UI\Api\Eshop\Models\Managers\EshopPaymentHook::class, 'handlePayment'], 'BAZAAR_PAYMENT' => [\App\UI\Api\Bazaar\Models\Managers\PaymentItemManager::class, 'updateStatusForPayment'], 'COMCAT_PAYMENT' => [\App\UI\Api\Comcat\Models\Managers\PaymentItemManager::class, 'updateStatusForPayment'], 'DISCUSSION_PAYMENT' => [\App\UI\Api\Discussion\Models\Managers\PaymentItemManager::class, 'updateStatusForPayment'], 'SYSTEM_USER_PAYMENT' => [\App\UI\Api\System\Models\Managers\UserPaymentManager::class, 'updateStatusForPayment']]

callback_key => [class, method]

PAYABILITY_CHECKS

Optional pre-gateway check per callback key: may this payment still be started? (`false` = its target, e.g. a cancelled order, will never be fulfilled.)

public array<string|int, mixed> PAYABILITY_CHECKS = ['ESHOP_ORDER' => [\App\UI\Api\Eshop\Models\Managers\EshopPaymentHook::class, 'isPaymentPayable']]

callback_key => [class, method(Payment): bool]

REPEATABLE

Callbacks of tariffs (time / credits) that a further, different paid transaction of the same payment activates again: the money came again, so the period is added once more. Others (an e-shop order) are run once per payment; a second payment of them is money to refund, not a second order.

public array<string|int, mixed> REPEATABLE = ['BAZAAR_PAYMENT', 'COMCAT_PAYMENT', 'DISCUSSION_PAYMENT', 'SYSTEM_USER_PAYMENT']

Methods

columnsFor()

Returns values for the DB columns (`namespace` with both leading and trailing backslash).

public static columnsFor(string $callbackKey) : array{namespace: string, class: string, function: string}|null
Parameters
$callbackKey : string
Return values
array{namespace: string, class: string, function: string}|null

handlerFor()

public static handlerFor(string $callbackKey) : array{0: class-string, 1: string}|null
Parameters
$callbackKey : string
Return values
array{0: class-string, 1: string}|null

isRegisteredTarget()

Tells whether `class::method` (FQCN with or without a leading backslash) is an approved handler.

public static isRegisteredTarget(string $class, string $method) : bool
Parameters
$class : string
$method : string
Return values
bool

isRepeatableTarget()

Tells whether the handler `class::method` may run again for a further paid transaction ({@see self::REPEATABLE}).

public static isRepeatableTarget(string $class, string $method) : bool
Parameters
$class : string
$method : string
Return values
bool

payabilityCheckFor()

public static payabilityCheckFor(string $callbackKey) : array{0: class-string, 1: string}|null
Parameters
$callbackKey : string
Return values
array{0: class-string, 1: string}|null
On this page

Search results