Blesta
  • Package
  • Class
  • Tree
  • Deprecated

Packages

  • blesta
    • app
      • controllers
      • models
    • components
      • areyouahuman
      • auth
        • motp
        • oath
      • delivery
        • interfax
        • postal
          • methods
      • download
      • email
      • events
        • default
      • exchange
        • rates
          • google
            • finance
          • yahoo
            • finance
      • gateway
        • payments
      • gateways
      • invoice
        • delivery
        • templates
          • quickbooks
            • invoice
      • json
      • modules
      • net
        • amazon
          • s3
        • http
        • net
          • geo
            • ip
      • plugins
      • recaptcha
      • reports
        • aging
          • invoices
        • custom
          • report
        • invoice
          • creation
        • tax
          • liability
        • transactions
          • applied
          • received
      • security
      • session
        • cart
      • settingscollection
      • upgrades
        • tasks
      • upload
      • vcard
    • helpers
      • currency
        • format
      • data
        • structure
          • array
          • string
      • text
        • parser
      • widget
        • client
  • minPHP
    • components
      • input
      • record
    • helpers
      • color
      • data
        • structure
      • date
      • form
      • html
      • javascript
      • xml
    • lib
  • None
  • PHP

Classes

  • Accounts
  • ApiKeys
  • CalendarEvents
  • ClientGroups
  • Clients
  • Companies
  • Contacts
  • Countries
  • Coupons
  • CronTasks
  • Currencies
  • EmailGroups
  • Emails
  • Encryption
  • GatewayManager
  • Invoices
  • InvoiceTemplateManager
  • Languages
  • Logs
  • Marketplace
  • ModuleClientMeta
  • ModuleManager
  • Navigation
  • PackageGroups
  • PackageOptionGroups
  • PackageOptions
  • Packages
  • Payments
  • Permissions
  • PluginManager
  • Pricings
  • ReportManager
  • ServiceChanges
  • Services
  • Settings
  • Staff
  • StaffGroups
  • States
  • Taxes
  • Themes
  • Transactions
  • Users

Class Payments

Processes payments through remote gateways and records the transactions. Supports non-merchant gateways by returning markup used to render those payment buttons.

Model
Extended by AppModel
Extended by Payments
Package: blesta\app\models
Copyright: Copyright (c) 2010, Phillips Data, Inc.
License: The Blesta License Agreement
Link: Blesta
Located at app/models/payments.php

Methods summary

public
# __construct( )

Initialize Payments

Initialize Payments

Overrides

AppModel::__construct
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 key/value pairs where each key represents an invoice ID and each value is the amount to apply to that invoice
$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 key/value pairs where each key represents an invoice ID and each value is the amount to apply to that invoice
$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 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 - passphrase The value used to encrypt the private key that is used to decrypt account details

Returns

object
An object representing the transaction if attempted, void otherwise. Check Payments::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 - passphrase The value used to encrypt the private key that is used to decrypt account details

Returns

object
An object representing the transaction if attempted, void otherwise. Check Payments::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 Payments::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 Payments::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 Payments::errors(), as some transactions may be attempted and yet still produce errors
public mixed
# errors( )

Returns errors set in this object's Input object

Returns errors set in this object's Input object

Returns

mixed
Boolean false if no errors encountered, an array of errors otherwise

Overrides

AppModel::errors

Methods inherited from AppModel

_(), boolToInt(), currencyToDecimal(), dateToUtc(), getPerPage(), ifSet(), loadCrypto(), setDefaultIfEmpty(), setPerPage(), setRulesIfSet(), strToBool(), systemDecrypt(), systemEncrypt(), systemHash(), truncateDecimal(), validateExists(), validateStateCountry()

Methods inherited from Model

affectedRows(), begin(), commit(), getConnection(), lastInsertId(), makeDSN(), prepare(), query(), rollBack(), setAttribute(), setFetchMode()

Magic methods summary

Properties summary

Properties inherited from AppModel

$replacement_keys

Blesta API documentation generated by ApiGen 2.8.0