public
|
#
__construct( )
Initializes the object, loading the dependent components and models
Initializes the object, loading the dependent components and models
|
public
|
#
setPassphrase( mixed $passphrase )
Sets the passphrase to be used when processing payments on existing accounts.
This is the value used to encrypt the private key that is used to decrypt
account details.
Sets the passphrase to be used when processing payments on existing accounts.
This is the value used to encrypt the private key that is used to decrypt
account details.
|
private
|
#
initGateway( stdClass $gateway, string $currency = null )
Initializes the gateway and readies it for use
Initializes the gateway and readies it for use
Parameters
- $gateway
stdClass
$gateway A stdClass object representing the installed gateway
- $currency
string $currency The ISO 4217 currency code to process
|
public
array
|
#
getBuildProcess( array $contact_info, float $amount, string $currency, array $invoice_amounts = null, array $options = null, integer $gateway_id = null )
Returns an array of HTML markup used to render capture and pay requests for
non-merchant gateways
Returns an array of HTML markup used to render capture and pay requests for
non-merchant gateways
Parameters
- $contact_info
array $contact_info 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 $amount The amount to charge this contact
- $currency
string $currency The current to charge
- $invoice_amounts
array $invoice_amounts 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 $options 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
integer $gateway_id The ID of the nonmerchant gateway to fetch, if null will return all
nonmerchant gateways for the currency
Returns
array An array of HTML, indexed by the gateway name
|
public
array
|
#
getBuildAuthorize( array $contact_info, float $amount, string $currency, array $invoice_amounts = null, array $options = null, integer $gateway_id = null )
Returns an array of HTML markup used to render authorization requests for
non-merchant gateways
Returns an array of HTML markup used to render authorization requests for
non-merchant gateways
Parameters
- $contact_info
array $contact_info 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 $amount The amount to charge this contact
- $currency
string $currency The current to charge
- $invoice_amounts
array $invoice_amounts 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 $options 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
integer $gateway_id The ID of the nonmerchant gateway to fetch, if null will return all
nonmerchant gateways for the currency
Returns
array An array of HTML, indexed by the gateway name
|
public
array
|
#
processReceived( string $gateway_name, array $get, array $post )
Process the payment received request, user redirected back after successful
payment.
Process the payment received request, user redirected back after successful
payment.
Parameters
- $gateway_name
string $gateway_name The file name of the gateway excluding any extension
- $get
array An array of GET parameters passed into the callback request
- $post
array An array of POST parameters passed into the callback request
Returns
array 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
See
|
public
object
|
#
processNotification( string $gateway_name, array $get, array $post )
Process the notification request from a remote gateway. Records the
transaction (if valid), and sends out the necessary emails.
Process the notification request from a remote gateway. Records the
transaction (if valid), and sends out the necessary emails.
Parameters
- $gateway_name
string $gateway_name The file name of the gateway excluding any extension
- $get
array An array of GET parameters passed into the callback request
- $post
array An array of POST parameters passed into the callback request
Returns
object An object representing the transaction if attempted, void otherwise. Check
GatewayPayments::errors(), as some transactions may be attempted and yet still
produce errors
|
public
object
|
#
processPayment( integer $client_id, string $type, float $amount, string $currency, array $account_info = null, integer $account_id = null, array $options = null )
Processes a payment for the given client of the given type using the supplied
details. This method submits payment to the gateway, records the transaction,
and sends out any necessary emails
Processes a payment for the given client of the given type using the supplied
details. This method submits payment to the gateway, records the transaction,
and sends out any necessary emails
Parameters
- $client_id
integer $client_id The ID of the client to submit the payment for
- $type
string $type The type of payment to submit "cc" or "ach"
- $amount
float $amount The amount to process
- $currency
string $currency The ISO 4217 currency code this payment is to be processed under
- $account_info
array $account_info 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
integer $account_id The account ID to be used to process the payment if no $account_info
given
- $options
array $options 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
Returns
object An object representing the transaction if attempted, void otherwise. Check
GatewayPayments::errors(), as some transactions may be attempted and yet still
produce errors
|
public
object
|
#
authorizePayment( integer $client_id, string $type, float $amount, string $currency, array $account_info = null, integer $account_id = null, array $options = null )
Authorizes a payment for the given client of the given type using the
supplied details. This method submits payment to the gateway and records the
transaction
Authorizes a payment for the given client of the given type using the
supplied details. This method submits payment to the gateway and records the
transaction
Parameters
- $client_id
integer $client_id The ID of the client to authorize the payment for
- $type
string $type 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 $amount The amount to authorize
- $currency
string $currency The ISO 4217 currency code this payment is to be processed under
- $account_info
array $account_info 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
integer $account_id The account ID to be used to process the payment if no $account_info
given
- $options
array $options 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
Returns
object An object representing the transaction if attempted, void otherwise. Check
GatewayPayments::errors(), as some transactions may be attempted and yet still
produce errors
|
public
object
|
#
capturePayment( integer $client_id, integer $transaction_id, float $amount = null, array $options = null )
Captures a payment for the given client and transaction in the supplied
amount. This method submits payment to the gateway, updates the transaction, and
sends out any necessary emails
Captures a payment for the given client and transaction in the supplied
amount. This method submits payment to the gateway, updates the transaction, and
sends out any necessary emails
Parameters
- $client_id
integer $client_id The ID of the client to capture the payment for
- $transaction_id
integer $transaction_id The ID of the transactiosn to capture
- $amount
float $amount The amount to capture
- $options
array $options 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
Returns
object An object representing the transaction if attempted, void otherwise. Check
GatewayPayments::errors(), as some transactions may be attempted and yet still
produce errors
|
public
mixed
|
#
refundPayment( integer $client_id, integer $transaction_id, float $amount = null, array $options = null )
Refunds a payment for the given client and transaction in the supplied
amount. This method submits payment to the gateway and updates the
transaction
Refunds a payment for the given client and transaction in the supplied
amount. This method submits payment to the gateway and updates the
transaction
Parameters
- $client_id
integer $client_id The ID of the client to refund the payment for
- $transaction_id
integer $transaction_id The ID of the transactiosn to refund
- $amount
float $amount The amount to refund, defaults to the original transaction amount if not
given
- $options
array $options 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
Returns
mixed An object representing the transaction if attempted, void otherwise. Check
GatewayPayments::errors(), as some transactions may be attempted and yet still
produce errors
|
public
mixed
|
#
voidPayment( integer $client_id, integer $transaction_id, array $options = null )
Voids a payment for the given client and transaction. This method submits
payment to the gateway and updates the transaction
Voids a payment for the given client and transaction. This method submits
payment to the gateway and updates the transaction
Parameters
- $client_id
integer $client_id The ID of the client to refund the payment for
- $transaction_id
integer $transaction_id The ID of the transactiosn to refund
- $options
float $amount The amount to refund, defaults to the original transaction amount if not
given
Returns
mixed An object representing the transaction if attempted, void otherwise. Check
GatewayPayments::errors(), as some transactions may be attempted and yet still
produce errors
|
public
mixed
|
#
storeAccount( string $type, array $vars )
Communicates with the remote gateway to store the account. SHOULD NOT BE USED
TO CREATE PAYMENT ACCOUNTS IN THE SYSTEM. See Accounts::addAch() or
Accounts::addCc() instead.
Communicates with the remote gateway to store the account. SHOULD NOT BE USED
TO CREATE PAYMENT ACCOUNTS IN THE SYSTEM. See Accounts::addAch() or
Accounts::addCc() instead.
Parameters
- $type
string $type The type of account ("cc" or "ach")
- $vars
array $vars 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
3-character country code (optional, defaults to 'USA') - 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') - number The
card number (if cc) - expiration The card expiration date in yyyymm format (if
cc) - security_code The card security code (if cc)
Returns
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
See
|
public
mixed
|
#
updateAccount( string $type, object $account, array $vars )
Communicates with the remote gateway to update the account. SHOULD NOT BE
USED TO UPDATE PAYMENT ACCOUNTS IN THE SYSTEM. See Accounts::editAch() or
Accounts::editCc() instead.
Communicates with the remote gateway to update the account. SHOULD NOT BE
USED TO UPDATE PAYMENT ACCOUNTS IN THE SYSTEM. See Accounts::editAch() or
Accounts::editCc() instead.
Parameters
- $type
string $type The type of account ("cc" or "ach")
- $account
object $account The existing account record that is to be updated
- $vars
array $vars 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
3-character country code (optional, defaults to 'USA') - 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') - number The
card number (if cc) - expiration The card expiration date in yyyymm format (if
cc) - security_code The card security code (if cc) - account_changed True if the
account details (bank account or card number, etc.) have been updated, false
otherwise
Returns
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
See
|
public
mixed
|
#
removeAccount( string $type, object $account )
Communicates with the remote gateway to update the account. SHOULD NOT BE
USED TO UPDATE PAYMENT ACCOUNTS IN THE SYSTEM. See Accounts::deleteAch() or
Accounts::deleteCc() instead.
Communicates with the remote gateway to update the account. SHOULD NOT BE
USED TO UPDATE PAYMENT ACCOUNTS IN THE SYSTEM. See Accounts::deleteAch() or
Accounts::deleteCc() instead.
Parameters
- $type
string $type The type of account ("cc" or "ach")
- $account
object $account The existing account record that is to be updated
Returns
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
See
|
public
|
#
errors( )
Returns errors set in this object's Input object
Returns errors set in this object's Input object
|
public
boolean
|
#
implementsGateway( string $type, object $gateway_obj, boolean $off_site )
Returns whether or not the supplied gateway object implements the correct
gateway interface based on its type and off site capabilities
Returns whether or not the supplied gateway object implements the correct
gateway interface based on its type and off site capabilities
Parameters
- $type
string $type The type of merchant gateway (cc or ach)
- $gateway_obj
object The gateway object
- $off_site
boolean $off_site True if attempting to verify support for off site payments, false
otherwise
Returns
boolean True if the gateway object supports the appropriate interface, false otherwise
|
private
array
|
#
invoiceArrayToAmounts( array $invoices = null )
Converts a key/value array of invoices and their apply amounts to a
numerically indexed array containing keys for 'invoice_id' and 'amount'
Converts a key/value array of invoices and their apply amounts to a
numerically indexed array containing keys for 'invoice_id' and 'amount'
Parameters
- $invoices
array $invoices A key/value array where each key represents an invoice ID and the
value represents the apply amount
Returns
array A numerically indexed array containing the 'invoice_id' and 'amount' keys
|
private
array
|
#
accountToAccountInfo( object $account, string $type )
Converts a CC or ACH account record object to an array
Converts a CC or ACH account record object to an array
Parameters
- $account
object $account The object to convert
- $type
string $type The type of account ("cc" or "ach")
Returns
array 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)
|
private
string
|
#
getLast4( array $account_info, string $type )
Returns the last 4 digits of either the credit card or bank account
number
Returns the last 4 digits of either the credit card or bank account
number
Parameters
- $account_info
array $account_info An array of account info (see Accounts::getCc(),
Accounts::getAch())
- $type
string $type Either "cc" (Credit Card) or "ach" (ACH bank transfer)
Returns
string The last 4 digits of the credit card or bank account number
|
private
array
|
#
gatewayExistsError( )
Returns an error to be use when the required gateway does not exist or is not
enabled
Returns an error to be use when the required gateway does not exist or is not
enabled
Returns
array An array containing error data suitable for Input::setErrors()
See
|
private
array
|
#
transactionExistsError( )
Returns an error to be use when the required transaction does not exist for
the client
Returns an error to be use when the required transaction does not exist for
the client
Returns
array An array containing error data suitable for Input::setErrors()
See
|
private
array
|
#
accountExistsError( )
Returns an error to be use when the required account does not exist for the
client
Returns an error to be use when the required account does not exist for the
client
Returns
array An array containing error data suitable for Input::setErrors()
See
|
private
array
|
#
contactExistsError( )
Returns an error to be use when the required contact does not exist for the
client
Returns an error to be use when the required contact does not exist for the
client
Returns
array An array containing error data suitable for Input::setErrors()
See
|
private
|
#
processPaymentRules( object $gateway_obj, string $types = "ach|cc" )
Returns an array of rules that verify that the given $gateway_obj implements
the correct interface for the payment type requested.
Returns an array of rules that verify that the given $gateway_obj implements
the correct interface for the payment type requested.
Parameters
- $gateway_obj
object $gateway_obj The gateway object to verify implements the correct interface
- $types
string $types A string containing the types of payments allowed (pipe delimited, e.g.
"ach|cc" or just "cc")
|
private
array
|
#
accountStoreError( )
Returns an error to be use when the account could not be stored with the
gateway
Returns an error to be use when the account could not be stored with the
gateway
Returns
array An array containing error data suitable for Input::setErrors()
See
|
private
array
|
#
accountUpdateError( )
Returns an error to be use when the account could not be updated with the
gateway
Returns an error to be use when the account could not be updated with the
gateway
Returns
array An array containing error data suitable for Input::setErrors()
See
|
private
array
|
#
accountRemoveError( )
Returns an error to be used when the account could not be removed from the
gateway
Returns an error to be used when the account could not be removed from the
gateway
Returns
array An array containing error data suitable for Input::setErrors()
See
|
private
array
|
#
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)
Returns an error to be used when the gateway returned an unexpected response
status (i.e. expected "returned" but received "error" or something similar)
Returns
array An array containing error data suitable for Input::setErrors()
See
|
private
|
#
setProcessingError( array $response )
Sets input errors based on the response status
Sets input errors based on the response status
Parameters
- $response
array $response A key/value array of response parameters including: - status The
response status
|