Blesta Source Documentation

GatewayPayments extends Component

Processes payments through gateways, records their transactions and sends out email notices when payments are successfully processed all according to the client and company settings for the client and company in question

Table of Contents

Properties

$components
$helpers
$models
$company_id
$passphrase

Methods

__construct() Initializes the object, loading the dependent components and models
authorizePayment() Authorizes a payment for the given client of the given type using the supplied details.
capturePayment() Captures a payment for the given client and transaction in the supplied amount.
errors() Returns errors set in this object's Input object
getBuildAchForm() Returns HTML markup used to render a custom ACH form for a merchant gateway
getBuildAchVerificationForm() Returns HTML markup used to render a custom verification ach form for a merchant gateway
getBuildAuthorize() Returns an array of HTML markup used to render authorization requests for non-merchant gateways
getBuildCcForm() Returns HTML markup used to render a custom credit card form for a merchant gateway
getBuildPaymentConfirmation() Gets an Html form from the merchant gateway to use as an addition to the regular payment confirmation pages in Blesta
getBuildProcess() Returns an array of HTML markup used to render capture and pay requests for non-merchant gateways
implementsGateway() Returns whether or not the supplied gateway object implements the correct gateway interface based on its type and off site capabilities
processNotification() Process the notification request from a remote gateway. Records the transaction (if valid), and sends out the necessary emails.
processPayment() Processes a payment for the given client of the given type using the supplied details.
processReceived() Process the payment received request, user redirected back after successful payment.
refundPayment() Refunds a payment for the given client and transaction in the supplied amount.
removeAccount() Communicates with the remote gateway to update the account.
setPassphrase() Sets the passphrase to be used when processing payments on existing accounts.
storeAccount() Communicates with the remote gateway to store the account.
updateAccount() Communicates with the remote gateway to update the account.
verifyAccount() Communicates with the remote gateway to verify the account.
voidPayment() Voids a payment for the given client and transaction.
accountExistsError() Returns an error to be use when the required account does not exist for the client
accountRemoveError() Returns an error to be used when the account could not be removed from the gateway
accountStoreError() Returns an error to be use when the account could not be stored with the gateway
accountToAccountInfo() Converts a CC or ACH account record object to an array
accountUpdateError() Returns an error to be use when the account could not be updated with the gateway
accountVerifyError() Returns an error to be used when the account could not be verified from the gateway
contactExistsError() Returns an error to be use when the required contact does not exist for the client
gatewayExistsError() Returns an error to be use when the required gateway does not exist or is not enabled
getLast4() Returns the last 4 digits of either the credit card or bank account number
initGateway() Initializes the gateway and readies it for use
invoiceArrayToAmounts() Converts a key/value array of invoices and their apply amounts to a numerically indexed array containing keys for 'invoice_id' and 'amount'
processPaymentRules() Returns an array of rules that verify that the given $gateway_obj implements the correct interface for the payment type requested.
setProcessingError() Sets input errors based on the response status
transactionExistsError() Returns an error to be use when the required transaction does not exist for the client
unexpectedStatusError() Returns an error to be used when the gateway returned an unexpected response status (i.e. expected "returned" but received "error" or something similar)
Properties

$company_id

private int $company_id

The current company, set when this object is initialized

$passphrase

private string $passphrase = \null

The passphrase used to decrypt account information (optional, only used for added security)

Methods

__construct()

Initializes the object, loading the dependent components and models

public __construct() : mixed

authorizePayment()

Authorizes a payment for the given client of the given type using the supplied details.

public authorizePayment(int $client_id, string $type, float $amount, string $currency[, array<string|int, mixed> $account_info = null ][, int $account_id = null ][, array<string|int, mixed> $options = null ]) : object

This method submits payment to the gateway and records the transaction

Parameters
$client_id : int

The ID of the client to authorize the payment for

$type : string

The type of payment to submit "cc" or "ach", NOTE: Only "cc" is supported, but this varaible remains for consistency (and possible future support)

$amount : float

The amount to authorize

$currency : string

The ISO 4217 currency code this payment is to be processed under

$account_info : array<string|int, mixed> = null

An array of account info if no $account_id used, including:

  • first_name The first name on the account
  • last_name The last name on the account
  • account_number The bank account number (if ach)
  • routing_number The bank account routing number (if ach)
  • type The bank account type (checking, savings, business_checking) (if ach)
  • card_number The credit card number (if cc)
  • card_exp The card expiration date in yyyymm format (if cc)
  • card_security_code The card security code (if cc)
  • address1 The address 1 line of the account holder
  • address2 The address 2 line of the account holder
  • city The city of the account holder
  • state The 2 or 3 character state code
  • country The 2 or 3 character country code
  • zip The zip/postal code of the account holder
$account_id : int = null

The account ID to be used to process the payment if no $account_info given

$options : array<string|int, mixed> = null

An array of options including (optional):

  • invoices An array of key/value pairs where each key represents an invoice ID and each value is the amount to apply to that invoice (optional, may not exceed $amount)
  • staff_id The ID of the staff member that processed this payment
  • email_receipt If true (default true), will send an email receipt to the client and BCC appropriate staff members
Return values
object

An object representing the transaction if attempted, void otherwise. Check GatewayPayments::errors(), as some transactions may be attempted and yet still produce errors

capturePayment()

Captures a payment for the given client and transaction in the supplied amount.

public capturePayment(int $client_id, int $transaction_id[, float $amount = null ][, array<string|int, mixed> $options = null ]) : object

This method submits payment to the gateway, updates the transaction, and sends out any necessary emails

Parameters
$client_id : int

The ID of the client to capture the payment for

$transaction_id : int

The ID of the transactiosn to capture

$amount : float = null

The amount to capture

$options : array<string|int, mixed> = null

An array of options including (optional):

  • invoices An array of key/value pairs where each key represents an invoice ID and each value is the amount to apply to that invoice (optional, may not exceed $amount)
  • staff_id The ID of the staff member that processed this payment
  • email_receipt If true (default true), will send an email receipt to the client and BCC appropriate staff members
Return values
object

An object representing the transaction if attempted, void otherwise. Check GatewayPayments::errors(), as some transactions may be attempted and yet still produce errors

errors()

Returns errors set in this object's Input object

public errors() : mixed

getBuildAchForm()

Returns HTML markup used to render a custom ACH form for a merchant gateway

public getBuildAchForm(string $currency[, array<string|int, mixed> $account_info = null ][, int $client_id = null ][, int $client_group_id = null ][, bool $staff_id = null ][, int $gateway_id = null ]) : string
Parameters
$currency : string

The currency to charge

$account_info : array<string|int, mixed> = null

An array of bank account info (optional)

$client_id : int = null

The ID of the client to fetch only the gateway available for this client

$client_group_id : int = null

The ID of the client group to fetch only the gateway available for this client group

$staff_id : bool = null

The ID of the staff member for which to fetch this form

$gateway_id : int = null

The gateway ID to verify is installed and active for the given currency

Return values
string

Custom ach form HTML from the merchant

getBuildAchVerificationForm()

Returns HTML markup used to render a custom verification ach form for a merchant gateway

public getBuildAchVerificationForm(string $currency[, array<string|int, mixed> $vars = null ][, int $client_id = null ][, int $client_group_id = null ][, int $gateway_id = null ]) : string
Parameters
$currency : string

The currency the payment is in

$vars : array<string|int, mixed> = null

An array of bank account info used for verification purposes

$client_id : int = null

The ID of the client to fetch only the gateway available for this client

$client_group_id : int = null

The ID of the client group to fetch only the gateway available for this client group

$gateway_id : int = null

The gateway ID to verify is installed and active for the given currency

Return values
string

Custom ACH form HTML from the merchant

getBuildAuthorize()

Returns an array of HTML markup used to render authorization requests for non-merchant gateways

public getBuildAuthorize(array<string|int, mixed> $contact_info, float $amount, string $currency[, array<string|int, mixed> $invoice_amounts = null ][, array<string|int, mixed> $options = null ][, int $gateway_id = null ]) : array<string|int, mixed>
Parameters
$contact_info : array<string|int, mixed>

An array of contact info including:

  • id The contact ID
  • client_id The ID of the client this contact belongs to
  • user_id The user ID this contact belongs to (if any)
  • contact_type The type of contact
  • contact_type_id The ID of the contact type
  • first_name The first name on the contact
  • last_name The last name on the contact
  • title The title of the contact
  • company The company name of the contact
  • address1 The address 1 line of the contact
  • address2 The address 2 line of the contact
  • city The city of the contact
  • state An array of state info including:
    • code The 2 or 3-character state code
    • name The local name of the country
  • country An array of country info including:
    • alpha2 The 2-character country code
    • alpha3 The 3-cahracter country code
    • name The english name of the country
    • alt_name The local name of the country
  • zip The zip/postal code of the contact
$amount : float

The amount to charge this contact

$currency : string

The current to charge

$invoice_amounts : array<string|int, mixed> = null

An array of invoices, each containing:

  • id The ID of the invoice being processed
  • amount The amount being processed for this invoice (which is included in $amount)
$options : array<string|int, mixed> = null

An array of options including:

  • description The Description of the charge
  • return_url The URL to redirect users to after a successful payment
  • recur An array of recurring info including:
    • start_date The date/time in UTC that the recurring payment begins
    • amount The amount to recur
    • term The term to recur
    • period The recurring period (day, week, month, year, onetime) used in conjunction with term in order to determine the next recurring payment
$gateway_id : int = null

The ID of the nonmerchant gateway to fetch, if null will return all nonmerchant gateways for the currency

Return values
array<string|int, mixed>

An array of HTML, indexed by the gateway name

getBuildCcForm()

Returns HTML markup used to render a custom credit card form for a merchant gateway

public getBuildCcForm(string $currency[, int $client_id = null ][, int $client_group_id = null ][, bool $staff_id = null ][, int $gateway_id = null ]) : string
Parameters
$currency : string

The currency to charge

$client_id : int = null

The ID of the client to fetch only the gateway available for this client

$client_group_id : int = null

The ID of the client group to fetch only the gateway available for this client group

$staff_id : bool = null

The ID of the staff member for which to fetch this form

$gateway_id : int = null

The gateway ID to verify is installed and active for the given currency

Return values
string

Custom cc form HTML from the merchant

getBuildPaymentConfirmation()

Gets an Html form from the merchant gateway to use as an addition to the regular payment confirmation pages in Blesta

public getBuildPaymentConfirmation(int $client_id, int $transaction_id) : string
Parameters
$client_id : int

The ID of the client that payment confirmation is being viewed for

$transaction_id : int

The ID of the transaction being confirmed

Return values
string

The Html, if any, provided by the merchant gateway for confirming payments

getBuildProcess()

Returns an array of HTML markup used to render capture and pay requests for non-merchant gateways

public getBuildProcess(array<string|int, mixed> $contact_info, float $amount, string $currency[, array<string|int, mixed> $invoice_amounts = null ][, array<string|int, mixed> $options = null ][, int $gateway_id = null ]) : array<string|int, mixed>
Parameters
$contact_info : array<string|int, mixed>

An array of contact info including:

  • id The contact ID
  • client_id The ID of the client this contact belongs to
  • user_id The user ID this contact belongs to (if any)
  • contact_type The type of contact
  • contact_type_id The ID of the contact type
  • first_name The first name on the contact
  • last_name The last name on the contact
  • title The title of the contact
  • company The company name of the contact
  • address1 The address 1 line of the contact
  • address2 The address 2 line of the contact
  • city The city of the contact
  • state An array of state info including:
    • code The 2 or 3-character state code
    • name The local name of the country
  • country An array of country info including:
    • alpha2 The 2-character country code
    • alpha3 The 3-cahracter country code
    • name The english name of the country
    • alt_name The local name of the country
  • zip The zip/postal code of the contact
$amount : float

The amount to charge this contact

$currency : string

The current to charge

$invoice_amounts : array<string|int, mixed> = null

An array of invoices, each containing:

  • id The ID of the invoice being processed
  • amount The amount being processed for this invoice (which is included in $amount)
$options : array<string|int, mixed> = null

An array of options including:

  • description The Description of the charge
  • return_url The URL to redirect users to after a successful payment
  • recur An array of recurring info including:
    • start_date The date/time in UTC that the recurring payment begins
    • amount The amount to recur
    • term The term to recur
    • period The recurring period (day, week, month, year, onetime) used in conjunction with term in order to determine the next recurring payment
$gateway_id : int = null

The ID of the nonmerchant gateway to fetch, if null will return all nonmerchant gateways for the currency

Return values
array<string|int, mixed>

An array of HTML, indexed by the gateway name

implementsGateway()

Returns whether or not the supplied gateway object implements the correct gateway interface based on its type and off site capabilities

public implementsGateway(string $type, mixed $gateway_obj, bool $off_site) : bool
Parameters
$type : string

The type of merchant gateway (cc or ach)

$gateway_obj : mixed
$off_site : bool

True if attempting to verify support for off site payments, false otherwise

Return values
bool

True if the gateway object supports the appropriate interface, false otherwise

processNotification()

Process the notification request from a remote gateway. Records the transaction (if valid), and sends out the necessary emails.

public processNotification(string $gateway_name, array<string|int, mixed> $get, array<string|int, mixed> $post[, mixed $type = 'nonmerchant' ]) : object
Parameters
$gateway_name : string

The file name of the gateway excluding any extension

$get : array<string|int, mixed>
$post : array<string|int, mixed>
$type : mixed = 'nonmerchant'
Return values
object

An object representing the transaction if attempted, void otherwise. Check GatewayPayments::errors(), as some transactions may be attempted and yet still produce errors

processPayment()

Processes a payment for the given client of the given type using the supplied details.

public processPayment(int $client_id, string $type, float $amount, string $currency[, array<string|int, mixed> $account_info = null ][, int $account_id = null ][, array<string|int, mixed> $options = null ]) : object

This method submits payment to the gateway, records the transaction, and sends out any necessary emails

Parameters
$client_id : int

The ID of the client to submit the payment for

$type : string

The type of payment to submit "cc" or "ach"

$amount : float

The amount to process

$currency : string

The ISO 4217 currency code this payment is to be processed under

$account_info : array<string|int, mixed> = null

An array of account info if no $account_id used, including:

  • first_name The first name on the account
  • last_name The last name on the account
  • account_number The bank account number (if ach)
  • routing_number The bank account routing number (if ach)
  • type The bank account type (checking, savings, business_checking) (if ach)
  • card_number The credit card number (if cc)
  • card_exp The card expiration date in yyyymm format (if cc)
  • card_security_code The card security code (if cc)
  • address1 The address 1 line of the account holder
  • address2 The address 2 line of the account holder
  • city The city of the account holder
  • state The 2 or 3 character state code
  • country The 2 or 3 character country code
  • zip The zip/postal code of the account holder
  • reference_id The reference ID attached to this account given by the payment processor (if cc) (optional)
  • client_reference_id The reference ID for the client this payment account belongs to (if cc) (optional)
$account_id : int = null

The account ID to be used to process the payment if no $account_info given

$options : array<string|int, mixed> = null

An array of options including (optional):

  • invoices An array of key/value pairs where each key represents an invoice ID and each value is the amount to apply to that invoice (optional, may not exceed $amount)
  • staff_id The ID of the staff member that processed this payment
  • email_receipt If true (default true), will send an email receipt to the client and BCC appropriate staff members
Return values
object

An object representing the transaction if attempted, void otherwise. Check GatewayPayments::errors(), as some transactions may be attempted and yet still produce errors

processReceived()

Process the payment received request, user redirected back after successful payment.

public processReceived(string $gateway_name, array<string|int, mixed> $get, array<string|int, mixed> $post) : array<string|int, mixed>
Parameters
$gateway_name : string

The file name of the gateway excluding any extension

$get : array<string|int, mixed>
$post : array<string|int, mixed>
Tags
see
GatewayPayments::processReceived()
Return values
array<string|int, mixed>

An array of transaction data, may set errors using Input if the data appears invalid:

  • client_id The ID of the client that attempted the payment
  • amount The amount of the payment
  • currency The currency of the payment
  • invoices An array of invoices and the amount the payment should be applied to (if any) including:
    • id The ID of the invoice to apply to
    • amount The amount to apply to the invoice
  • status The status of the transaction (approved, declined, void, pending, reconciled, refunded, returned)
  • transaction_id The ID returned by the gateway to identify this transaction
  • parent_transaction_id The ID returned by the gateway to identify this transaction's original transaction

refundPayment()

Refunds a payment for the given client and transaction in the supplied amount.

public refundPayment(int $client_id, int $transaction_id[, float $amount = null ][, array<string|int, mixed> $options = null ]) : mixed

This method submits payment to the gateway and updates the transaction

Parameters
$client_id : int

The ID of the client to refund the payment for

$transaction_id : int

The ID of the transactiosn to refund

$amount : float = null

The amount to refund, defaults to the original transaction amount if not given

$options : array<string|int, mixed> = null

An array of options including (optional):

  • staff_id The ID of the staff member that processed this payment
  • notes Any additional notes to include with this transaction
Return values
mixed

An object representing the transaction if attempted, void otherwise. Check GatewayPayments::errors(), as some transactions may be attempted and yet still produce errors

removeAccount()

Communicates with the remote gateway to update the account.

public removeAccount(string $type, object $account) : mixed

SHOULD NOT BE USED TO UPDATE PAYMENT ACCOUNTS IN THE SYSTEM. See Accounts::deleteAch() or Accounts::deleteCc() instead.

Parameters
$type : string

The type of account ("cc" or "ach")

$account : object

The existing account record that is to be updated

Tags
see
Accounts::deleteAch()
see
Accounts::deleteCc()
Return values
mixed

False if the gateway does not support off-site payment accounts or is not enabled for off-site payment accounts, void for all other errors (errors set, use GatewayPayments::errors() to fetch errors), else sets an array containing:

  • gateway_id The ID of the gateway used to process the request
  • client_reference_id The reference ID for this client
  • reference_id The reference ID for this payment account

setPassphrase()

Sets the passphrase to be used when processing payments on existing accounts.

public setPassphrase(string $passphrase) : mixed

This is the value used to encrypt the private key that is used to decrypt account details.

Parameters
$passphrase : string

The passphrase to set

storeAccount()

Communicates with the remote gateway to store the account.

public storeAccount(string $type, array<string|int, mixed> $vars) : mixed

SHOULD NOT BE USED TO CREATE PAYMENT ACCOUNTS IN THE SYSTEM. See Accounts::addAch() or Accounts::addCc() instead.

Parameters
$type : string

The type of account ("cc" or "ach")

$vars : array<string|int, mixed>

An array of ACH or CC account info including:

  • contact_id The contact ID tied to this account
  • first_name The first name on the account
  • last_name The last name on the account
  • address1 The address line 1 on the account (optional)
  • address2 The address line 2 on the account (optional)
  • city The city on the account (optional)
  • state The ISO 3166-2 subdivision code on the account (optional)
  • zip The zip code on the account (optional)
  • country The ISO 3166-1 2-character country code (optional, defaults to 'US')
  • account The account number (if ach)
  • routing The routing number (if ach)
  • type The type of account, 'checking' or 'savings', (if ach, defaults to 'checking')
  • card_number The card number (if cc)
  • expiration The card expiration date in yyyymm format (if cc)
  • security_code The card security code (if cc)
  • reference_id The reference ID attached to this account given by the payment processor (optional)
  • client_reference_id The reference ID for the client this payment account belongs to (optional)
  • currency The currency in which is denominated the account (optional)
Tags
see
Accounts::addAch()
see
Accounts::addCc()
Return values
mixed

False if the gateway does not support off-site payment accounts or is not enabled for off-site payment accounts, void for all other errors (errors set, use GatewayPayments::errors() to fetch errors), else sets an array containing:

  • gateway_id The ID of the gateway used to process the request
  • client_reference_id The reference ID for this client
  • reference_id The reference ID for this payment account
  • expiration The expiration date of the stored card (if cc) (optional)
  • last4 The last four digits of the stored card (if cc) (optional)
  • type The type of the stored card (e.g amex) (if cc) (optional)

updateAccount()

Communicates with the remote gateway to update the account.

public updateAccount(string $type, object $account, array<string|int, mixed> $vars) : mixed

SHOULD NOT BE USED TO UPDATE PAYMENT ACCOUNTS IN THE SYSTEM. See Accounts::editAch() or Accounts::editCc() instead.

Parameters
$type : string

The type of account ("cc" or "ach")

$account : object

The existing account record that is to be updated

$vars : array<string|int, mixed>

An array of ACH or CC account info including:

  • contact_id The contact ID tied to this account
  • first_name The first name on the account
  • last_name The last name on the account
  • address1 The address line 1 on the account (optional)
  • address2 The address line 2 on the account (optional)
  • city The city on the account (optional)
  • state The ISO 3166-2 subdivision code on the account (optional)
  • zip The zip code on the account (optional)
  • country The ISO 3166-1 2-character country code (optional, defaults to 'US')
  • account The account number (if ach)
  • routing The routing number (if ach)
  • type The type of account, 'checking' or 'savings', (if ach, defaults to 'checking')
  • card_number The card number (if cc)
  • expiration The card expiration date in yyyymm format (if cc)
  • security_code The card security code (if cc)
  • reference_id The reference ID attached to this account given by the payment processor (optional)
  • client_reference_id The reference ID for the client this payment account belongs to (optional)
  • account_changed True if the account details (bank account or card number, etc.) have been updated, false otherwise
  • currency The currency in which is denominated the account (optional)
Tags
see
Accounts::editAch()
see
Accounts::editCc()
Return values
mixed

False if the gateway does not support off-site payment accounts or is not enabled for off-site payment accounts, void for all other errors (errors set, use GatewayPayments::errors() to fetch errors), else sets an array containing:

  • gateway_id The ID of the gateway used to process the request
  • client_reference_id The reference ID for this client
  • reference_id The reference ID for this payment account
  • expiration The expiration date of the stored card (if cc) (optional)
  • last4 The last four digits of the stored card (if cc) (optional)
  • type The type of the stored card (e.g amex) (if cc) (optional)

verifyAccount()

Communicates with the remote gateway to verify the account.

public verifyAccount(string $type, object $account, array<string|int, mixed> $vars) : mixed

SHOULD NOT BE USED TO UPDATE PAYMENT ACCOUNTS IN THE SYSTEM. See Accounts::editAch() or Accounts::verifyAchDeposits() instead.

Parameters
$type : string

The type of account ("cc" or "ach") (only "ach" is supported at the moment)

$account : object

The existing account record that is to be verified

$vars : array<string|int, mixed>

An array including:

  • first_deposit The first deposit amount
  • second_deposit The second deposit amount
Tags
see
Accounts::verifyAchDeposits()

voidPayment()

Voids a payment for the given client and transaction.

public voidPayment(int $client_id, int $transaction_id[, array<string|int, mixed> $options = null ]) : mixed

This method submits payment to the gateway and updates the transaction

Parameters
$client_id : int

The ID of the client to refund the payment for

$transaction_id : int

The ID of the transactiosn to refund

$options : array<string|int, mixed> = null

An array of options including (optional):

  • staff_id The ID of the staff member that processed this payment
Return values
mixed

An object representing the transaction if attempted, void otherwise. Check GatewayPayments::errors(), as some transactions may be attempted and yet still produce errors

accountExistsError()

Returns an error to be use when the required account does not exist for the client

private accountExistsError() : array<string|int, mixed>
Tags
see
Input::setErrors()
Return values
array<string|int, mixed>

An array containing error data suitable for Input::setErrors()

accountRemoveError()

Returns an error to be used when the account could not be removed from the gateway

private accountRemoveError() : array<string|int, mixed>
Tags
see
Input::setErrors()
Return values
array<string|int, mixed>

An array containing error data suitable for Input::setErrors()

accountStoreError()

Returns an error to be use when the account could not be stored with the gateway

private accountStoreError() : array<string|int, mixed>
Tags
see
Input::setErrors()
Return values
array<string|int, mixed>

An array containing error data suitable for Input::setErrors()

accountToAccountInfo()

Converts a CC or ACH account record object to an array

private accountToAccountInfo(object $account, string $type) : array<string|int, mixed>
Parameters
$account : object

The object to convert

$type : string

The type of account ("cc" or "ach")

Return values
array<string|int, mixed>

An array containing:

  • first_name The first name on the account
  • last_name The last name on the account
  • account_number The bank account number (if ach)
  • routing_number The bank account routing number (if ach)
  • type If ACH the bank account type (checking, savings, business_checking), if Credit Card the card type (amex, visa, etc.)
  • card_number The credit card number (if cc)
  • card_exp The card expiration date in yyyymm format (if cc)
  • card_security_code The card security code (if cc)
  • address1 The address 1 line of the account holder
  • address2 The address 2 line of the account holder
  • city The city of the account holder
  • state The 2 or 3 character state code
  • country The 2 or 3 character country code
  • zip The zip/postal code of the account holder
  • account_changed (optional) True if the account details have changed, false otherwise
  • last4 (optional) The last 4 digits of account_number or card_number if the card number or account number is not known (due to being stored off site)

accountUpdateError()

Returns an error to be use when the account could not be updated with the gateway

private accountUpdateError() : array<string|int, mixed>
Tags
see
Input::setErrors()
Return values
array<string|int, mixed>

An array containing error data suitable for Input::setErrors()

accountVerifyError()

Returns an error to be used when the account could not be verified from the gateway

private accountVerifyError() : array<string|int, mixed>
Tags
see
Input::setErrors()
Return values
array<string|int, mixed>

An array containing error data suitable for Input::setErrors()

contactExistsError()

Returns an error to be use when the required contact does not exist for the client

private contactExistsError() : array<string|int, mixed>
Tags
see
Input::setErrors()
Return values
array<string|int, mixed>

An array containing error data suitable for Input::setErrors()

gatewayExistsError()

Returns an error to be use when the required gateway does not exist or is not enabled

private gatewayExistsError() : array<string|int, mixed>
Tags
see
Input::setErrors()
Return values
array<string|int, mixed>

An array containing error data suitable for Input::setErrors()

getLast4()

Returns the last 4 digits of either the credit card or bank account number

private getLast4(array<string|int, mixed> $account_info, string $type) : string
Parameters
$account_info : array<string|int, mixed>

An array of account info (see Accounts::getCc(), Accounts::getAch())

$type : string

Either "cc" (Credit Card) or "ach" (ACH bank transfer)

Return values
string

The last 4 digits of the credit card or bank account number

initGateway()

Initializes the gateway and readies it for use

private initGateway(stdClass $gateway[, string $currency = null ]) : mixed
Parameters
$gateway : stdClass

A stdClass object representing the installed gateway

$currency : string = null

The ISO 4217 currency code to process

invoiceArrayToAmounts()

Converts a key/value array of invoices and their apply amounts to a numerically indexed array containing keys for 'invoice_id' and 'amount'

private invoiceArrayToAmounts([array<string|int, mixed> $invoices = null ]) : array<string|int, mixed>
Parameters
$invoices : array<string|int, mixed> = null

A key/value array where each key represents an invoice ID and the value represents the apply amount

Return values
array<string|int, mixed>

A numerically indexed array containing the 'invoice_id' and 'amount' keys

processPaymentRules()

Returns an array of rules that verify that the given $gateway_obj implements the correct interface for the payment type requested.

private processPaymentRules(object $gateway_obj[, string $types = 'ach|cc' ][, bool $off_site = false ]) : mixed
Parameters
$gateway_obj : object

The gateway object to verify implements the correct interface

$types : string = 'ach|cc'

A string containing the types of payments allowed (pipe delimited, e.g. "ach|cc" or just "cc")

$off_site : bool = false

True if attempting to verify support for off site payments, false otherwise

setProcessingError()

Sets input errors based on the response status

private setProcessingError(array<string|int, mixed> $response) : mixed
Parameters
$response : array<string|int, mixed>

A key/value array of response parameters including:

  • status The response status

transactionExistsError()

Returns an error to be use when the required transaction does not exist for the client

private transactionExistsError() : array<string|int, mixed>
Tags
see
Input::setErrors()
Return values
array<string|int, mixed>

An array containing error data suitable for Input::setErrors()

unexpectedStatusError()

Returns an error to be used when the gateway returned an unexpected response status (i.e. expected "returned" but received "error" or something similar)

private unexpectedStatusError() : array<string|int, mixed>
Tags
see
Input::setErrors()
Return values
array<string|int, mixed>

An array containing error data suitable for Input::setErrors()

Tags
subpackage

components.gatewaypayments

copyright

Copyright (c) 2010, Phillips Data, Inc.

license

http://www.blesta.com/license/ The Blesta License Agreement

link

Blesta


        
On this page

Search results