|
| BasicCCModule () |
|
| handlesType ($type) |
|
| entered ($validate, $json) |
|
| doSend ($type) |
|
| cleanup ($json) |
|
| paycard_void ($transID, $laneNo=-1, $transNo=-1, $json=array()) |
|
| myRefNum ($ref) |
|
| lookupTransaction ($ref, $local, $mode) |
|
| curlSend ($data=False, $type='POST', $xml=False, $extraOpts=array(), $auto_handle=true) |
|
| handleResponse ($response) |
|
| refnum ($transID) |
|
| array2post ($parray) |
|
| soapify ($action, $objs, $namespace="", $encode_tags=true) |
|
| desoapify ($action, $soaptext) |
|
| setErrorMsg ($errorCode) |
|
| setPAN ($in) |
|
|
| $last_ref_num = '' |
|
| $last_req_id = 0 |
|
| $last_paycard_transaction_id = 0 |
|
Generic Credit Card processing module
All payment processing modules should descend from this class. Required methods are:
Additionally, while they technically may be omitted in the subclass, it is strongly recommended that module implement its own:
The rest is utility methods that are often helpful.
BasicCCModule::array2post |
( |
|
$parray) | |
|
urlencodes the given array for use with curl
- Parameters
-
- Returns
- formatted string
BasicCCModule::BasicCCModule |
( |
) | |
|
Constructor takes no arguments otherwise, do whatever you want here
BasicCCModule::cleanup |
( |
|
$json) | |
|
This function is called when doSend() returns PaycardLib::PAYCARD_ERR_OK.
I use it for tendering, printing receipts, etc, but it's really only for code cleanliness. You could leave this as is and do all the everything inside doSend()
BasicCCModule::curlSend |
( |
|
$data = False , |
|
|
|
$type = 'POST' , |
|
|
|
$xml = False , |
|
|
|
$extraOpts = array() , |
|
|
|
$auto_handle = true |
|
) |
| |
Send a curl request with the specified data.
- Parameters
-
$data | string of data |
$type | 'GET', 'POST', or 'SOAP' |
$xml | True or False |
$extraOpts | array of curl options and values |
$auto_handle | [boolean] true => call handleResponse method automatically false => just return curl result |
- Returns
- integer error code
The url should be specified in $this->GATEWAY.
SOAP requests should aso set $this->$SOAPACTION.
Data is usually a string of XML or an HTTP
argument like key1=val1&key2=val2...
Setting xml to True adds an content-type header
This function calls the handleResponse method
and returns the result of that call.
BasicCCModule::desoapify |
( |
|
$action, |
|
|
|
$soaptext |
|
) |
| |
Extract response from a soap envelope
- Parameters
-
$action | is the top level tag in the soap body |
$soaptext | is the full soap response |
BasicCCModule::doSend |
( |
|
$type) | |
|
Process the paycard request and return an error value as defined in paycardLib.php.
- Parameters
-
- Returns
- On success, return PaycardLib::PAYCARD_ERR_OK.
- On failure, return anything else and set any error messages to be displayed in session variable "boxMsg".
This function should submit a request to the gateway and process the result. By convention credit card request and response info is stored in the efsnet* tables and gift card request and response info is stored in the valutec* tables.
Do not store full card number when logging request and response info.
BasicCCModule::entered |
( |
|
$validate, |
|
|
|
$json |
|
) |
| |
Set up transaction and validate if desired
- Parameters
-
$validate | boolean |
$json | A keyed array |
- Returns
- An array see Parser::default_json() for formatting.
This function typically does some validation and sets some values in the session.
If you have 'output' defined in the return array, that gets shown as an error message. If you set a URL in 'main_frame', POS might go there but it's not guaranteed.
BasicCCModule::handleResponse |
( |
|
$response) | |
|
Processes data fetched by $this->curlSend()
- Parameters
-
$response | is a keyed array with:
- curlErr cURL error code
- curlErrText cURL error message
- curlTime time spent fetching response
- curlHTTP response HTTP code
- response is the actual text result
|
- Returns
- An error code. Constants are specified in paycardLib.php. PaycardLib::PAYCARD_ERR_OK should be return on success.
BasicCCModule::handlesType |
( |
|
$type) | |
|
Check whether module handles this paycard type
- Parameters
-
- Returns
- True or False
Type constants are defined in paycardLib.php.
BasicCCModule::lookupTransaction |
( |
|
$ref, |
|
|
|
$local, |
|
|
|
$mode |
|
) |
| |
Lookup transaction status
- Parameters
-
$ref | [string] efsnetRequest.refNum |
$local | [int] 1 => transaction is in local efsnetRequest table 0 => transaction is in server's efsnetRequest table |
$mode | [string] lookup => just fetch information from the processor verify => update efsnetResponse with retreived information |
- Returns
- [keyed array] output => HTML msg to display for the user confirm_dest => URL destination if the user presses enter cancel_dest => URL destination if the user presses clear
BasicCCModule::myRefNum |
( |
|
$ref) | |
|
The given efsnetRequest.refNum value corresponds to the format used by this class
- Parameters
-
$ref | [string] efsnetRequest.refNum |
- Returns
- [boolean]
BasicCCModule::paycard_void |
( |
|
$transID, |
|
|
|
$laneNo = -1 , |
|
|
|
$transNo = -1 , |
|
|
|
$json = array() |
|
) |
| |
Validation and setup for void transactions
- Parameters
-
$transID | original transaction ID |
$laneNo | original transaction laneNo value |
$transNo | original transaction transNo value |
$json | keyed array |
- Returns
- An array see Parser::default_json() for formatting
This function is similar to entered(). Typically with a void there is additional validation to check the status of the original transaction before proceeding.
BasicCCModule::refnum |
( |
|
$transID) | |
|
Create a reference number from session variables.
- Parameters
-
$transID | current trans_id in localtemptrans |
- Returns
- A string CCCCLLNNNIII where
- CCCC is cashier number
- LL is lane number
- NNN is transaction number
- III is transaction ID
BasicCCModule::setErrorMsg |
( |
|
$errorCode) | |
|
- Parameters
-
$errorCode | error code contstant from paycardLib.php |
Set CoreLocal::["boxMsg"] appropriately for the given error code. I find this easier than manually setting an appropriate message every time I return a common error like PaycardLib::PAYCARD_ERR_NOSEND. I think everything but PaycardLib::PAYCARD_ERR_PROC can have one default message assigned here
BasicCCModule::setPAN |
( |
|
$in) | |
|
Store card data in class member $trans_pan.
- Parameters
-
$in | is a keyed array:
- pan is the card number
- tr1 is magnetic stripe track 1, if available
- tr2 is magnetic stripe track 2, if available
- tr3 is magnetic stripe track 3, if available
|
Recommended for credit card modules. Card data can be populated at the last possible moment before calling doSend and expunged again once the request has been submitted to the gateway.
BasicCCModule::soapify |
( |
|
$action, |
|
|
|
$objs, |
|
|
|
$namespace = "" , |
|
|
|
$encode_tags = true |
|
) |
| |
Put objects into a soap envelope
- Parameters
-
$action | top level tag in the soap body |
$objs | keyed array of values |
$namespace | include an xmlns attribute |
- Returns
- soap string
BasicCCModule::$SOAP_ENVELOPE_ATTRS |
|
protected |
Initial value:= array(
"xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"",
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"",
"xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""
)
Envelope attributes for SOAP.
The documentation for this class was generated from the following file:
- pos/is4c-nf/plugins/Paycards/BasicCCModule.php