phpDocumentor

HubCallback
in package

Class HubCallback

Used for handling gambio_hub_callback.php callbacks introduced with Hub Connector v1.9.0 (Hub v12.0).

IMPORTANT: This class is completely independent from the shop. Overloading does not work.

Table of Contents

$curlRequest  : CurlRequest
Curl Request
$dbLink  : mysqli
DB connection
$isLegacyConfiguration  : bool
Indicates legacy mode (old configuration tables)
$orderStatusColor  : string
Order status Color
__construct()  : mixed
HubCallback constructor.
proceed()  : mixed
Handles the callback end echos json response.
clearPayPalSettingsCache()  : mixed
_actionClearCache()  : array<string|int, mixed>
Clears the hub callback cache.
_actionClientKeyCallback()  : array<string|int, mixed>
Stores the hub client key and the shop key, sends a http response code header and returns a json response array.
_actionCreateOrderStatusCallback()  : array<string|int, mixed>
Inserts a new order status name, sends a http response code header and returns a json response array.
_actionGetConfiguration()  : array<string|int, mixed>
Reads from gm_configuration with given keys, sends a http response code header and returns a json response array.
_actionSessionKeyCallback()  : array<string|int, mixed>
Stores the hub session key, sends a http response code header and returns a json response array.
_actionUpdateConfiguration()  : array<string|int, mixed>
Inserts into gm_configuration or updates gm_configuration with given configuration key/values, sends a http response code header and returns a json response array.
_actionUpdateOrderStatusCallback()  : array<string|int, mixed>
Updates the status of an order, sends a http response code header and resurns a json response array.
_activateGambioHubPaymentModule()  : mixed
Activates the gambio_hub payment module
_authByClientKey()  : bool
Authenticates the request with the "X-Client-Key" header.
_authByHash()  : bool
Authenticates the request with the "X-Auth-Hash" header.
_dbConnect()  : mixed
Connects to DB.
_deactivateGambioHubPaymentModule()  : mixed
Deactivates the gambio_hub payment module
_getCacheFilePath()  : string
Returns cache file path.
_getCacheValue()  : mixed
Returns cache value identified by given key.
_getDbLink()  : mysqli
Returns the DB link.
_getDefaultLanguageCode()  : string
Returns the default language code
_getIpList()  : HttpResponse
Returns the IP list data (either from cache or from a cURL request).
_getIpListUrl()  : string
Returns the IP list url.
_getIpWhitelist()  : string
Returns the IP whitelist.
_getSecureToken()  : string
Returns the secure token.
_isIpValid()  : mixed
Validates the IP.
_logOrderUpdateStatusFallback()  : mixed
Logs fallback case for updating the status of an order.
_query()  : mixed
Executes mysql query.
_realEscapeString()  : string
Escapes string for use in mysql query.
_setCacheValue()  : mixed
Stores value in cache identified by given key.
_storeSessionKey()  : mixed
Stores the Hub session key.
_validateCallbackRequest()  : HubCallback
Validate request IP

Properties

$isLegacyConfiguration

Indicates legacy mode (old configuration tables)

private bool $isLegacyConfiguration

$orderStatusColor

Order status Color

private string $orderStatusColor = '897b65'

Methods

__construct()

HubCallback constructor.

public __construct(CurlRequest $curlRequest) : mixed
Parameters
$curlRequest : CurlRequest
Return values
mixed

proceed()

Handles the callback end echos json response.

public proceed() : mixed
Return values
mixed

clearPayPalSettingsCache()

protected clearPayPalSettingsCache() : mixed
Return values
mixed

_actionClearCache()

Clears the hub callback cache.

private _actionClearCache(string $clientKey) : array<string|int, mixed>
Parameters
$clientKey : string

Client Key.

Return values
array<string|int, mixed>

Json Response Array

_actionClientKeyCallback()

Stores the hub client key and the shop key, sends a http response code header and returns a json response array.

private _actionClientKeyCallback(string $authHash, string $clientKey, string $shopKey) : array<string|int, mixed>
Parameters
$authHash : string
$clientKey : string
$shopKey : string
Return values
array<string|int, mixed>

Json response array

_actionCreateOrderStatusCallback()

Inserts a new order status name, sends a http response code header and returns a json response array.

private _actionCreateOrderStatusCallback(string $clientKey, array<string|int, mixed> $orderStatusArray) : array<string|int, mixed>
Parameters
$clientKey : string

Client Key.

$orderStatusArray : array<string|int, mixed>

Order status array.

Return values
array<string|int, mixed>

Json Response Array

_actionGetConfiguration()

Reads from gm_configuration with given keys, sends a http response code header and returns a json response array.

private _actionGetConfiguration(string $clientKey, array<string|int, mixed> $configurationKeys) : array<string|int, mixed>
Parameters
$clientKey : string

HubClientKey

$configurationKeys : array<string|int, mixed>

Determines which gm_configuration keys should be retrieved

Return values
array<string|int, mixed>

Json Response Array

_actionSessionKeyCallback()

Stores the hub session key, sends a http response code header and returns a json response array.

private _actionSessionKeyCallback(string $authHash, string $sessionKey) : array<string|int, mixed>
Parameters
$authHash : string
$sessionKey : string
Return values
array<string|int, mixed>

Json Response Array

_actionUpdateConfiguration()

Inserts into gm_configuration or updates gm_configuration with given configuration key/values, sends a http response code header and returns a json response array.

private _actionUpdateConfiguration(string $clientKey, array<string|int, mixed> $configuration) : array<string|int, mixed>
Parameters
$clientKey : string

HubClientKey

$configuration : array<string|int, mixed>

Configuration to be set

Return values
array<string|int, mixed>

Json Response Array

_actionUpdateOrderStatusCallback()

Updates the status of an order, sends a http response code header and resurns a json response array.

private _actionUpdateOrderStatusCallback(string $clientKey, int $orderId, int $orderStatusId[, mixed $comment = '' ]) : array<string|int, mixed>
Parameters
$clientKey : string
$orderId : int
$orderStatusId : int
$comment : mixed = ''
Return values
array<string|int, mixed>

Json Response Array

_activateGambioHubPaymentModule()

Activates the gambio_hub payment module

private _activateGambioHubPaymentModule() : mixed
Return values
mixed

_authByClientKey()

Authenticates the request with the "X-Client-Key" header.

private _authByClientKey(string $clientKey) : bool
Parameters
$clientKey : string
Return values
bool

The authentication result.

_authByHash()

Authenticates the request with the "X-Auth-Hash" header.

private _authByHash(AuthHash $authHash) : bool
Parameters
$authHash : AuthHash
Return values
bool

The authentication result.

_dbConnect()

Connects to DB.

private _dbConnect() : mixed
Return values
mixed

_deactivateGambioHubPaymentModule()

Deactivates the gambio_hub payment module

private _deactivateGambioHubPaymentModule() : mixed
Return values
mixed

_getCacheFilePath()

Returns cache file path.

private _getCacheFilePath(string $key) : string
Parameters
$key : string
Return values
string

_getCacheValue()

Returns cache value identified by given key.

private _getCacheValue(mixed $key) : mixed
Parameters
$key : mixed
Return values
mixed

Returns the DB link.

private _getDbLink() : mysqli
Return values
mysqli

_getDefaultLanguageCode()

Returns the default language code

private _getDefaultLanguageCode() : string
Return values
string

_getIpList()

Returns the IP list data (either from cache or from a cURL request).

private _getIpList([bool $bypassCacheValue = false ]) : HttpResponse

The Hub Connector accepts many callbacks which will trigger many requests to the IP lists file of the Hub servers. In order to save some requests the contents of the IP list must be stored in cache and only be called when no cached data were found.

Parameters
$bypassCacheValue : bool = false

Disable cache when fetching the list.

Tags
throws
Exception

If DateInterval addition fails.

Return values
HttpResponse

_getIpListUrl()

Returns the IP list url.

private _getIpListUrl() : string
Return values
string

_getIpWhitelist()

Returns the IP whitelist.

private _getIpWhitelist() : string
Return values
string

_getSecureToken()

Returns the secure token.

private static _getSecureToken() : string
Return values
string

_isIpValid()

Validates the IP.

private _isIpValid(array<string|int, mixed> $ipList) : mixed
Parameters
$ipList : array<string|int, mixed>
Return values
mixed

_logOrderUpdateStatusFallback()

Logs fallback case for updating the status of an order.

private _logOrderUpdateStatusFallback( $orderId,  $orderStatusId,  $validOrderStatusId) : mixed
Parameters
$orderId :
$orderStatusId :
$validOrderStatusId :
Return values
mixed

_query()

Executes mysql query.

private _query(mixed $query) : mixed
Parameters
$query : mixed
Return values
mixed

_realEscapeString()

Escapes string for use in mysql query.

private _realEscapeString(mixed $string) : string
Parameters
$string : mixed
Return values
string

_setCacheValue()

Stores value in cache identified by given key.

private _setCacheValue(string $key,  $value[, DateTime|null $expires = null ]) : mixed
Parameters
$key : string
$value :
$expires : DateTime|null = null
Return values
mixed

_storeSessionKey()

Stores the Hub session key.

private _storeSessionKey(AuthHash $authHash, HubSessionKey $sessionKey) : mixed
Parameters
$authHash : AuthHash
$sessionKey : HubSessionKey
Return values
mixed

Search results