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
integer $contact_id The contact to fetch on
- $sortby
string $sortby The field to sort on
- $order
string $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
integer $contact_id The contact to fetch on
- $sortby
string $sortby The field to sort on
- $order
string $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
integer $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
integer $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
integer $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
integer $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
integer $account_id The ID of the account to get
- $decrypt
boolean $decrypt Whether or not to decrypt the account number
- $passphrase
string $passphrase The passphrase required to decrypt accounts (if set)
- $staff_id
integer $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
integer $account_id The ID of the account to get
- $decrypt
boolean $decrypt Whether or not to decrypt the account number
- $passphrase
string $passphrase The passphrase required to decrypt accounts (if set)
- $staff_id
integer $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 )
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
integer $client_id The ID of the client to fetch the client reference ID for
- $gateway_id
integer $gateway_id The ID of the gateway to that previous account was set up under
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
array $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
array $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
integer $account_id The account ID for this account
- $vars
array $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 )
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
integer $account_id The account ID for this ACH account
|
public
integer
|
#
addCc( array $vars )
Records a CC account into the system
Records a CC account into the system
Parameters
- $vars
array $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, 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 securit 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 )
Verifies CC account info to ensure proper entry into the system
Verifies CC account info to ensure proper entry into the system
Parameters
- $vars
array $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, 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 securit 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
|
#
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
integer $account_id The account ID for this account
- $vars
array $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, 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 )
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
integer $account_id The account ID for this ACH account
|
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
string $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
|
private
array
|
#
getAddRules( array $vars )
Returns the partial rule set common between ACH/CC records for adding/editing
ACH/CC records
Returns the partial rule set common between ACH/CC records for adding/editing
ACH/CC records
Parameters
- $vars
array $vars The input vars
Returns
array Common ACH/CC rules
See
|
private
array
|
#
getAddAchRules( array $vars )
Returns the partial rule set for adding/editing ACH records
Returns the partial rule set for adding/editing ACH records
Parameters
- $vars
array $vars The input vars
Returns
array ACH specific rules
See
|
private
array
|
#
getAddCcRules( array $vars )
Returns the partial rule set for adding/editing CC records
Returns the partial rule set for adding/editing CC records
Parameters
- $vars
array $vars The input vars
Returns
array CC specific rules
See
|
private
string
|
#
accountEncrypt( string $data )
Performs an asymetric encryption on the given data for the current company
using RSA.
Performs an asymetric encryption on the given data for the current company
using RSA.
Parameters
- $data
string $data The data to encrypt with the asymetric public-key
Returns
string The encrypted text base64 encoded
|
private
mixed
|
#
accountDecrypt( string $data, string $passphrase = null )
Performs an asymetric decryption on the given data for the current company
using RSA.
Performs an asymetric decryption on the given data for the current company
using RSA.
Parameters
- $data
string $data The data to decrypt with the asymetric private-key, base64 encoded
- $passphrase
string $passphrase The passphrase required to decrypt the private-key stored in the
system (if set)
Returns
mixed The decrypted text (string) on success, (boolean) false on failure
|
public
string
|
#
formatNumber( string $value )
Formats a given string into an integer string
Formats a given string into an integer string
Parameters
- $value
string $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
- $type
string $type The ACH type
Returns
boolean True if validated, false otherwise
|
public
boolean
|
#
validateCcType( string $type )
Validates the CC 'type' field
Validates the CC 'type' field
Parameters
- $type
string $type The CC type
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
string $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
string $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
|