HandlerInterface

interface DreamCommerce\ShopAppstoreLib\HandlerInterface

Interface specifying methods for handler modules.

constants

EVENT_INSTALL
install message event name
EVENT_UNINSTALL
uninstall message event name
EVENT_BILLING_INSTALL
application paid event name
EVENT_BILLING_SUBSCRIPTION
application subscription paid event name
EVENT_UPGRADE
application upgrade event name

methods

DreamCommerce\ShopAppstoreLib\HandlerInterface::actionExists($action)

Checks whether handled action is supported by library

Parameters:
  • $action (string) – action name
Return type:

boolean

Throws:

DreamCommerceHandlerException

DreamCommerce\ShopAppstoreLib\HandlerInterface::verifyPayload($payload)

Verifies provided payload

Parameters:
  • $payload (array) – payload to verify
Return type:

boolean

Throws:

DreamCommerceHandlerException

DreamCommerce\ShopAppstoreLib\HandlerInterface::dispatch($requestBody = null)

Dispatch request to desired action listener

Parameters:
  • $requestBody (array) – request body; if null - use $_POST
Return type:

boolean

Throws:

DreamCommerceHandlerException

DreamCommerce\ShopAppstoreLib\HandlerInterface::subscribe($event, $handler)

Subscribes a handler to the chosen event.

Parameters:
  • $event (string) – event type for handling by handler
  • $handler (Callable) – a handler to call when subscribed event is fired. $handler will be called with one argument of event params. If handler returns false value, event propagation is stopped.

Available $event values:

  • install - an application is being installed in shop
  • uninstall - an application is being uninstalled
  • billing_install - installation payment
  • billing_subscription - subscription payment
DreamCommerce\ShopAppstoreLib\HandlerInterface::unsubscribe($event, $handler = null)

Unsubscribes from event handling.

Parameters:
  • $event (string) – event type for handling by handler
  • $handler (null|Callable) – if is null, all handlers are unbound. Specifying particular handler, leaves alone all except chosen.

Available $event values:

  • install - an application is being installed in shop
  • uninstall - an application is being uninstalled
  • billing_install - installation payment
  • billing_subscription - subscription payment
DreamCommerce\ShopAppstoreLib\HandlerInterface::setClient(ClientInterface $client)

Sets client on this handler.

Parameters:
  • $client (ClientInterface) – client
Return type:

Client

Returns:

chain

DreamCommerce\ShopAppstoreLib\HandlerInterface::getClient()

Gets adapter bound to the handler.

Return type:ClientInterface
Returns:client
DreamCommerce\ShopAppstoreLib\HandlerInterface::getLogger()

Get bound LoggerInterface` instance.

Return type:LoggerInterface|null
DreamCommerce\ShopAppstoreLib\HandlerInterface::setLogger(LoggerInterface $logger)

Set LoggerInterface` for this client.

Parameters:
  • $logger (LoggerInterface) – instance