Class GatewayManager
	
	
Gateway manager. Handles installing/uninstalling and configuring payment
gateways.
	 
	
		- 
			Model
			
			
			
		
- 
			 AppModel AppModel
- 
			 GatewayManager 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_idinteger$company_id The company ID
$typestring$type The type of gateways to fetch ("merchant", "nonmerchant") set to null for
both
$orderstring$order A key/value array where each key is a field and each value is the
direction to sort
$currencystring$currency The ISO 4217 currency code
Returns
						arrayAn 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_idinteger$company_id The ID of the company in use
$currencyinteger$currency The ISO 4217 currency code to process
$gateway_idinteger$gateway_id The gateway ID to verify is installed and active for the given
currency
$include_infoboolean$include_info True to include gateway info from the source file
Returns
						mixedA 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_idinteger$company_id The ID of the company in use
$gateway_nameinteger$gateway_name The installed gateway's file name excluding any extension
$gateway_idinteger$gateway_id The gateway ID to verify is installed and active for the given
currency
$currencyinteger$currency The ISO 4217 currency code to process
$include_infoboolean$include_info True to include gateway info, false otherwise
Returns
						mixedA 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_idinteger$company_id The ID of the company in use
$currencyinteger$currency The ISO 4217 currency code to process
Returns
						arrayAn 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
						arrayAn 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_idinteger$gateway_id The ID of the gateway to fetch
Returns
						mixedA 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
						$typestring$type The type of gateways to look for ("merchant", "nonmerchant"). Set to null
for both
$company_idinteger$company_id The ID of the company to check availability status for
Returns
						arrayAn 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
						$classstring$class The gateway class (in file_case)
$typestring$type The type of gateway (merchant, nonmerchant)
$company_idstring$company_id The ID of hte company to fetch for
Returns
						booleanTrue 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
						$varsarray$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
						integerThe 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_idinteger$gateway_id The ID of the gateway to update
$varsarray$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_idinteger$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_idinteger$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
						$currencystring$currency The ISO 4217 currency code
$company_idinteger$company_id The company ID
$gateway_idinteger$gateway_id The gateway ID to exclude from this verification check (optional)
Returns
						booleanTrue 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
						$currencystring$currency The currency code to verify
$gatewaymixed$gateway A reference to the gateway object to verify the currency against
Returns
						booleanTrue 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