Methods summary
public
|
#
__construct( )
Initializes the object, loading the dependent components and models
Initializes the object, loading the dependent components and models
|
public
|
#
setPassphrase( string $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.
Parameters
- $passphrase
- The passphrase to set
|
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
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
- The amount to charge this contact
- $currency
- The current to charge
- $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
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
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
string
|
#
getBuildCcForm( string $currency )
Returns HTML markup used to render a custom credit card form for a merchant gateway
Returns HTML markup used to render a custom credit card form for a merchant gateway
Parameters
- $currency
- The currency to charge
Returns
string Custom cc form HTML from the merchant
|
public
string
|
#
getBuildPaymentConfirmation( integer $client_id, integer $transaction_id )
Gets an Html form from the merchant gateway to use as an addition to the regular payment confirmation
pages in Blesta
Gets an Html form from the merchant gateway to use as an addition to the regular payment confirmation
pages in Blesta
Parameters
- $client_id
- The ID of the client that payment confirmation is being viewed for
- $transaction_id
- The ID of the transaction being confirmed
Returns
string The Html, if any, provided by the merchant gateway for confirming payments
|
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
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
- The amount to charge this contact
- $currency
- The current to charge
- $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
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
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
- The file name of the gateway excluding any extension
- $get
- array of GET parameters passed into the callback request
- $post
- 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
- The file name of the gateway excluding any extension
- $get
- array of GET parameters passed into the callback request
- $post
- 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
- The ID of the client to submit the payment for
- $type
- The type of payment to submit "cc" or "ach"
- $amount
- The amount to process
- $currency
- The ISO 4217 currency code this payment is to be processed under
- $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
- 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
- The account ID to be used to process the payment if no $account_info given
- $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
- The ID of the client to authorize the payment for
- $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
- The amount to authorize
- $currency
- The ISO 4217 currency code this payment is to be processed under
- $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
- The account ID to be used to process the payment if no $account_info given
- $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
- The ID of the client to capture the payment for
- $transaction_id
- The ID of the transactiosn to capture
- $amount
- The amount to capture
- $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
- The ID of the client to refund the payment for
- $transaction_id
- The ID of the transactiosn to refund
- $amount
- The amount to refund, defaults to the original transaction amount if not given
- $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
- The ID of the client to refund the payment for
- $transaction_id
- The ID of the transactiosn to refund
- $options
An array of options including (optional):
- staff_id The ID of the staff member that processed this payment
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
- The type of account ("cc" or "ach")
- $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 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)
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
- 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)
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
- The type of account ("cc" or "ach")
- $account
- The existing account record that is to be updated
- $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 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
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
- 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)
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
- The type of account ("cc" or "ach")
- $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
- The type of merchant gateway (cc or ach)
- $gateway_obj
- gateway object
- $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
|