Blesta
  • Package
  • Class
  • Tree
  • Deprecated

Packages

  • blesta
    • app
      • components
        • events
          • default
      • controllers
      • models
    • components
      • auth
      • delivery
        • interfax
        • postal
          • methods
      • download
      • email
      • exchange
        • rates
          • foxrate
          • google
            • finance
          • yahoo
            • finance
      • gateway
        • payments
      • gateways
      • invoice
        • delivery
        • templates
      • json
      • modules
      • net
        • http
        • net
          • amazon
            • s3
          • geo
            • ip
      • plugins
      • recaptcha
      • security
      • session
        • cart
      • settingscollection
      • upgrades
      • upload
      • vcard
    • helpers
      • currency
        • format
      • data
        • structure
          • array
          • string
      • text
        • parser
  • com
    • tecnick
      • tcpdf
        • blesta
          • components
            • invoice
              • templates
                • quickbooks
                  • invoice
                • templates
                  • default
  • Crypt
    • AES
    • DES
    • Hash
    • Random
    • RC4
    • Rijndael
    • RSA
    • TerraDES
  • File
    • ANSI
    • ASN1
    • X509
  • Math
    • BigInteger
  • minPHP
    • components
      • input
      • record
    • helpers
      • color
      • data
        • structure
      • date
      • html
      • xml
    • lib
  • Net
    • SFTP
    • SSH1
    • SSH2
  • None
  • PHP
  • PHPMailer
  • Services
    • JSON
  • Swift
    • ByteStream
    • CharacterStream
    • Encoder
    • Events
    • KeyCache
    • Mailer
    • Mime
    • Plugins
    • Transport

Classes

  • Accounts
  • ApiKeys
  • Backup
  • CalendarEvents
  • ClientGroups
  • Clients
  • Companies
  • Contacts
  • Countries
  • Coupons
  • CronTasks
  • Currencies
  • EmailGroups
  • Emails
  • Encryption
  • GatewayManager
  • Invoices
  • InvoiceTemplateManager
  • Languages
  • Logs
  • Marketplace
  • ModuleManager
  • Navigation
  • PackageGroups
  • Packages
  • Payments
  • Permissions
  • PluginManager
  • Services
  • Settings
  • Staff
  • StaffGroups
  • States
  • Taxes
  • Themes
  • Transactions
  • Users

Class GatewayManager

Gateway manager. Handles installing/uninstalling and configuring payment gateways.

Model
Extended by AppModel
Extended by GatewayManager
Package: blesta\app\models
Copyright: Copyright (c) 2010, Phillips Data, Inc.
License: The Blesta License Agreement
Link: Blesta
Located at app/models/gateway_manager.php

Methods summary

public
# __construct( )

Initialize GatewayManager

Initialize GatewayManager

Overrides

AppModel::__construct
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, mixed $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

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 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
private array
# getMeta( integer $gateway_id )

Fetches all meta data associated with the given gateway

Fetches all meta data associated with the given gateway

Parameters

$gateway_id
integer
$gateway_id The ID of the gateway to fetch meta info for

Returns

array
An array of stdClass objects representing meta data
private
# setMeta( integer $gateway_id, array $meta )

Sets meta data for the given gateway, overwriting all existing meta data

Sets meta data for the given gateway, overwriting all existing meta data

Parameters

$gateway_id
integer
$gateway_id The ID of the gateway to store meta info for
$meta
array
$meta A numerically indexed array of meta data containing: -key The key for this meta field -value The value for this key -encrypted Whether or not this field should be encrypted (default 0, not encrypted)
private array
# getCurrencies( integer $gateway_id )

Fetches all currencies configured to be accepted by the given gateway

Fetches all currencies configured to be accepted by the given gateway

Parameters

$gateway_id
integer
$gateway_id The ID of the gateway to fetch currencies for

Returns

array
An array of stdClass objects representing the currencies accepted for this gateway
private
# setCurrencies( integer $gateway_id, array $currencies )

Sets accepted currencies for the given gateway

Sets accepted currencies for the given gateway

Parameters

$gateway_id
integer
$gateway_id The ID of the gateway to set currencies for
$currencies
array
$currencies A numerically indexed array of accepted currencies for this gateway
private
# setVersion( string $class, string $version )

Updates all installed gateways with the version given

Updates all installed gateways with the version given

Parameters

$class
string
$class The class name of the gateway to update
$version
string
$version The version number to set for each gateway instance
private An
# loadGateway( string $class, string $type )

Instantiates the given gateway and returns its instance

Instantiates the given gateway and returns its instance

Parameters

$class
string
$class The name of the class in file_case to load
$type
string
$type The type of gateway to load ("merchant" or "nonmerchant")

Returns

An
instance of the gateway specified
private
# getGatewayInfo( object $gateway, string $type, integer $company_id )

Fetch information about the given gateway object

Fetch information about the given gateway object

Parameters

$gateway
object
$gateway The gateway object to fetch info on
$type
string
$type The type of gateway ('merchant', 'nonmerchant')
$company_id
integer
$company_id The ID of the company to fetch gateway info for
private array
# getCurrencyRules( object $gw, integer $gateway_id = null )

Fetches the rules for adding/editing currencies for a gateway

Fetches the rules for adding/editing currencies for a gateway

Parameters

$gw
object
$gw The gateway object
$gateway_id
integer
$gateway_id The ID of the gateway (optional)

Returns

array
The currency rules

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

Blesta API documentation generated by ApiGen 2.8.0