コード例 #1
0
ファイル: PaycardSteering.php プロジェクト: phpsmith/IS4C
 function parse($str)
 {
     $ret = $this->default_json();
     if ($str == 'PCLOOKUP') {
         $info = new Paycards();
         $ret['main_frame'] = $info->pluginUrl() . '/gui/PaycardTransListPage.php';
         CoreLocal::set('strEntered', '');
     }
     return $ret;
 }
コード例 #2
0
ファイル: PaycardProcessPage.php プロジェクト: phpsmith/IS4C
    /**
       Include some paycard submission javascript functions.
       Automatically called during page print.
    */
    protected function paycard_jscript_functions()
    {
        $plugin_info = new Paycards();
        ?>
        <script type="text/javascript">
        function paycard_submitWrapper(){
            $.ajax({url: '<?php 
        echo $plugin_info->pluginUrl();
        ?>
/ajax/ajax-paycard-auth.php',
                cache: false,
                type: 'post',
                dataType: 'json',
                success: function(data){
                    var destination = data.main_frame;
                    if (data.receipt){
                        $.ajax({url: '<?php 
        echo $this->page_url;
        ?>
ajax-callbacks/ajax-end.php',
                            cache: false,
                            type: 'post',
                            data: 'receiptType='+data.receipt+'&ref=<?php 
        echo ReceiptLib::receiptNumber();
        ?>
',
                            error: function(){
                                location = destination;
                            },
                            success: function(data){
                                location = destination;
                            }
                        });
                    }
                    else
                        location = destination;
                },
                error: function(){
                    location = '<?php 
        echo $plugin_info->pluginUrl();
        ?>
/gui/paycardboxMsgAuth.php';
                }
            });
            paycard_processingDisplay();
            return false;
        }
        function paycard_processingDisplay(){
            var content = $('div.baseHeight').html();
            if (content.length >= 23)
                content = 'Waiting for response.';
            else
                content += '.';
            $('div.baseHeight').html(content);
            setTimeout('paycard_processingDisplay()',1000);
        }
        </script>
        <?php 
    }
コード例 #3
0
ファイル: PaycardEmvBalance.php プロジェクト: phpsmith/IS4C
 function preprocess()
 {
     // check for posts before drawing anything, so we can redirect
     if (isset($_REQUEST['reginput'])) {
         $input = strtoupper(trim($_REQUEST['reginput']));
         // CL always exits
         if ($input == "CL") {
             PaycardLib::paycard_reset();
             $this->change_page($this->page_url . "gui-modules/pos2.php");
             return false;
         } elseif ($input == "" || $input == 'MANUAL') {
             $this->action = "onsubmit=\"return false;\"";
             $this->add_onload_command("emvSubmit();");
             if ($input == 'MANUAL') {
                 $this->prompt = true;
             }
             $this->run_transaction = true;
         }
         // if we're still here, we haven't accepted a valid amount yet; display prompt again
     } elseif (isset($_REQUEST['xml-resp'])) {
         $xml = $_REQUEST['xml-resp'];
         $e2e = new MercuryE2E();
         $json = array();
         $plugin_info = new Paycards();
         $json['main_frame'] = $plugin_info->pluginUrl() . '/gui/PaycardEmvSuccess.php';
         $json['receipt'] = false;
         $success = $e2e->handleResponseDataCapBalance($xml);
         if ($success === PaycardLib::PAYCARD_ERR_OK) {
             $json = $e2e->cleanup($json);
             CoreLocal::set("strEntered", "");
             CoreLocal::set("strRemembered", "");
             CoreLocal::set("msgrepeat", 0);
             if ($json['receipt']) {
                 $json['main_frame'] .= '?receipt=' . $json['receipt'];
             }
         } else {
             CoreLocal::set("msgrepeat", 0);
             $json['main_frame'] = MiscLib::base_url() . 'gui-modules/boxMsg2.php';
         }
         header('Location: ' . $json['main_frame']);
         return false;
     }
     return true;
 }
コード例 #4
0
ファイル: PaycardEmvVoid.php プロジェクト: phpsmith/IS4C
 function preprocess()
 {
     $this->hide_input(true);
     $dbc = Database::tDataConnect();
     $q = '
         SELECT MAX(paycardTransactionID) 
         FROM PaycardTransactions
         WHERE transID=' . (int) CoreLocal::get('paycard_id');
     $r = $dbc->query($q);
     if ($r && $dbc->numRows($r)) {
         $w = $dbc->fetchRow($r);
         $this->id = $w[0];
     }
     if (!$this->id) {
         CoreLocal::set('boxMsg', 'Cannot locate transaction to void');
         $this->change_page(MiscLib::baseURL() . 'gui-modules/boxMsg2.php');
         return false;
     }
     CoreLocal::set('paycard_mode', PaycardLib::PAYCARD_MODE_VOID);
     // check for posts before drawing anything, so we can redirect
     if (isset($_REQUEST['reginput'])) {
         $input = strtoupper(trim($_REQUEST['reginput']));
         // CL always exits
         if ($input == "CL") {
             PaycardLib::paycard_reset();
             CoreLocal::set("msgrepeat", 1);
             CoreLocal::set("strRemembered", 'TO');
             CoreLocal::set("toggletax", 0);
             CoreLocal::set("togglefoodstamp", 0);
             $this->change_page($this->page_url . "gui-modules/pos2.php");
             return false;
         } elseif (Authenticate::checkPassword($input)) {
             $this->action = "onsubmit=\"return false;\"";
             $this->add_onload_command("emvSubmit();");
             $this->run_transaction = true;
         }
         // if we're still here, we haven't accepted a valid amount yet; display prompt again
     } elseif (isset($_REQUEST['xml-resp'])) {
         $xml = $_REQUEST['xml-resp'];
         $e2e = new MercuryE2E();
         $json = array();
         $plugin_info = new Paycards();
         $json['main_frame'] = $plugin_info->pluginUrl() . '/gui/PaycardEmvSuccess.php';
         $json['receipt'] = false;
         $success = $e2e->handleResponseDataCap($xml);
         if ($success === PaycardLib::PAYCARD_ERR_OK) {
             $json = $e2e->cleanup($json);
             CoreLocal::set("strEntered", "");
             CoreLocal::set("strRemembered", "");
             CoreLocal::set("msgrepeat", 0);
             if ($json['receipt']) {
                 $json['main_frame'] .= '?receipt=' . $json['receipt'];
             }
         } else {
             CoreLocal::set("msgrepeat", 0);
             $json['main_frame'] = MiscLib::base_url() . 'gui-modules/boxMsg2.php';
         }
         header('Location: ' . $json['main_frame']);
         return false;
     }
     return true;
 }
コード例 #5
0
ファイル: Valutec.php プロジェクト: phpsmith/IS4C
 public function paycard_void($transID, $laneNo = -1, $transNo = -1, $json = array())
 {
     // situation checking
     $enabled = PaycardDialogs::enabledCheck();
     if ($enabled !== true) {
         $json['output'] = $enabled;
         return $json;
     }
     // initialize
     $cashier = CoreLocal::get("CashierNo");
     $lane = CoreLocal::get("laneno");
     $trans = CoreLocal::get("transno");
     if ($laneNo != -1) {
         $lane = $laneNo;
     }
     if ($transNo != -1) {
         $trans = $transNo;
     }
     list($success, $request) = PaycardDialogs::getRequest(array($cashier, $lane, $trans), $transID);
     if ($success === false) {
         $json['output'] = $request;
         return $json;
     }
     list($success, $response) = PaycardDialogs::getResponse(array($cashier, $lane, $trans), $transID);
     if ($success === false) {
         $json['output'] = $response;
         return $json;
     }
     // look up any previous successful voids
     $eligible = PaycardDialogs::notVoided(array($cashier, $lane, $trans), $transID);
     if ($eligible === false) {
         $json['output'] = $eligible;
         return $json;
     }
     list($success, $lineitem) = PaycardDialogs::getTenderLine(array($cashier, $lane, $trans), $transID);
     if ($success === false) {
         $json['output'] = $lineitem;
         return $json;
     }
     $valid = PaycardDialogs::validateVoid($request, $response, $lineitem, $transID);
     if ($valid !== true) {
         $json['output'] = $valid;
         return $json;
     }
     // save the details
     CoreLocal::set("paycard_PAN", $request['PAN']);
     if ($request['mode'] == 'refund' || $request['mode'] == 'Return') {
         CoreLocal::set("paycard_amount", -$request['amount']);
     } else {
         CoreLocal::set("paycard_amount", $request['amount']);
     }
     CoreLocal::set("paycard_id", $transID);
     CoreLocal::set("paycard_type", PaycardLib::PAYCARD_TYPE_GIFT);
     if ($lineitem['trans_type'] == "T" && $lineitem['trans_subtype'] == "GD") {
         CoreLocal::set("paycard_mode", PaycardLib::PAYCARD_MODE_VOID);
     } else {
         CoreLocal::set("paycard_mode", PaycardLib::PAYCARD_MODE_VOIDITEM);
     }
     // display FEC code box
     $plugin_info = new Paycards();
     $json['main_frame'] = $plugin_info->pluginUrl() . '/gui/paycardboxMsgVoid.php';
     return $json;
 }
コード例 #6
0
ファイル: GoEMerchant.php プロジェクト: phpsmith/IS4C
 public function lookupTransaction($ref, $local, $mode)
 {
     $merchantID = GOEMERCH_ID;
     $password = GOEMERCH_PASSWD;
     $gatewayID = GOEMERCH_GATEWAY_ID;
     if (substr($ref, 13, 4) == "9999") {
         $merchantID = "1264";
         $password = "******";
         $gatewayID = "a91c38c3-7d7f-4d29-acc7-927b4dca0dbe";
     }
     $dateStr = date('mdy');
     $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
     $xml .= "<TRANSACTION>";
     $xml .= "<FIELDS>";
     $xml .= "<FIELD KEY=\"merchant\">{$merchantID}</FIELD>";
     if ($password != "") {
         $xml .= "<FIELD KEY=\"password\">{$password}</FIELD>";
     }
     $xml .= "<FIELD KEY=\"gateway_id\">{$gatewayID}</FIELD>";
     $xml .= "<FIELD KEY=\"operation_type\">query</FIELD>";
     $xml .= "<FIELD KEY=\"trans_type\">SALE</FIELD>";
     $xml .= "<FIELD KEY=\"begin_date\">{$dateStr}</FIELD>";
     $xml .= "<FIELD KEY=\"begin_time\">0001AM</FIELD>";
     $xml .= "<FIELD KEY=\"end_date\">{$dateStr}</FIELD>";
     $xml .= "<FIELD KEY=\"end_time\">1159PM</FIELD>";
     $xml .= "<FIELD KEY=\"order_id\">{$ref}</FIELD>";
     $xml .= "</FIELDS>";
     $xml .= "</TRANSACTION>";
     $this->GATEWAY = "https://secure.goemerchant.com/secure/gateway/xmlgateway.aspx";
     $curl_result = $this->curlSend($xml, 'POST', true, array(), false);
     if ($curl_result['curlErr'] != CURLE_OK || $curl_result['curlHTTP'] != 200) {
         return array('output' => DisplayLib::boxMsg('No response from processor', '', true), 'confirm_dest' => MiscLib::base_url() . 'gui-modules/pos2.php', 'cancel_dest' => MiscLib::base_url() . 'gui-modules/pos2.php');
     }
     $directions = 'Press [enter] or [clear] to continue';
     $resp = array('confirm_dest' => MiscLib::base_url() . 'gui-modules/pos2.php', 'cancel_dest' => MiscLib::base_url() . 'gui-modules/pos2.php');
     $info = new Paycards();
     $url_stem = $info->pluginUrl();
     $xml_resp = new xmlData($curl_result['response']);
     $status = 'UNKNOWN';
     if ($xml_resp->get_first('RECORDS_FOUND') == 0) {
         $status = 'NOTFOUND';
         $directions = 'Press [enter] to try again, [clear] to stop';
         $query_string = 'id=' . ($local ? '_l' : '') . $ref . '&mode=' . $mode;
         $resp['confirm_dest'] = $url_stem . '/gui/PaycardTransLookupPage.php?' . $query_string;
     } else {
         $responseCode = $xml_resp->get_first('TRANS_STATUS1');
         $resultCode = $responseCode;
         $normalized = $resultCode;
         $xTransID = $xml_resp->get_first('REFERENCE_NUMBER1');
         $rMsg = '';
         if ($responseCode == 1) {
             $status = 'APPROVED';
             $rMsg = 'APPROVED';
             $normalized = 1;
         } else {
             if ($responseCode == 2) {
                 $status == 'DECLINED';
                 $rMsg = 'DECLINED';
                 $normalized = 2;
             } else {
                 if ($responseCode == 0) {
                     $status == 'ERROR';
                     $eMsg = $xml_resp->get_first('ERROR1');
                     $normalized = 3;
                     if ($eMsg) {
                         $rMsg = substr($eMsg, 0, 100);
                     } else {
                         $rMsg = 'ERROR';
                     }
                 } else {
                     $responseCode = -3;
                     $normalized = 0;
                     $status = 'UNKNOWN';
                 }
             }
         }
         $apprNumber = '';
         // not returned by query op
         if ($local == 1 && $mode == 'verify') {
             // Update efsnetResponse record to contain
             // actual processor result and finish
             // the transaction correctly
             $db = Database::tDataConnect();
             $upP = $db->prepare("\n                    UPDATE PaycardTransactions \n                    SET xResponseCode=?,\n                        xResultCode=?,\n                        xResultMessage=?,\n                        xTransactionID=?,\n                        xApprovalNumber=?,\n                        commErr=0,\n                        httpCode=200,\n                        validResponse=?\n                    WHERE refNum=?\n                        AND transID=?");
             $args = array($responseCode, $resultCode, $rMsg, $xTransID, $apprNumber, $normalized, $ref, CoreLocal::get('paycard_id'));
             $upR = $db->execute($upP, $args);
             $upP = $db->prepare("\n                    UPDATE efsnetResponse SET\n                        xResponseCode=?,\n                        xResultCode=?, \n                        xResultMessage=?,\n                        xTransactionID=?,\n                        xApprovalNumber=?,\n                        commErr=0,\n                        httpCode=200\n                    WHERE refNum=?\n                        AND transID=?");
             $args = array($responseCode, $resultCode, $rMsg, $xTransID, $apprNumber, $ref, CoreLocal::get('paycard_id'));
             if ($db->table_exists('efsnetResponse')) {
                 $upR = $db->execute($upP, $args);
             }
             if ($status == 'APPROVED') {
                 PaycardLib::paycard_wipe_pan();
                 $this->cleanup(array());
                 $resp['confirm_dest'] = $url_stem . '/gui/paycardSuccess.php';
                 $resp['cancel_dest'] = $url_stem . '/gui/paycardSuccess.php';
                 $directions = 'Press [enter] to continue';
             } else {
                 PaycardLib::paycard_reset();
             }
         }
         // end verification record update
     }
     // end found result
     switch (strtoupper($status)) {
         case 'APPROVED':
             $line1 = $status;
             $line2 = 'Amount: ' . sprintf('%.2f', $xml_resp->get_first('AMOUNT1'));
             $line3 = 'Type: CREDIT';
             $voided = $xml_resp->get_first('CREDIT_VOID1');
             $line4 = 'Voided: ' . (strtoupper($voided) == 'VOID' ? 'Yes' : 'No');
             $resp['output'] = DisplayLib::boxMsg($line1 . '<br />' . $line2 . '<br />' . $line3 . '<br />' . $line4 . '<br />' . $directions, '', true);
             break;
         case 'DECLINED':
             $resp['output'] = DisplayLib::boxMsg('The original transaction was declined
                                                   <br />' . $directions, '', true);
             break;
         case 'ERROR':
             $resp['output'] = DisplayLib::boxMsg('The original transaction resulted in an error
                                                   <br />' . $directions, '', true);
             break;
         case 'NOTFOUND':
             $resp['output'] = DisplayLib::boxMsg('Processor has no record of the transaction
                                                   <br />' . $directions, '', true);
             break;
         case 'UNKNOWN':
             $resp['output'] = DisplayLib::boxMsg('Processor responded but made no sense
                                                   <br />' . $directions, '', true);
             break;
     }
     return $resp;
 }
コード例 #7
0
ファイル: PaycardEmvPage.php プロジェクト: phpsmith/IS4C
 function preprocess()
 {
     // check for posts before drawing anything, so we can redirect
     if (isset($_REQUEST['reginput'])) {
         $input = strtoupper(trim($_REQUEST['reginput']));
         // CL always exits
         if ($input == "CL") {
             CoreLocal::set("msgrepeat", 0);
             CoreLocal::set("toggletax", 0);
             CoreLocal::set("togglefoodstamp", 0);
             PaycardLib::paycard_reset();
             CoreLocal::set("CachePanEncBlock", "");
             CoreLocal::set("CachePinEncBlock", "");
             CoreLocal::set("CacheCardType", "");
             CoreLocal::set("CacheCardCashBack", 0);
             CoreLocal::set('ccTermState', 'swipe');
             UdpComm::udpSend("termReset");
             $this->change_page($this->page_url . "gui-modules/pos2.php");
             return False;
         } elseif ($input == "" || $input == 'MANUAL') {
             if ($this->validate_amount()) {
                 $this->action = "onsubmit=\"return false;\"";
                 $this->add_onload_command("emvSubmit();");
                 if ($input == 'MANUAL') {
                     $this->prompt = true;
                 }
                 $this->run_transaction = true;
             }
         } elseif ($input != "" && substr($input, -2) != "CL") {
             // any other input is an alternate amount
             CoreLocal::set("paycard_amount", "invalid");
             if (is_numeric($input)) {
                 CoreLocal::set("paycard_amount", $input / 100);
                 if (CoreLocal::get('CacheCardCashBack') > 0 && CoreLocal::get('CacheCardCashBack') <= 40) {
                     CoreLocal::set('paycard_amount', $input / 100 + CoreLocal::get('CacheCardCashBack'));
                 }
             }
         }
         // if we're still here, we haven't accepted a valid amount yet; display prompt again
     } elseif (isset($_REQUEST['xml-resp'])) {
         $xml = $_REQUEST['xml-resp'];
         $e2e = new MercuryE2E();
         $json = array();
         $plugin_info = new Paycards();
         $json['main_frame'] = $plugin_info->pluginUrl() . '/gui/PaycardEmvSuccess.php';
         $json['receipt'] = false;
         $success = $e2e->handleResponseDataCap($xml);
         if ($success === PaycardLib::PAYCARD_ERR_OK) {
             $json = $e2e->cleanup($json);
             CoreLocal::set("strRemembered", "");
             CoreLocal::set("msgrepeat", 0);
             if ($json['receipt']) {
                 $json['main_frame'] .= '?receipt=' . $json['receipt'];
             }
         } else {
             CoreLocal::set("msgrepeat", 0);
             $json['main_frame'] = MiscLib::base_url() . 'gui-modules/boxMsg2.php';
         }
         header('Location: ' . $json['main_frame']);
         return false;
     }
     // post?
     return true;
 }
コード例 #8
0
ファイル: PaycardLib.php プロジェクト: phpsmith/IS4C
 public static function setupAuthJson($json)
 {
     if (CoreLocal::get("paycard_amount") == 0) {
         CoreLocal::set("paycard_amount", CoreLocal::get("amtdue"));
     }
     CoreLocal::set("paycard_id", CoreLocal::get("LastID") + 1);
     // kind of a hack to anticipate it this way..
     $plugin_info = new Paycards();
     $json['main_frame'] = $plugin_info->pluginUrl() . '/gui/paycardboxMsgAuth.php';
     $json['output'] = '';
     return $json;
 }
コード例 #9
0
 public function parse($str)
 {
     $ret = $this->default_json();
     $plugin_info = new Paycards();
     $ret['main_frame'] = $plugin_info->pluginUrl() . '/gui/PaycardEmvPage.php';
     Database::getsubtotals();
     switch ($str) {
         case 'DATACAP':
             $ret['main_frame'] = $plugin_info->pluginUrl() . '/gui/PaycardEmvMenu.php';
             break;
         case 'DATACAPEMV':
             CoreLocal::set('paycard_amount', CoreLocal::get('amtdue'));
             CoreLocal::set('CacheCardType', 'EMV');
             CoreLocal::set('paycard_mode', PaycardLib::PAYCARD_MODE_AUTH);
             CoreLocal::set('paycard_type', PaycardLib::PAYCARD_TYPE_CREDIT);
             break;
         case 'DATACAPCC':
             CoreLocal::set('paycard_amount', CoreLocal::get('amtdue'));
             CoreLocal::set('CacheCardType', 'CREDIT');
             CoreLocal::set('paycard_mode', PaycardLib::PAYCARD_MODE_AUTH);
             CoreLocal::set('paycard_type', PaycardLib::PAYCARD_TYPE_CREDIT);
             break;
         case 'DATACAPDC':
             CoreLocal::set('paycard_amount', CoreLocal::get('amtdue'));
             if (CoreLocal::get('CacheCardCashBack')) {
                 CoreLocal::set('paycard_amount', CoreLocal::get('amtdue') + CoreLocal::get('CacheCardCashBack'));
             }
             CoreLocal::set('CacheCardType', 'DEBIT');
             CoreLocal::set('paycard_mode', PaycardLib::PAYCARD_MODE_AUTH);
             CoreLocal::set('paycard_type', PaycardLib::PAYCARD_TYPE_CREDIT);
             break;
         case 'DATACAPEF':
             if (CoreLocal::get('fntlflag') == 0) {
                 /* try to automatically do fs total */
                 $try = PrehLib::fsEligible();
                 if ($try !== true) {
                     $ret['output'] = PaycardLib::paycard_msgBox($type, "Type Mismatch", "Foodstamp eligible amount inapplicable", "[clear] to cancel");
                     $ret['main_frame'] = false;
                     return $ret;
                 }
             }
             CoreLocal::set('paycard_amount', CoreLocal::get('fsEligible'));
             CoreLocal::set('CacheCardType', 'EBTFOOD');
             CoreLocal::set('paycard_mode', PaycardLib::PAYCARD_MODE_AUTH);
             CoreLocal::set('paycard_type', PaycardLib::PAYCARD_TYPE_CREDIT);
             break;
         case 'DATACAPEC':
             CoreLocal::set('paycard_amount', CoreLocal::get('amtdue'));
             if (CoreLocal::get('CacheCardCashBack')) {
                 CoreLocal::set('paycard_amount', CoreLocal::get('amtdue') + CoreLocal::get('CacheCardCashBack'));
             }
             CoreLocal::set('CacheCardType', 'EBTCASH');
             CoreLocal::set('paycard_mode', PaycardLib::PAYCARD_MODE_AUTH);
             CoreLocal::set('paycard_type', PaycardLib::PAYCARD_TYPE_CREDIT);
             break;
         case 'DATACAPGD':
             CoreLocal::set('paycard_amount', CoreLocal::get('amtdue'));
             CoreLocal::set('CacheCardType', 'GIFT');
             CoreLocal::set('paycard_mode', PaycardLib::PAYCARD_MODE_AUTH);
             CoreLocal::set('paycard_type', PaycardLib::PAYCARD_TYPE_GIFT);
             break;
         case 'PVDATACAPGD':
             CoreLocal::set('CacheCardType', 'GIFT');
             CoreLocal::set('paycard_mode', PaycardLib::PAYCARD_MODE_BALANCE);
             CoreLocal::set('paycard_type', PaycardLib::PAYCARD_TYPE_GIFT);
             $ret['main_frame'] = $plugin_info->pluginUrl() . '/gui/PaycardEmvBalance.php';
             break;
         case 'PVDATACAPEF':
             CoreLocal::set('CacheCardType', 'EBTFOOD');
             CoreLocal::set('paycard_mode', PaycardLib::PAYCARD_MODE_BALANCE);
             CoreLocal::set('paycard_type', PaycardLib::PAYCARD_TYPE_CREDIT);
             $ret['main_frame'] = $plugin_info->pluginUrl() . '/gui/PaycardEmvBalance.php';
             break;
         case 'PVDATACAPEC':
             CoreLocal::set('CacheCardType', 'EBTCASH');
             CoreLocal::set('paycard_mode', PaycardLib::PAYCARD_MODE_BALANCE);
             CoreLocal::set('paycard_type', PaycardLib::PAYCARD_TYPE_CREDIT);
             $ret['main_frame'] = $plugin_info->pluginUrl() . '/gui/PaycardEmvBalance.php';
             break;
         case 'ACDATACAPGD':
             CoreLocal::set('CacheCardType', 'GIFT');
             CoreLocal::set('paycard_mode', PaycardLib::PAYCARD_MODE_ACTIVATE);
             CoreLocal::set('paycard_type', PaycardLib::PAYCARD_TYPE_GIFT);
             $ret['main_frame'] = $plugin_info->pluginUrl() . '/gui/PaycardEmvGift.php?mode=' . CoreLocal::get('paycard_mode');
             break;
         case 'AVDATACAPGD':
             CoreLocal::set('CacheCardType', 'GITFT');
             CoreLocal::set('paycard_mode', PaycardLib::PAYCARD_MODE_ADDVALUE);
             CoreLocal::set('paycard_type', PaycardLib::PAYCARD_TYPE_GIFT);
             $ret['main_frame'] = $plugin_info->pluginUrl() . '/gui/PaycardEmvGift.php?mode=' . CoreLocal::get('paycard_mode');
             break;
     }
     CoreLocal::set('paycard_id', CoreLocal::get('LastID') + 1);
     return $ret;
 }
コード例 #10
0
ファイル: ajax-paycard-auth.php プロジェクト: phpsmith/IS4C
    You should have received a copy of the GNU General Public License
    in the file license.txt along with IT CORE; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

*********************************************************************************/
if (basename($_SERVER['PHP_SELF']) != basename(__FILE__)) {
    return;
}
ini_set('display_errors', 'Off');
include_once dirname(__FILE__) . '/../../../lib/AutoLoader.php';
// send the request
$result = 0;
// 0 is never returned, so we use it to make sure it changes
$myObj = 0;
$json = array();
$plugin_info = new Paycards();
$json['main_frame'] = $plugin_info->pluginUrl() . '/gui/paycardSuccess.php';
$json['receipt'] = false;
foreach (CoreLocal::get("RegisteredPaycardClasses") as $rpc) {
    $myObj = new $rpc();
    if ($myObj->handlesType(CoreLocal::get("paycard_type"))) {
        break;
    }
}
$result = $myObj->doSend(CoreLocal::get("paycard_mode"));
if ($result === PaycardLib::PAYCARD_ERR_OK) {
    PaycardLib::paycard_wipe_pan();
    $json = $myObj->cleanup($json);
    CoreLocal::set("strRemembered", "");
    CoreLocal::set("msgrepeat", 0);
} else {
コード例 #11
0
ファイル: PaycardEmvSuccess.php プロジェクト: phpsmith/IS4C
 function preprocess()
 {
     $this->bmp_path = $this->page_url . 'scale-drivers/drivers/NewMagellan/ss-output/tmp/';
     // check for input
     if (isset($_REQUEST["reginput"])) {
         $input = strtoupper(trim($_POST["reginput"]));
         // capture file if present; otherwise re-request
         // signature via terminal
         if (isset($_REQUEST['doCapture']) && $_REQUEST['doCapture'] == 1 && $input == '') {
             if (isset($_REQUEST['bmpfile']) && !empty($_REQUEST['bmpfile']) && file_exists($_REQUEST['bmpfile'])) {
                 $bmp = file_get_contents($_REQUEST['bmpfile']);
                 $format = 'BMP';
                 $img_content = $bmp;
                 $dbc = Database::tDataConnect();
                 $capQ = 'INSERT INTO CapturedSignature
                             (tdate, emp_no, register_no, trans_no,
                              trans_id, filetype, filecontents)
                          VALUES
                             (?, ?, ?, ?,
                              ?, ?, ?)';
                 $capP = $dbc->prepare_statement($capQ);
                 $args = array(date('Y-m-d H:i:s'), CoreLocal::get('CashierNo'), CoreLocal::get('laneno'), CoreLocal::get('transno'), CoreLocal::get('paycard_id'), $format, $img_content);
                 $capR = $dbc->exec_statement($capP, $args);
                 unlink($_REQUEST['bmpfile']);
                 // continue to below. finishing transaction is the same
                 // as with paper signature slip
             } else {
                 UdpComm::udpSend('termSig');
                 return true;
             }
         }
         $mode = CoreLocal::get("paycard_mode");
         $type = CoreLocal::get("paycard_type");
         $tender_id = CoreLocal::get("paycard_id");
         if ($input == "") {
             // [enter] exits this screen
             // remember the mode, type and transid before we reset them
             CoreLocal::set("boxMsg", "");
             /**
               paycard_mode is sometimes cleared pre-emptively
               perhaps by a double keypress on enter so tender out
               if the last record in the transaction is a tender
               record 
             */
             $peek = PrehLib::peekItem(true);
             if ($mode == PaycardLib::PAYCARD_MODE_AUTH || $peek !== false && isset($peek['trans_type']) && $peek['trans_type'] == 'T') {
                 CoreLocal::set("strRemembered", "TO");
                 CoreLocal::set("msgrepeat", 1);
                 CoreLocal::set('paycardTendered', true);
             } else {
                 TransRecord::debugLog('Not Tendering Out (mode): ' . print_r($mode, true));
             }
             // only reset terminal if the terminal was used for the transaction
             // activating a gift card should not reset terminal
             if (CoreLocal::get("paycard_type") == PaycardLib::PAYCARD_TYPE_ENCRYPTED) {
                 UdpComm::udpSend('termReset');
                 CoreLocal::set('ccTermState', 'swipe');
                 CoreLocal::set("CacheCardType", "");
             }
             PaycardLib::paycard_reset();
             $this->change_page($this->page_url . "gui-modules/pos2.php");
             return false;
         } elseif ($mode == PaycardLib::PAYCARD_MODE_AUTH && $input == "VD" && (CoreLocal::get('CacheCardType') == 'CREDIT' || CoreLocal::get('CacheCardType') == 'EMV' || CoreLocal::get('CacheCardType') == 'GIFT' || CoreLocal::get('CacheCardType') == '')) {
             $plugin_info = new Paycards();
             $this->change_page($plugin_info->pluginUrl() . "/gui/PaycardEmvVoid.php");
             return false;
         }
     }
     /* shouldn't happen unless session glitches
        but getting here implies the transaction
        succeeded */
     $var = CoreLocal::get("boxMsg");
     if (empty($var)) {
         CoreLocal::set("boxMsg", "<b>Approved</b><font size=-1>\n                <p>&nbsp;\n                <p>[enter] to continue\n                <br>[void] " . _('to reverse the charge') . "\n                </font>");
     }
     return True;
 }
コード例 #12
0
ファイル: FirstData.php プロジェクト: phpsmith/IS4C
 function paycard_void($transID, $laneNo = -1, $transNo = -1, $json = array())
 {
     $this->voidTrans = "";
     $this->voidRef = "";
     // situation checking
     $enabled = PaycardDialogs::enabledCheck();
     if ($enabled !== true) {
         $json['output'] = $enabled;
         return $json;
     }
     // initialize
     $cashier = CoreLocal::get("CashierNo");
     $lane = CoreLocal::get("laneno");
     $trans = CoreLocal::get("transno");
     if ($laneNo != -1) {
         $lane = $laneNo;
     }
     if ($transNo != -1) {
         $trans = $transNo;
     }
     list($success, $request) = PaycardDialogs::getRequest(array($cashier, $lane, $trans), $transID);
     if ($success === false) {
         $json['output'] = $request;
         return $json;
     }
     list($success, $response) = PaycardDialogs::getResponse(array($cashier, $lane, $trans), $transID);
     if ($success === false) {
         $json['output'] = $response;
         return $json;
     }
     // look up any previous successful voids
     $eligible = PaycardDialogs::notVoided(array($cashier, $lane, $trans), $transID);
     if ($eligible === false) {
         $json['output'] = $eligible;
         return $json;
     }
     list($success, $lineitem) = PaycardDialogs::getTenderLine(array($cashier, $lane, $trans), $transID);
     if ($success === false) {
         $json['output'] = $lineitem;
         return $json;
     }
     $valid = PaycardDialogs::validateVoid($request, $response, $lineitem, $transID);
     if ($valid !== true) {
         $json['output'] = $valid;
         return $json;
     }
     // save the details
     CoreLocal::set("paycard_amount", ($request['mode'] == 'retail_alone_credit' ? -1 : 1) * $request['amount']);
     CoreLocal::set("paycard_id", $transID);
     CoreLocal::set("paycard_trans", $cashier . "-" . $lane . "-" . $trans);
     CoreLocal::set("paycard_type", PaycardLib::PAYCARD_TYPE_CREDIT);
     CoreLocal::set("paycard_mode", PaycardLib::PAYCARD_MODE_VOID);
     CoreLocal::set("paycard_name", $request['name']);
     // display FEC code box
     CoreLocal::set("inputMasked", 1);
     $plugin_info = new Paycards();
     $json['main_frame'] = $plugin_info->pluginUrl() . '/gui/paycardboxMsgVoid.php';
     return $json;
 }
コード例 #13
0
ファイル: MercuryE2E.php プロジェクト: phpsmith/IS4C
 public function lookupTransaction($ref, $local, $mode)
 {
     $ws_params = array('merchant' => CoreLocal::get('MercuryE2ETerminalID'), 'pw' => CoreLocal::get('MercuryE2EPassword'), 'invoice' => $ref);
     // emp_no 9999 => test transaction
     if (substr($ref, 4, 4) == "9999") {
         $ws_params['merchant'] = '395347308=E2ETKN';
         $ws_params['pw'] = '123E2ETKN';
     }
     $this->SOAPACTION = 'http://www.mercurypay.com/CTranDetail';
     $soaptext = $this->soapify('CTranDetail', $ws_params, 'http://www.mercurypay.com');
     $this->GATEWAY = 'https://' . self::PRIMARY_URL . '/ws/ws.asmx';
     $curl_result = $this->curlSend($soaptext, 'SOAP', false, array(), false);
     if ($curl_result['curlErr'] != CURLE_OK || $curl_result['curlHTTP'] != 200) {
         $this->GATEWAY = 'https://' . self::BACKUP_URL . '/ws/ws.asmx';
         $curl_result = $this->curlSend($soaptext, 'SOAP', false, array(), false);
         if ($curl_result['curlErr'] != CURLE_OK || $curl_result['curlHTTP'] != 200) {
             return array('output' => DisplayLib::boxMsg('No response from processor', '', true), 'confirm_dest' => MiscLib::base_url() . 'gui-modules/pos2.php', 'cancel_dest' => MiscLib::base_url() . 'gui-modules/pos2.php');
         }
     }
     $directions = 'Press [enter] or [clear] to continue';
     $resp = array('confirm_dest' => MiscLib::base_url() . 'gui-modules/pos2.php', 'cancel_dest' => MiscLib::base_url() . 'gui-modules/pos2.php');
     $info = new Paycards();
     $url_stem = $info->pluginUrl();
     $xml_resp = $this->desoapify('CTranDetailResponse', $curl_result['response']);
     $xml = new xmlData($xml_resp);
     $status = trim($xml->get_first('STATUS'));
     if ($status === '') {
         $status = 'NOTFOUND';
         $directions = 'Press [enter] to try again, [clear] to stop';
         $query_string = 'id=' . ($local ? '_l' : '') . $ref . '&mode=' . $mode;
         $resp['confirm_dest'] = $url_stem . '/gui/PaycardTransLookupPage.php?' . $query_string;
     } else {
         if ($local == 1 && $mode == 'verify') {
             // Update efsnetResponse record to contain
             // actual processor result and finish
             // the transaction correctly
             $responseCode = -3;
             $resultCode = 0;
             $normalized = 0;
             if ($status == 'Approved') {
                 $responseCode = 1;
                 $normalized = 1;
                 PaycardLib::paycard_wipe_pan();
                 $this->cleanup(array());
                 $resp['confirm_dest'] = $url_stem . '/gui/paycardSuccess.php';
                 $resp['cancel_dest'] = $url_stem . '/gui/paycardSuccess.php';
                 $directions = 'Press [enter] to continue';
             } else {
                 if ($status == 'Declined') {
                     PaycardLib::paycard_reset();
                     $responseCode = 2;
                     $normalized = 2;
                 } else {
                     if ($status == 'Error') {
                         PaycardLib::paycard_reset();
                         $responseCode = 0;
                         $resultCode = -1;
                         // CTranDetail does not provide this value
                         $normalized = 3;
                     } else {
                         // Unknown status; clear any data
                         PaycardLib::paycard_reset();
                     }
                 }
             }
             $apprNumber = $xml->get_first('authcode');
             $xTransID = $xml->get_first('reference');
             $rMsg = $status;
             if ($apprNumber) {
                 $rMsg .= ' ' . $apprNumber;
             }
             if (strlen($rMsg) > 100) {
                 $rMsg = substr($rMsg, 0, 100);
             }
             $db = Database::tDataConnect();
             $upP = $db->prepare("\n                UPDATE PaycardTransactions \n                SET xResponseCode=?,\n                    xResultCode=?,\n                    xResultMessage=?,\n                    xTransactionID=?,\n                    xApprovalNumber=?,\n                    commErr=0,\n                    httpCode=200,\n                    validResponse=?\n                WHERE refNum=?\n                    AND transID=?");
             $args = array($responseCode, $resultCode, $rMsg, $xTransID, $apprNumber, $normalized, $ref, CoreLocal::get('paycard_id'));
             $upR = $db->execute($upP, $args);
             $upP = $db->prepare("\n                UPDATE efsnetResponse SET\n                    xResponseCode=?,\n                    xResultCode=?, \n                    xResultMessage=?,\n                    xTransactionID=?,\n                    xApprovalNumber=?,\n                    commErr=0,\n                    httpCode=200\n                WHERE refNum=?\n                    AND transID=?");
             $args = array($responseCode, $resultCode, $rMsg, $xTransID, $apprNumber, $ref, CoreLocal::get('paycard_id'));
             if ($db->table_exists('efsnetResponse')) {
                 $upR = $db->execute($upP, $args);
             }
         }
     }
     switch (strtoupper($status)) {
         case 'APPROVED':
             $line1 = $status . ' ' . $xml->get_first('authcode');
             $line2 = 'Amount: ' . sprintf('%.2f', $xml->get_first('total'));
             $trans_type = $xml->get_first('trantype');
             $line3 = 'Type: ' . $trans_type;
             $voided = $xml->get_first('voided');
             $line4 = 'Voided: ' . ($voided == 'true' ? 'Yes' : 'No');
             $resp['output'] = DisplayLib::boxMsg($line1 . '<br />' . $line2 . '<br />' . $line3 . '<br />' . $line4 . '<br />' . $directions, '', true);
             break;
         case 'DECLINED':
             $resp['output'] = DisplayLib::boxMsg('The original transaction was declined
                                                   <br />' . $directions, '', true);
             break;
         case 'ERROR':
             $resp['output'] = DisplayLib::boxMsg('The original transaction resulted in an error
                                                   <br />' . $directions, '', true);
             break;
         case 'NOTFOUND':
             $resp['output'] = DisplayLib::boxMsg('Processor has no record of the transaction
                                                   <br />' . $directions, '', true);
             break;
     }
     return $resp;
 }