Overview

Packages

  • blesta
    • app
      • controllers
      • models
    • components
      • auth
        • ldap
        • motp
        • oath
      • delivery
        • interfax
        • postal
          • methods
      • download
      • email
      • events
      • exchange
        • rates
          • currency
            • layer
          • fixer
          • open
            • exchange
              • rates
          • x
            • rates
      • gateway
        • payments
      • gateways
      • invoice
        • delivery
        • templates
          • perforated
            • invoice
          • quickbooks
            • invoice
          • templates
            • default
      • modules
      • net
        • amazon
          • s3
        • http
        • net
          • geo
            • ip
      • plugins
      • reports
        • aging
          • invoices
        • client
          • data
            • portability
        • custom
          • report
        • invoice
          • creation
        • package
          • revenue
        • tax
          • liability
        • transactions
          • applied
          • received
      • security
      • session
        • cart
      • settingscollection
      • upgrades
        • tasks
      • upload
      • vcard
    • core
      • Automation
        • Tasks
          • Common
          • Task
        • Type
          • Common
          • Cron
      • Pricing
        • ItemComparator
        • MetaItem
        • Modifier
          • Type
            • Description
              • Type
                • Discount
                • Option
                • Service
                • Tax
            • Discount
            • Price
            • Proration
        • Presenter
          • Build
            • Invoice
            • InvoiceData
            • Options
            • Service
            • ServiceChange
            • ServiceData
          • Collection
          • Format
            • Fields
            • Type
              • Discount
              • Item
              • Option
              • Options
              • Package
              • Pricing
              • Service
              • Tax
          • Items
            • Invoice
            • Service
          • Type
      • ServiceProviders
      • Util
        • Captcha
          • Captchas
          • Common
        • Common
          • Traits
        • Events
          • Common
          • Handlers
          • Observers
        • Filters
          • Common
        • GeoIp
        • Input
          • Fields
            • Common
        • Tax
        • Widgets
    • helpers
      • currency
        • format
      • data
        • structure
          • array
          • string
      • text
        • parser
      • widget
        • client
  • minPHP
    • helpers
      • color
      • data
        • structure
  • None
  • PHP

Classes

  • Accounts
  • Actions
  • ApiKeys
  • Backup
  • CalendarEvents
  • ClientGroups
  • Clients
  • Companies
  • Contacts
  • Countries
  • Coupons
  • CouponTerms
  • CronTasks
  • Currencies
  • EmailGroups
  • Emails
  • EmailVerifications
  • Encryption
  • GatewayManager
  • Invoices
  • InvoiceTemplateManager
  • Languages
  • Logs
  • Marketplace
  • MessageGroups
  • Messages
  • MessengerManager
  • ModuleClientMeta
  • ModuleManager
  • ModuleTypes
  • Navigation
  • PackageGroups
  • PackageOptionGroups
  • PackageOptions
  • Packages
  • Payments
  • Permissions
  • PluginManager
  • Pricings
  • ReportManager
  • ServiceChanges
  • ServiceInvoices
  • Services
  • Settings
  • Staff
  • StaffGroups
  • States
  • SystemEvents
  • Taxes
  • Themes
  • Transactions
  • Users
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated

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 uses Blesta\Core\Util\Common\Traits\Container
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

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 key/value pairs where each key represents an invoice ID and each value is the amount to apply to that invoice

$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 the payment is in

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 key/value pairs where each key represents an invoice ID and each value is the amount to apply to that invoice

$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 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
$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
  • 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
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
  • 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
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 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
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 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
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 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 used from Blesta\Core\Util\Common\Traits\Container
getFromContainer()
Properties inherited from AppModel
$logger, $replacement_keys
Blesta API documentation generated by ApiGen