CORE POS - IS4C
The CORE POS front end
Static Public Member Functions | Public Attributes | List of all members
PaycardLib Class Reference

Defines constants and functions for card processing. More...

Static Public Member Functions

static paycard_info ($pan)
 
static paycard_accepted ($pan, $ebt=true)
 
static paycard_type ($pan)
 
static paycard_issuer ($pan)
 
static paycard_live ($type=self::PAYCARD_TYPE_UNKNOWN)
 
static paycard_reset ()
 
static paycard_wipe_pan ()
 
static paycard_validNumber ($pan)
 
static paycard_validExpiration ($exp)
 
static paycard_magstripe ($data)
 
static paycard_maskPAN ($pan, $first, $last)
 
static paycard_moneyFormat ($amt)
 
static paycard_errorText ($title, $code, $text, $retry, $standalone, $refuse, $carbon, $tellIT, $type)
 
static paycard_msgBox ($type, $title, $msg, $action)
 
static paycard_errBox ($type, $title, $msg, $action)
 
static paycard_db ()
 
static paycard_db_query ($query_text, $link)
 
static paycard_db_num_rows ($result)
 
static paycard_db_fetch_row ($result)
 

Public Attributes

const PAYCARD_MODE_BALANCE =1
 
const PAYCARD_MODE_AUTH =2
 
const PAYCARD_MODE_VOID =3
 
const PAYCARD_MODE_ACTIVATE =4
 
const PAYCARD_MODE_ADDVALUE =5
 
const PAYCARD_MODE_VOIDITEM =6
 
const PAYCARD_MODE_CASHOUT =7
 
const PAYCARD_TYPE_UNKNOWN =0
 
const PAYCARD_TYPE_CREDIT =1
 
const PAYCARD_TYPE_GIFT =2
 
const PAYCARD_TYPE_STORE =3
 
const PAYCARD_TYPE_ENCRYPTED =4
 
const PAYCARD_ERR_OK =1
 
const PAYCARD_ERR_NOSEND =-1
 
const PAYCARD_ERR_COMM =-2
 
const PAYCARD_ERR_TIMEOUT =-3
 
const PAYCARD_ERR_DATA =-4
 
const PAYCARD_ERR_PROC =-5
 
const PAYCARD_ERR_CONTINUE =-6
 
const PAYCARD_ERR_NSF_RETRY =-7
 
const PAYCARD_ERR_TRY_VERIFY =-8
 

Detailed Description

Defines constants and functions for card processing.

Member Function Documentation

static PaycardLib::paycard_accepted (   $pan,
  $ebt = true 
)
static

Check whether a given card is accepted

Parameters
$panthe card number
$ebt[boolean, default true]
Returns
  • 1 if accepted
  • 0 if not accepted
static PaycardLib::paycard_info (   $pan)
static

Identify card based on number

Parameters
$pancard number
Returns
array with keys:
  • 'type' paycard type constant
  • 'issuer' Vista, MasterCard, etc
  • 'accepted' boolean, whether card is accepted
  • 'test' boolean, whether number is a testing card

EBT-Specific Notes: EBT BINs added 20Mar14 by Andy Based on NACHA document; that document claims to be current as of 30Sep10.

Issuer is normally give as EBT (XX) where XX is the two character state postal abbreviation. GUAM is Guam and USVI is US Virgin Islands. A few states list both a state BIN number and a federal BIN number. In these cases there's an asterisk after the postal abbreviation. Maine listed both a state and federal BIN but they're identical so I don't know how to distinguish. The PAN length is not listed for Wyoming. I guessed 16 since that's most common.

static PaycardLib::paycard_issuer (   $pan)
static

Get paycard issuer

Parameters
$panthe card number
Returns
string issuer

Issuers include "Visa", "American Express", "MasterCard", and "Discover". Unrecognized cards will return "Unknown".

static PaycardLib::paycard_live (   $type = self::PAYCARD_TYPE_UNKNOWN)
static

Check whether paycards of a given type are enabled

Parameters
$typeis a paycard type constant
Returns
  • 1 if type is enabled
  • 0 if type is disabled
static PaycardLib::paycard_magstripe (   $data)
static

Extract information from a magnetic stripe

Parameters
$datathe stripe data
Returns
An array with keys:
  • 'pan' the card number
  • 'exp' the expiration as MMYY
  • 'name' the cardholder name
  • 'tr1' data from track 1
  • 'tr2' data from track 1
  • 'tr3' data from track 1

Not all values will be found in every track. Keys with no data will be set to False.

If the data is really malformed, the return will be an error code instead of an array.

static PaycardLib::paycard_reset ( )
static

Clear paycard variables from session

static PaycardLib::paycard_type (   $pan)
static

Determine card type

Parameters
$panthe card number
Returns
a paycard type constant
static PaycardLib::paycard_validExpiration (   $exp)
static

Validate expiration date

Parameters
$expexpiration formatted MMYY
Returns
  • 1 if ok
  • -1 if the argument is malformed
  • -2 if the month is smarch-y
  • -3 if the date is in the past
static PaycardLib::paycard_validNumber (   $pan)
static

Validate number using Luhn's Algorithm

Parameters
$panthe card number
Returns
  • 1 if the number is valid
  • 0 if the number is invalid
static PaycardLib::paycard_wipe_pan ( )
static

Clear card data variables from session

Storing card data in session is not recommended.


The documentation for this class was generated from the following file: