Methods summary
public
|
#
__construct( )
Initialize Accounts
Overrides
|
public
mixed
|
#
getListAch( integer $contact_id, string $sortby = 'last_name', string $order = 'asc' )
Returns a list of all ACH accounts for a given contact
Returns a list of all ACH accounts for a given contact
Parameters
- $contact_id
- The contact to fetch on
- $sortby
- The field to sort on
- $order
- The order to sort (asc, desc)
Returns
mixed An array of objects containing ACH fields or false if none exist
|
public
mixed
|
#
getListCc( integer $contact_id, string $sortby = 'last_name', string $order = 'asc' )
Returns a list of all CC accounts for a given contact
Returns a list of all CC accounts for a given contact
Parameters
- $contact_id
- The contact to fetch on
- $sortby
- The field to sort on
- $order
- The order to sort (asc, desc)
Returns
mixed An array of objects containing CC fields or false if none exist
|
public
mixed
|
#
getAllCc( integer $contact_id )
Retrieves a list of all CC accounts for a given contact
Retrieves a list of all CC accounts for a given contact
Parameters
- $contact_id
- The contact to fetch on
Returns
mixed An array of objects containing CC account records, or false if none exist
|
public
array
|
#
getAllCcByClient( integer $client_id )
Retrieves a list of all CC accounts for a given client
Retrieves a list of all CC accounts for a given client
Parameters
- $client_id
- The client ID to fetch on
Returns
array An array of objects containing CC account records
|
public
mixed
|
#
getAllAch( integer $contact_id )
Retrieves a list of all ACH accounts for a given contact
Retrieves a list of all ACH accounts for a given contact
Parameters
- $contact_id
- The contact to fetch on
Returns
mixed An array of objects containing ACH account records, or false if none exist
|
public
array
|
#
getAllAchByClient( integer $client_id )
Retrieves a list of all ACH accounts for a given client
Retrieves a list of all ACH accounts for a given client
Parameters
- $client_id
- The client ID to fetch on
Returns
array An array of objects containing ACH account records
|
public
mixed
|
#
getCc( integer $account_id, boolean $decrypt = false, string $passphrase = null, integer $staff_id = null )
Retrieves a single CC account
Retrieves a single CC account
Parameters
- $account_id
- The ID of the account to get
- $decrypt
- Whether or not to decrypt the account number
- $passphrase
- The passphrase required to decrypt accounts (if set)
- $staff_id
- The ID of the staff member decrypting the account
Returns
mixed An object containing the CC account fields, or false if none exist
|
public
mixed
|
#
getAch( integer $account_id, boolean $decrypt = false, string $passphrase = null, integer $staff_id = null )
Retrieves a single ACH account
Retrieves a single ACH account
Parameters
- $account_id
- The ID of the account to get
- $decrypt
- Whether or not to decrypt the account number
- $passphrase
- The passphrase required to decrypt accounts (if set)
- $staff_id
- The ID of the staff member decrypting the account
Returns
mixed An object containing the ACH account fields, or false if none exist
|
public
string
|
#
getClientReferenceId( integer $client_id, integer $gateway_id, string $status = null, string $type = null )
Returns the client reference ID previously used for any payment accounts belonging to the client
under the given gateway
Returns the client reference ID previously used for any payment accounts belonging to the client
under the given gateway
Parameters
- $client_id
- The ID of the client to fetch the client reference ID for
- $gateway_id
- The ID of the gateway to that previous account was set up under
- $status
- The payment account status by which to filter (optional) (active or inactive)
- $type
- The payment account type by which to filter (optional) (cc or ach)
Returns
string Returns the client reference ID if found, null otherwise
|
public
integer
|
#
addAch( array $vars )
Records an ACH account into the system
Records an ACH account into the system
Parameters
- $vars
An array of ACH 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 (will be encrypted) (optional)
- routing The routing number (will be encrypted) (optional)
- last4 The last 4 digits of the account number (will be encrypted) (optional if account is given)
- type The type of account, 'checking' or 'savings', (optional, defaults to 'checking')
- 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
integer The ACH account ID for the record just added, void if not added
|
public
integer
|
#
verifyAch( array & $vars )
Verifies ACH account details provided to ensure proper entry into the system
Verifies ACH account details provided to ensure proper entry into the system
Parameters
- $vars
An array of ACH 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 (will be encrypted) (optional)
- routing The routing number (will be encrypted) (optional)
- last4 The last 4 digits of the account number (will be encrypted) (optional if account is given)
- type The type of account, 'checking' or 'savings', (optional, defaults to 'checking')
- 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
integer The ACH account ID for the record just added, void if not added
|
public
|
#
editAch( integer $account_id, array $vars )
Updates an ACH account in the system, all fields optional
Updates an ACH account in the system, all fields optional
Parameters
- $account_id
- The account ID for this account
- $vars
An array of ACH account info including:
- 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 (will be encrypted) (optional)
- routing The routing number (will be encrypted) (optional)
- last4 The last 4 digits of the account number (will be encrypted) (optional if account is given)
- type The type of account, 'checking' or 'savings', (optional, defaults to 'checking')
- 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)
|
public
|
#
deleteAch( integer $account_id, boolean $soft_delete = true )
Removes an ACH account record using the given account ID. Attempts to remove
the payment account from the remote gateway (if stored off-site). Deletes sensitive
information and marks the record as inactive.
Removes an ACH account record using the given account ID. Attempts to remove
the payment account from the remote gateway (if stored off-site). Deletes sensitive
information and marks the record as inactive.
Parameters
- $account_id
- The account ID for this ACH account
- $soft_delete
True to perform a soft delete, or false to permanently
delete the record (optional, default true)
|
public
integer
|
#
addCc( array $vars )
Records a CC account into the system
Records a CC account into the system
Parameters
- $vars
An array of 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; required if state is given; defaults to 'US')
- number The credit card number (will be encrypted) (optional)
- expiration The expiration date in yyyymm format (will be encrypted)
- security_code The 3 or 4-digit security code (optional, only used when storing payment account info off-site)
- last4 The last 4 digits of the card number (will be encrypted) (optional if number is given)
- type The card type (optional, will be determined automatically if not given)
- 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
integer The CC account ID for the record just added, void if not added
|
public
integer
|
#
verifyCc( array & $vars, boolean $require_fields = true )
Verifies CC account info to ensure proper entry into the system
Verifies CC account info to ensure proper entry into the system
Parameters
- $vars
An array of 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; required if state is given; defaults to 'US')
- number The credit card number (will be encrypted) (optional)
- expiration The expiration date in yyyymm format (will be encrypted)
- security_code The 3 or 4-digit security code (optional, only used when storing payment account info off-site)
- last4 The last 4 digits of the card number (will be encrypted) (optional if number is given)
- type The card type (optional, will be determined automatically if not given)
- 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)
- $require_fields
- Whether to require that the cc fields be set to pass validation
Returns
integer The CC account ID for the record just added, void if not added
|
public
|
#
editCc( integer $account_id, array $vars )
Updates a CC account in the system, all fields optional
Updates a CC account in the system, all fields optional
Parameters
- $account_id
- The account ID for this account
- $vars
An array of CC account info including:
- 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; required if state is given; defaults to 'US')
- number The credit card number (will be encrypted) (optional)
- expiration The expiration date in yyyymm format (will be encrypted) (optional)
- last4 The last 4 digits of the card number (will be encrypted) (optional if number is given)
- type The card type (optional, will be determined automatically if not given)
- 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)
|
public
|
#
deleteCc( integer $account_id, boolean $soft_delete = true )
Removes a CC account record using the givent account ID. Attempts to remove
the payment account from the remote gateway (if stored off-site). Deletes sensitive
information and marks the record as inactive.
Removes a CC account record using the givent account ID. Attempts to remove
the payment account from the remote gateway (if stored off-site). Deletes sensitive
information and marks the record as inactive.
Parameters
- $account_id
- The account ID for this ACH account
- $soft_delete
True to perform a soft delete, or false to permanently
delete the record (optional, default true)
|
public
array
|
#
getCardsExpireSoon( string $date )
Returns the accounts for all active clients with credit card payment
accounts set to expire in the month given by $date
Returns the accounts for all active clients with credit card payment
accounts set to expire in the month given by $date
Parameters
- $date
The date to fetch card expirations for, will be
converted to Ym format (e.g. 201003 = March, 2010)
Returns
array An array of stdClass objects representing the accounts whose cards expire in the month given
|
public
array
|
#
getTypes( )
Returns a list of account types
Returns a list of account types
Returns
array Key=>value pairs of account types
|
public
array
|
#
getAchTypes( )
Returns a list of credit card account types
Returns a list of credit card account types
Returns
array Key=>value pairs of CC account types
|
public
array
|
#
getCcTypes( )
Returns a list of credit card account types
Returns a list of credit card account types
Returns
array Key=>value pairs of CC account types
|
public
string
|
#
formatNumber( string $value )
Formats a given string into an integer string
Formats a given string into an integer string
Parameters
- $value
- The value to format
Returns
string The formatted $value with all non-integer characters removed
|
public
boolean
|
#
validateAchType( string $type )
Validates the ACH 'type' field
Validates the ACH 'type' field
Parameters
Returns
boolean True if validated, false otherwise
|
public
boolean
|
#
validateCcType( string $type )
Validates the CC 'type' field
Validates the CC 'type' field
Parameters
Returns
boolean True if validated, false otherwise
|
public
string
|
#
creditCardType( string $card_number )
Returns the card type based on the given card number (card numbers are ISO 7812 numbers)
Returns the card type based on the given card number (card numbers are ISO 7812 numbers)
Parameters
- $card_number
- The card number to evaluate
Returns
string The card type detected, null if the card is invalid or is
otherwise not recognized. Values include:
- 'amex' - American Express,
- 'bc' - Bankcard,
- 'cup' - China Union Pay,
- 'dc-cb' - Diners Club Carte Blanche,
- 'dc-er' - Diners Club EnRoute,
- 'dc-int' - Diners Club International,
- 'dc-uc' - Diners Club US and Canada,
- 'disc' - Discover,
- 'ipi' - InstaPayment,
- 'jcb' - Japan Credit Bureau,
- 'lasr' - Laser,
- 'maes' - Maestro,
- 'mc' - Master Card,
- 'solo' - Solo,
- 'switch' - Switch,
- 'visa' - Visa
|
public
boolean
|
#
luhnValid( string $card_number )
Performs the Luhn Algorithm on the given card number to verify that the card is valid.
Performs the Luhn Algorithm on the given card number to verify that the card is valid.
Parameters
- $card_number
- The card number to validate
Returns
boolean Returns true if the card was successfully validated against
the Luhn algorithm (e.g. is valid), false otherwise
|