Class GatewayManager
Gateway manager. Handles installing/uninstalling and configuring payment
gateways.
-
Model
-
AppModel
-
GatewayManager
Methods summary
public
|
#
__construct( )
Initialize GatewayManager
Initialize GatewayManager
Overrides
|
public
array
|
#
getAll( integer $company_id, string $type = null, array $order = array('gateways.name'=>"ASC"), string $currency = null )
Lists all installed gateways
Lists all installed gateways
Parameters
- $company_id
integer $company_id The company ID
- $type
string $type The type of gateways to fetch ("merchant", "nonmerchant") set to null for
both
- $order
string $order A key/value array where each key is a field and each value is the
direction to sort
- $currency
string $currency The ISO 4217 currency code
Returns
array An array of stdClass objects representing installed gateways
|
public
mixed
|
#
getInstalledMerchant( integer $company_id, integer $currency, integer $gateway_id = null, boolean $include_info = false )
Fetches a single installed merchant gateway including meta data and currency
association. Fetches based on $company_id and optionally by specifying a
specific gateway ID.
Fetches a single installed merchant gateway including meta data and currency
association. Fetches based on $company_id and optionally by specifying a
specific gateway ID.
Parameters
- $company_id
integer $company_id The ID of the company in use
- $currency
integer $currency The ISO 4217 currency code to process
- $gateway_id
integer $gateway_id The gateway ID to verify is installed and active for the given
currency
- $include_info
boolean $include_info True to include gateway info from the source file
Returns
mixed A stdClass object representing the installed gateway, false if no such gateway
exists or is not installed
|
public
mixed
|
#
getInstalledNonmerchant( integer $company_id, integer $gateway_name = null, integer $gateway_id = null, integer $currency = null, boolean $include_info = false )
Fetches the requested installed nonmerchant gateway including meta data and
currency association. Fetches based on company_id and gateway name.
Fetches the requested installed nonmerchant gateway including meta data and
currency association. Fetches based on company_id and gateway name.
Parameters
- $company_id
integer $company_id The ID of the company in use
- $gateway_name
integer $gateway_name The installed gateway's file name excluding any extension
- $gateway_id
integer $gateway_id The gateway ID to verify is installed and active for the given
currency
- $currency
integer $currency The ISO 4217 currency code to process
- $include_info
boolean $include_info True to include gateway info, false otherwise
Returns
mixed A stdClass object representing the installed gateway, false if no such gateway
exists or is not installed
|
public
array
|
#
getAllInstalledNonmerchant( integer $company_id, integer $currency = null )
Fetches all requested installed nonmerchant gateways including meta data and
currency association for each. Fetches based on company_id and currency.
Fetches all requested installed nonmerchant gateways including meta data and
currency association for each. Fetches based on company_id and currency.
Parameters
- $company_id
integer $company_id The ID of the company in use
- $currency
integer $currency The ISO 4217 currency code to process
Returns
array An array of stdClass objects, each representing an installed gateway
|
public
array
|
#
getInstalled( )
Fetches all gateways installed in the system
Fetches all gateways installed in the system
Returns
array An array of stdClass objects, each representing an installed gateway record
|
public
mixed
|
#
get( integer $gateway_id )
Fetches a single installed gateway including meta data and currency
association
Fetches a single installed gateway including meta data and currency
association
Parameters
- $gateway_id
integer $gateway_id The ID of the gateway to fetch
Returns
mixed A stdClass object representing the installed gateway, false if no such gateway
exists
|
public
array
|
#
getAvailable( string $type = null, integer $company_id = null )
Lists all available gateways (those that exist on the file system)
Lists all available gateways (those that exist on the file system)
Parameters
- $type
string $type The type of gateways to look for ("merchant", "nonmerchant"). Set to null
for both
- $company_id
integer $company_id The ID of the company to check availability status for
Returns
array An array of stdClass objects representing available gateways
|
public
boolean
|
#
isInstalled( string $class, string $type, string $company_id = null )
Checks whether the given gateway is installed for the specificed company
Checks whether the given gateway is installed for the specificed company
Parameters
- $class
string $class The gateway class (in file_case)
- $type
string $type The type of gateway (merchant, nonmerchant)
- $company_id
string $company_id The ID of hte company to fetch for
Returns
boolean True if the gateway is installed, false otherwise
|
public
integer
|
#
add( array $vars )
Adds the gateway to the system
Adds the gateway to the system
Parameters
- $vars
array $vars An array of gateway data including: - company_id The ID of the company the
gateway belongs to - class The class name for this gateway (in
/components/gateways/) - type The type of gateway ('merchant', 'nonmerchant',
'hybrid')
Returns
integer The ID of the gateway installed, void on error
|
public
|
#
edit( integer $gateway_id, array $vars )
Updates the gateway installed on the system
Updates the gateway installed on the system
Parameters
- $gateway_id
integer $gateway_id The ID of the gateway to update
- $vars
array $vars An array of gateway data including: - name The name of the gateway -
optional - class The class name for this gateway (in /components/gateways/) -
optional - type The type of gateway ('merchant', 'nonmerchant', 'hybrid') -
optional - currencies A numerically indexed array of accepted currencies codes
(ISO 4217) - optional - meta A key/value array of meta data
|
public
|
#
upgrade( integer $gateway_id )
Runs the gateway's upgrade method to upgrade the gateway to match that of the
gateway's file version. Sets errors in GatewayManager::errors() if any errors
are set by the gateway's upgrade method.
Runs the gateway's upgrade method to upgrade the gateway to match that of the
gateway's file version. Sets errors in GatewayManager::errors() if any errors
are set by the gateway's upgrade method.
Parameters
- $gateway_id
integer $gateway_id The ID of the gateway to upgrade
|
public
|
#
delete( integer $gateway_id )
Permanently and completely removes the gateway specified by $gateway_id
Permanently and completely removes the gateway specified by $gateway_id
Parameters
- $gateway_id
integer $gateway_id The ID of the gateway to permanently remove
|
public
boolean
|
#
verifyCurrency( string $currency, integer $company_id, integer $gateway_id = null )
Verifies whether or not the given currency is already in use by a merchant
gateway for this company
Verifies whether or not the given currency is already in use by a merchant
gateway for this company
Parameters
- $currency
string $currency The ISO 4217 currency code
- $company_id
integer $company_id The company ID
- $gateway_id
integer $gateway_id The gateway ID to exclude from this verification check (optional)
Returns
boolean True if the currency is in use by a gateway, false otherwise
|
public
boolean
|
#
currencyExists( string $currency, mixed $gateway )
Verifies that the currency given exists for this gateway
Verifies that the currency given exists for this gateway
Parameters
- $currency
string $currency The currency code to verify
- $gateway
mixed $gateway A reference to the gateway object to verify the currency against
Returns
boolean True if the currency exists for the gateway, false otherwise
|
Methods inherited from AppModel
_()
,
boolToInt()
,
currencyToDecimal()
,
dateToUtc()
,
errors()
,
getPerPage()
,
ifSet()
,
loadCrypto()
,
setDefaultIfEmpty()
,
setPerPage()
,
setRulesIfSet()
,
strToBool()
,
systemDecrypt()
,
systemEncrypt()
,
systemHash()
,
truncateDecimal()
,
validateExists()
,
validateStateCountry()
Methods inherited from Model
affectedRows()
,
begin()
,
commit()
,
getConnection()
,
lastInsertId()
,
makeDSN()
,
prepare()
,
query()
,
rollBack()
,
setAttribute()
,
setFetchMode()
Magic methods summary
Properties summary
Properties inherited from AppModel
$replacement_keys