Location: PHPKode > scripts > skipjackResponseCheck > skipjackresponsecheck/skipjackResponse.php
<?php
 /**
 * Simple class to check the response codes given out by SkipJack sever
 * when a transaction is made.
 *
 * For more information on SkipJack Payment Gateway, checkout
 * http://www.skipjack.com/
 *
 *
 * Vinay Yadav (vinayRas)
 * hide@address.com
 *
 * http://www.vinayras.com/
 *
 */
 class skipjackResponseCheck {
     /**
     * Return status
     */
     var $statusMsg = "";
     /**
     * Status code
     * 1 - transaction approved
     * 0 - transcation disapprioved
     * szReturnCode - Error in data
     *
     * -1 - Authorization declined
     */
     var $statusCode = 0;
     /**
     * return response codes and corresponding meanings
     */
     var $responseArray = array(
                        "1"=>"Success (Valid Data)",
                        "-35"=>"Error invalid credit card number",
                        "-37"=>"Error failed communication",
                        "-39"=>"Error length serial number",
                        "-51"=>"Error length zip code",
                        "-52"=>"Error length shipto zip code",
                        "-53"=>"Error length expiration date",
                        "-54"=>"Error length account number date",
                        "-55"=>"Error length street address",
                        "-56"=>"Error length shipto street address",
                        "-57"=>"Error length transaction amount",
                        "-58"=>"Error length name",
                        "-59"=>"Error length location",
                        "-60"=>"Error length state",
                        "-61"=>"Error length shipto state",
                        "-62"=>"Error length order string",
                        "-64"=>"Error invalid phone number",
                        "-65"=>"Error empty name",
                        "-66"=>"Error empty email",
                        "-67"=>"Error empty street address",
                        "-68"=>"Error empty city",
                        "-69"=>"Error empty state",
                        "-79"=>"Error length customer name",
                        "-80"=>"Error length shipto customer name",
                        "-81"=>"Error length customer location",
                        "-82"=>"Error length customer state",
                        "-83"=>"Error length shipto phone",
                        "-84"=>"Pos error duplicate ordernumber",
                        "-91"=>"Pos_error_CVV2",
                        "-92"=>"Pos_error_Error_Approval_Code",
                        "-93"=>"Pos_error_Blind_Credits_Not_Allowed",
                        "-94"=>"Pos_error_Blind_Credits_Failed",
                        "-95"=>"Pos_error_Voice_Authorizations_Not_Allowed"
                    );

        /**
        * Constructor
        */
        function skipjackResponseCheck($post) {
           $this->post = $post;

           if($this->post['szIsApproved'] == 1) {
              /**
              * Everythign is fine... CC approved
              */
              $this->setTransactionStatus(1,"Transaction Approved");

              return;
           }

           if($this->checkValidData()) {
                /**
                * Submitted data is valid
                */
                if(!empty($this->post['szAuthorizationDeclinedMessage'])) {
                    $this->setTransactionStatus(-1,$this->post['szAuthorizationDeclinedMessage']);
                } else {
                    $this->setTransactionStatus(0,"Transaction Disapproved");
                }
           }
        }

        /**
        * Check for validity of data
        */
        function checkValidData() {
           $response = $this->post['szReturnCode'];
           if($response != 1) {
                $this->setTransactionStatus($response,$this->responseArray["$response"]);
                return  false;
           }
           return true;
        }

        /**
        * Set the transaction code and message
        */
        function setTransactionStatus($code,$msg) {
            $this->statusCode = $code;
            $this->statusMsg = $msg;
        }

        /**
        * Get the final status
        */
        function getStatus() {
           return $this->statusMsg;
        }
 }
?>
Return current item: skipjackResponseCheck