Overview

Packages

  • blesta
    • app
      • controllers
      • models
    • components
      • auth
        • ldap
        • motp
        • oath
      • delivery
        • interfax
        • postal
          • methods
      • download
      • email
      • events
      • exchange
        • rates
          • currency
            • layer
          • fixer
          • open
            • exchange
              • rates
          • x
            • rates
      • gateway
        • payments
      • gateways
      • invoice
        • delivery
        • templates
          • perforated
            • invoice
          • quickbooks
            • invoice
          • templates
            • default
      • modules
      • net
        • amazon
          • s3
        • http
        • net
          • geo
            • ip
      • plugins
      • reports
        • aging
          • invoices
        • client
          • data
            • portability
        • custom
          • report
        • invoice
          • creation
        • package
          • revenue
        • tax
          • liability
        • transactions
          • applied
          • received
      • security
      • session
        • cart
      • settingscollection
      • upgrades
        • tasks
      • upload
      • vcard
    • core
      • Automation
        • Tasks
          • Common
          • Task
        • Type
          • Common
          • Cron
      • Pricing
        • ItemComparator
        • MetaItem
        • Modifier
          • Type
            • Description
              • Type
                • Discount
                • Option
                • Service
                • Tax
            • Discount
            • Price
            • Proration
        • Presenter
          • Build
            • Invoice
            • InvoiceData
            • Options
            • Service
            • ServiceChange
            • ServiceData
          • Collection
          • Format
            • Fields
            • Type
              • Discount
              • Item
              • Option
              • Options
              • Package
              • Pricing
              • Service
              • Tax
          • Items
            • Invoice
            • Service
          • Type
      • ServiceProviders
      • Util
        • Captcha
          • Captchas
          • Common
        • Common
          • Traits
        • Events
          • Common
          • Handlers
          • Observers
        • Filters
          • Common
        • GeoIp
        • Input
          • Fields
            • Common
        • Tax
        • Widgets
    • helpers
      • currency
        • format
      • data
        • structure
          • array
          • string
      • text
        • parser
      • widget
        • client
  • minPHP
    • helpers
      • color
      • data
        • structure
  • None
  • PHP

Classes

  • Accounts
  • Actions
  • ApiKeys
  • Backup
  • CalendarEvents
  • ClientGroups
  • Clients
  • Companies
  • Contacts
  • Countries
  • Coupons
  • CouponTerms
  • CronTasks
  • Currencies
  • EmailGroups
  • Emails
  • EmailVerifications
  • Encryption
  • GatewayManager
  • Invoices
  • InvoiceTemplateManager
  • Languages
  • Logs
  • Marketplace
  • MessageGroups
  • Messages
  • MessengerManager
  • ModuleClientMeta
  • ModuleManager
  • ModuleTypes
  • Navigation
  • PackageGroups
  • PackageOptionGroups
  • PackageOptions
  • Packages
  • Payments
  • Permissions
  • PluginManager
  • Pricings
  • ReportManager
  • ServiceChanges
  • ServiceInvoices
  • Services
  • Settings
  • Staff
  • StaffGroups
  • States
  • SystemEvents
  • Taxes
  • Themes
  • Transactions
  • Users
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated

Class GatewayManager

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

Model
Extended by AppModel uses Blesta\Core\Util\Common\Traits\Container
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 = ['gateways.name' => 'ASC'], string $currency = null )

Lists all installed gateways

Lists all installed gateways

Parameters

$company_id
The company ID
$type
The type of gateways to fetch ("merchant", "nonmerchant") set to null for both
$order
A key/value array where each key is a field and each value is the direction to sort
$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 )

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
The ID of the company in use
$currency
The ISO 4217 currency code to process
$gateway_id
The gateway ID to verify is installed and active for the given currency

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 )

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
The ID of the company in use
$gateway_name
The installed gateway's file name excluding any extension
$gateway_id
The gateway ID to verify is installed and active for the given currency
$currency
The ISO 4217 currency code to process

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
The ID of the company in use
$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
The ID of the gateway to fetch

Returns

mixed
A stdClass object representing the installed gateway, false if no such gateway exists
public array
# getByClass( string $class, integer $company_id = null )

Fetches a gateway for a given company, or all gateways installed in the system for the given gateway class

Fetches a gateway for a given company, or all gateways installed in the system for the given gateway class

Parameters

$class
The class name (in file_case)
$company_id
The ID of the company to fetch gateways for (optional, default null for all)

Returns

array
An array of stdClass objects, each representing an installed gateway record
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
The type of gateways to look for ("merchant", "nonmerchant"). Set to null for both
$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
The gateway class (in file_case)
$type
The type of gateway (merchant, nonmerchant)
$company_id
The ID of the 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

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
The ID of the gateway to update
$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
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
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
The ISO 4217 currency code
$company_id
The company ID
$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
The currency code to verify
$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 used from Blesta\Core\Util\Common\Traits\Container
getFromContainer()
Properties inherited from AppModel
$logger, $replacement_keys
Blesta API documentation generated by ApiGen