Methods summary
abstract public
array
|
#
validate( array $get, array $post )
Validates the incoming POST/GET response from the gateway to ensure it is
legitimate and can be trusted.
Validates the incoming POST/GET response from the gateway to ensure it is
legitimate and can be trusted.
Parameters
- $get
- The GET data for this request
- $post
- The POST data for this request
Returns
array An array of transaction data, sets any errors using Input if the data fails to validate:
- 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)
- reference_id The reference ID for gateway-only use with this transaction (optional)
- 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 (in the case of refunds)
|
abstract public
array
|
#
success( array $get, array $post )
Returns data regarding a success transaction. This method is invoked when
a client returns from the non-merchant gateway's web site back to Blesta.
Returns data regarding a success transaction. This method is invoked when
a client returns from the non-merchant gateway's web site back to Blesta.
Parameters
- $get
- The GET data for this request
- $post
- The POST data for this 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
|
public
mixed
|
#
buildProcess( array $contact_info, float $amount, array $invoice_amounts = null, array $options = null )
Returns all HTML markup required to render an authorization and capture payment form
Returns all HTML markup required to render an authorization and capture payment form
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
- $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
- recur An array of recurring info including:
- 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
Returns
mixed A string of HTML markup required to render an authorization and capture payment form,
or an array of HTML markup
|
public
mixed
|
#
buildAuthorize( array $contact_info, float $amount, array $invoice_amounts = null, array $options = null )
Returns all HTML markup required to render an authorization only payment form
Returns all HTML markup required to render an authorization only payment form
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
- $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
- recur An array of recurring info including:
- 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
Returns
mixed A string HTML markup required to render an authorization payment form, or an array of HTML markup
|
public
array
|
#
capture( string $reference_id, string $transaction_id, float $amount, array $invoice_amounts = null )
Captures a previously authorized payment
Captures a previously authorized payment
Parameters
- $reference_id
- The reference ID for the previously authorized transaction
- $transaction_id
- The transaction ID for the previously authorized transaction
- $amount
- The amount to charge
- $invoice_amounts
Returns
array $invoice_amounts An array of transaction data including:
- status The status of the transaction (approved, declined, void, pending, reconciled, refunded, returned)
- reference_id The reference ID for gateway-only use with this transaction (optional)
- transaction_id The ID returned by the remote gateway to identify this transaction
- message The message to be displayed in the interface in addition to the standard message for
this transaction status (optional)
|
public
array
|
#
void( string $reference_id, string $transaction_id, string $notes = null )
Void a payment or authorization
Void a payment or authorization
Parameters
- $reference_id
- The reference ID for the previously submitted transaction
- $transaction_id
- The transaction ID for the previously submitted transaction
- $notes
- Notes about the void that may be sent to the client by the gateway
Returns
array An array of transaction data including:
- status The status of the transaction (approved, declined, void, pending, reconciled, refunded, returned)
- reference_id The reference ID for gateway-only use with this transaction (optional)
- transaction_id The ID returned by the remote gateway to identify this transaction
- message The message to be displayed in the interface in addition to the standard message for
this transaction status (optional)
|
public
array
|
#
refund( string $reference_id, string $transaction_id, float $amount, string $notes = null )
Refund a payment
Parameters
- $reference_id
- The reference ID for the previously submitted transaction
- $transaction_id
- The transaction ID for the previously submitted transaction
- $amount
- The amount to refund this transaction
- $notes
- Notes about the refund that may be sent to the client by the gateway
Returns
array An array of transaction data including:
- status The status of the transaction (approved, declined, void, pending, reconciled, refunded, returned)
- reference_id The reference ID for gateway-only use with this transaction (optional)
- transaction_id The ID returned by the remote gateway to identify this transaction
- message The message to be displayed in the interface in addition to the standard message for
this transaction status (optional)
|
protected
mixed
|
#
getCommonError( string $type )
Fetches an array containing the error response to be set using Input::setErrors()
Fetches an array containing the error response to be set using Input::setErrors()
Parameters
- $type
The type of error to fetch. Values include:
- invalid An invalid payment response received
- transaction_not_found The transaction was not found on the remote gateway
- unsupported The action is not supported by the gateway
- general A general error occurred
Returns
mixed An array containing the error to populate using Input::setErrors(),
false if the type does not exist
|