Ejemplo n.º 1
0
 public function preprocess()
 {
     $this->box_css_class = 'coloredArea';
     $this->msg = _('please enter your password');
     $this->body_class = '';
     if (isset($_REQUEST['reginput']) || isset($_REQUEST['userPassword'])) {
         $passwd = '';
         if (isset($_REQUEST['reginput']) && !empty($_REQUEST['reginput'])) {
             $passwd = $_REQUEST['reginput'];
             UdpComm::udpSend('goodBeep');
         } elseif (isset($_REQUEST['userPassword']) && !empty($_REQUEST['userPassword'])) {
             $passwd = $_REQUEST['userPassword'];
         }
         if (Authenticate::checkPassword($passwd)) {
             Database::testremote();
             $sd = MiscLib::scaleObject();
             if (is_object($sd)) {
                 $sd->ReadReset();
             }
             /**
               Find a drawer for the cashier
             */
             $my_drawer = ReceiptLib::currentDrawer();
             if ($my_drawer == 0) {
                 $available = ReceiptLib::availableDrawers();
                 if (count($available) > 0) {
                     ReceiptLib::assignDrawer(CoreLocal::get('CashierNo'), $available[0]);
                     $my_drawer = $available[0];
                 }
             } else {
                 ReceiptLib::assignDrawer(CoreLocal::get('CashierNo'), $my_drawer);
             }
             TransRecord::addLogRecord(array('upc' => 'SIGNIN', 'description' => 'Sign In Emp#' . CoreLocal::get('CashierNo')));
             /**
               Use Kicker object to determine whether the drawer should open
               The first line is just a failsafe in case the setting has not
               been configured.
             */
             if (session_id() != '') {
                 session_write_close();
             }
             $kicker_class = CoreLocal::get("kickerModule") == "" ? 'Kicker' : CoreLocal::get('kickerModule');
             $kicker_object = new $kicker_class();
             if ($kicker_object->kickOnSignIn()) {
                 ReceiptLib::drawerKick();
             }
             if ($my_drawer == 0) {
                 $this->change_page($this->page_url . "gui-modules/drawerPage.php");
             } else {
                 $this->change_page($this->page_url . "gui-modules/pos2.php");
             }
             return false;
         } else {
             $this->box_css_class = 'errorColoredArea';
             $this->msg = _('password invalid, please re-enter');
         }
     }
     return true;
 }
Ejemplo n.º 2
0
 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;
         } else {
             if ($input == "") {
                 if ($this->validate_amount()) {
                     $this->action = "onsubmit=\"return false;\"";
                     $this->add_onload_command("paycard_submitWrapper();");
                 }
             } else {
                 if ($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
     }
     // post?
     return True;
 }
Ejemplo n.º 3
0
 function preprocess()
 {
     $this->color = "coloredArea";
     $this->heading = _("enter password");
     $this->msg = _("confirm no sales");
     if (isset($_REQUEST['reginput']) || isset($_REQUEST['userPassword'])) {
         $passwd = '';
         if (isset($_REQUEST['reginput']) && !empty($_REQUEST['reginput'])) {
             $passwd = $_REQUEST['reginput'];
         } elseif (isset($_REQUEST['userPassword']) && !empty($_REQUEST['userPassword'])) {
             $passwd = $_REQUEST['userPassword'];
         }
         if (strtoupper($passwd) == "CL") {
             $this->change_page($this->page_url . "gui-modules/pos2.php");
             return False;
         } elseif (Authenticate::checkPassword($passwd)) {
             ReceiptLib::drawerKick();
             if (CoreLocal::get('LoudLogins') == 1) {
                 UdpComm::udpSend('twoPairs');
             }
             $this->change_page($this->page_url . "gui-modules/pos2.php");
             return false;
         } else {
             $this->color = "errorColoredArea";
             $this->heading = _("re-enter password");
             $this->msg = _("invalid password");
             if (CoreLocal::get('LoudLogins') == 1) {
                 UdpComm::udpSend('errorBeep');
             }
         }
     } else {
         // beep on initial page load
         if (CoreLocal::get('LoudLogins') == 1) {
             UdpComm::udpSend('twoPairs');
         }
     }
     return true;
 }
Ejemplo n.º 4
0
 function preprocess()
 {
     $this->color = "coloredArea";
     $this->img = $this->page_url . "graphics/key-icon.png";
     $this->msg = _("please enter password");
     if (isset($_REQUEST['reginput']) || isset($_REQUEST['scannerInput'])) {
         $passwd = '';
         if (isset($_REQUEST['reginput']) && !empty($_REQUEST['reginput'])) {
             $passwd = $_REQUEST['reginput'];
         } elseif (isset($_REQUEST['scannerInput']) && !empty($_REQUEST['scannerInput'])) {
             $passwd = $_REQUEST['scannerInput'];
             UdpComm::udpSend('goodBeep');
         }
         if (Authenticate::checkPassword($passwd, 4)) {
             $this->change_page($this->page_url . "gui-modules/pos2.php");
             return False;
         } else {
             $this->color = "errorColoredArea";
             $this->img = $this->page_url . "graphics/redkey4.gif";
             $this->msg = _("Password Invalid, Please Re-Enter");
         }
     }
     return True;
 }
Ejemplo n.º 5
0
 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;
 }
Ejemplo n.º 6
0
    /**
      Read input from scale
      @return None
    
      Outputs the javascript used to poll for scale
      input and activates it on page load.
    */
    protected function scanner_scale_polling($include_scans = true)
    {
        if (!$include_scans) {
            return '';
        }
        $scaleDriver = CoreLocal::get("scaleDriver");
        if ($scaleDriver == '' || !class_exists($scaleDriver)) {
            return '';
        }
        $scaleObj = new $scaleDriver();
        ?>
        <script type="text/javascript"
            src="<?php 
        echo $this->page_url;
        ?>
js/<?php 
        echo $scaleObj->javascriptFile();
        ?>
">
        </script>
        <script type="text/javascript"
            src="<?php 
        echo $this->page_url;
        ?>
js/sockjs.min.js">
        </script>
        <script type="text/javascript"
            src="<?php 
        echo $this->page_url;
        ?>
js/stomp.min.js">
        </script>
        <?php 
        if (CoreLocal::get('MQ')) {
            UdpComm::udpSend('mq_up');
            $this->add_onload_command("subscribeToQueue('" . $this->page_url . "');\n");
        } else {
            UdpComm::udpSend('mq_down');
            $this->add_onload_command("pollScale('" . $this->page_url . "');\n");
        }
    }
Ejemplo n.º 7
0
 function preprocess()
 {
     $this->bmp_path = $this->page_url . 'scale-drivers/drivers/NewMagellan/ss-output/tmp/';
     $terminal_msg = 'termSig';
     if (isset($_REQUEST['amt']) && isset($_REQUEST['type'])) {
         $terminal_msg .= $_REQUEST['type'] . sprintf(': $%.2f', $_REQUEST['amt']);
     } else {
         if (isset($_REQUEST['amt'])) {
             $terminal_msg .= sprintf('Amount: $.%2f', $_REQUEST['amt']);
         }
     }
     if (isset($_REQUEST['reginput'])) {
         if (strtoupper($_REQUEST['reginput']) == 'CL') {
             if (isset($_REQUEST['bmpfile']) && file_exists($_REQUEST['bmpfile'])) {
                 unlink($_REQUEST['bmpfile']);
             }
             $this->change_page($this->page_url . 'gui-modules/pos2.php');
             UdpComm::udpSend('termReset');
             return false;
         } else {
             if ($_REQUEST['reginput'] == '') {
                 if (isset($_REQUEST['bmpfile']) && file_exists($_REQUEST['bmpfile'])) {
                     // this should have been set already, but if we have sufficient info
                     // we can make sure it's correct.
                     if (isset($_REQUEST['amt']) && !empty($_REQUEST['amt']) && isset($_REQUEST['code']) && !empty($_REQUEST['code'])) {
                         CoreLocal::set('strRemembered', 100 * $_REQUEST['amt'] . $_REQUEST['code']);
                     }
                     CoreLocal::set('msgrepeat', 1);
                     $bmp = file_get_contents($_REQUEST['bmpfile']);
                     $format = 'BMP';
                     $img_content = $bmp;
                     /**
                       Idea: convert image to PNG if GD functions
                       are available. It would reduce storage size
                       but also make printing the image more complicated
                       since it would need to be converted *back* to
                       a bitmap. Undecided whether to use this.
                       Maybe reformatting happens server-side for
                       long term storage.
                     
                       Update: does not work with GD. That extension
                       does not understand bitmaps. Same idea may
                       work with a different library like ImageMagick.
                     if (function_exists('imagecreatefromstring')) {
                         $image = imagecreatefromstring($bmp);
                         if ($image !== false) {
                             ob_start();
                             $success = imagepng($image);
                             $png_content = ob_get_clean();
                             if ($success) {
                                 $format = 'PNG';
                                 $img_content = $png_content;
                             }
                         }
                     }
                     */
                     $dbc = Database::tDataConnect();
                     $capQ = 'INSERT INTO CapturedSignature
                             (tdate, emp_no, register_no, trans_no,
                              trans_id, filetype, filecontents)
                          VALUES
                             (?, ?, ?, ?,
                              ?, ?, ?)';
                     $capP = $dbc->prepare_statement($capQ);
                     Database::getsubtotals();
                     $args = array(date('Y-m-d H:i:s'), CoreLocal::get('CashierNo'), CoreLocal::get('laneno'), CoreLocal::get('transno'), CoreLocal::get('LastID') + 1, $format, $img_content);
                     $capR = $dbc->exec_statement($capP, $args);
                     unlink($_REQUEST['bmpfile']);
                     $this->change_page($this->page_url . 'gui-modules/pos2.php');
                     return false;
                 } else {
                     UdpComm::udpSend($terminal_msg);
                 }
             }
         }
     } else {
         UdpComm::udpSend($terminal_msg);
     }
     return true;
 }
Ejemplo n.º 8
0
 function paycard_entered($mode, $card, $manual, $type)
 {
     $ret = $this->default_json();
     // initialize
     $validate = true;
     // run Luhn's on PAN, check expiration date
     PaycardLib::paycard_reset();
     CoreLocal::set("paycard_mode", $mode);
     CoreLocal::set("paycard_manual", $manual ? 1 : 0);
     // error checks based on transaction
     if ($mode == PaycardLib::PAYCARD_MODE_AUTH) {
         if (CoreLocal::get("ttlflag") != 1) {
             // must subtotal before running card
             $ret['output'] = PaycardLib::paycard_msgBox($type, "No Total", "Transaction must be totaled before tendering or refunding", "[clear] to cancel");
             return $ret;
         } else {
             if (abs(CoreLocal::get("amtdue")) < 0.005) {
                 // can't tender for more than due
                 $ret['output'] = PaycardLib::paycard_msgBox($type, "No Total", "Nothing to tender or refund", "[clear] to cancel");
                 return $ret;
             }
         }
     }
     // check for pre-validation override
     if (strtoupper(substr($card, 0, 1)) == 'O') {
         $validate = false;
         $card = substr($card, 1);
     }
     // parse card data
     if (CoreLocal::get("paycard_manual")) {
         // make sure it's numeric
         if (!ctype_digit($card) || strlen($card) < 18) {
             // shortest known card # is 14 digits, plus MMYY
             $ret['output'] = PaycardLib::paycard_msgBox($type, "Manual Entry Unknown", "Please enter card data like:<br>CCCCCCCCCCCCCCCCMMYY", "[clear] to cancel");
             return $ret;
         }
         // split up input (and check for the Concord test card)
         if ($type == PaycardLib::PAYCARD_TYPE_UNKNOWN) {
             $type = PaycardLib::paycard_type($card);
         }
         if ($type == PaycardLib::PAYCARD_TYPE_GIFT) {
             CoreLocal::set("paycard_PAN", $card);
             // our gift cards have no expiration date or conf code
         } else {
             CoreLocal::set("paycard_PAN", substr($card, 0, -4));
             CoreLocal::set("paycard_exp", substr($card, -4, 4));
         }
     } else {
         if ($type == PaycardLib::PAYCARD_TYPE_ENCRYPTED) {
             // add leading zero back to fix hex encoding, if needed
             if (substr($card, 0, 7) == "2E60080") {
                 $card = "0" . $card;
             }
             CoreLocal::set("paycard_PAN", $card);
         } else {
             // swiped magstripe (reference to ISO format at end of this file)
             $stripe = PaycardLib::paycard_magstripe($card);
             if (!is_array($stripe)) {
                 $ret['output'] = PaycardLib::paycard_errBox($type, CoreLocal::get("paycard_manual") . "Card Data Invalid", "Please swipe again or type in manually", "[clear] to cancel");
                 return $ret;
             }
             CoreLocal::set("paycard_PAN", $stripe["pan"]);
             CoreLocal::set("paycard_exp", $stripe["exp"]);
             CoreLocal::set("paycard_name", $stripe["name"]);
             CoreLocal::set("paycard_tr1", $stripe["tr1"]);
             CoreLocal::set("paycard_tr2", $stripe["tr2"]);
             CoreLocal::set("paycard_tr3", $stripe["tr3"]);
         }
     }
     // manual/swiped
     // determine card issuer and type
     CoreLocal::set("paycard_type", PaycardLib::paycard_type(CoreLocal::get("paycard_PAN")));
     CoreLocal::set("paycard_issuer", PaycardLib::paycard_issuer(CoreLocal::get("paycard_PAN")));
     /* check card type. Credit is default. */
     $type = CoreLocal::get("CacheCardType");
     if ($type == '') {
         $type = 'CREDIT';
         CoreLocal::set("CacheCardType", "CREDIT");
     }
     /* assign amount due. EBT food should use eligible amount */
     CoreLocal::set("paycard_amount", CoreLocal::get("amtdue"));
     if ($type == 'EBTFOOD') {
         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");
                 return $ret;
             }
         }
         /**
           Always validate amount as non-zero
         */
         if (CoreLocal::get('fsEligible') <= 0.005 && CoreLocal::get('fsEligible') >= -0.005) {
             $ret['output'] = PaycardLib::paycard_msgBox($type, _('Zero Total'), "Foodstamp eligible amount is zero", "[clear] to cancel");
             UdpComm::udpSend('termReset');
             return $ret;
         }
         CoreLocal::set("paycard_amount", CoreLocal::get("fsEligible"));
     }
     if (($type == 'EBTCASH' || $type == 'DEBIT') && CoreLocal::get('CacheCardCashBack') > 0) {
         CoreLocal::set('paycard_amount', CoreLocal::get('amtdue') + CoreLocal::get('CacheCardCashBack'));
     }
     // if we knew the type coming in, make sure it agrees
     if ($type != PaycardLib::PAYCARD_TYPE_UNKNOWN && $type != CoreLocal::get("paycard_type")) {
         $ret['output'] = PaycardLib::paycard_msgBox($type, "Type Mismatch", "Card number does not match card type", "[clear] to cancel");
         return $ret;
     }
     foreach (CoreLocal::get("RegisteredPaycardClasses") as $rpc) {
         if (!class_exists($rpc)) {
             continue;
         }
         $myObj = new $rpc();
         if ($myObj->handlesType(CoreLocal::get("paycard_type"))) {
             return $myObj->entered($validate, $ret);
         }
     }
     $ret['output'] = PaycardLib::paycard_errBox(PaycardLib::PAYCARD_TYPE_UNKNOWN, "Unknown Card Type " . CoreLocal::get("paycard_type"), "", "[clear] to cancel");
     return $ret;
 }
Ejemplo n.º 9
0
 function WriteToScale($str)
 {
     switch (strtolower($str)) {
         case 'goodbeep':
             UdpComm::udpSend('goodBeep');
             break;
         case 'errorbeep':
             UdpComm::udpSend('errorBeep');
             break;
         case 'twopairs':
             UdpComm::udpSend('twoPairs');
             break;
         case 'repoll':
             UdpComm::udpSend('rePoll');
             break;
         case 'wakeup':
             UdpComm::udpSend('wakeup');
             break;
     }
 }
Ejemplo n.º 10
0
    function body_content()
    {
        $this->input_header();
        echo DisplayLib::printheaderb();
        $mode = FormLib::get('qty-mode', 0);
        $this->add_onload_command("formAdd('#formlocal','qty-mode','{$mode}');\n");
        $item = FormLib::get('entered-item', CoreLocal::get('strEntered'));
        $this->add_onload_command("formAdd('#formlocal','entered-item','{$item}');\n");
        ?>
        <div class="baseHeight">
        <div class="<?php 
        echo $this->box_color;
        ?>
 centeredDisplay">
        <span class="larger">
        <?php 
        echo $this->msg;
        ?>
        </span><br />
        <p>
        <?php 
        echo _("enter quantity or clear to cancel");
        ?>
        </p> 
        </div>
        </div>

        <?php 
        CoreLocal::set("msgrepeat", 2);
        CoreLocal::set("item", CoreLocal::get("strEntered"));
        UdpComm::udpSend('errorBeep');
        echo "<div id=\"footer\">";
        echo DisplayLib::printfooter();
        echo "</div>";
    }
Ejemplo n.º 11
0
 function body_content()
 {
     $this->input_header("onsubmit=\"return submitWrapper();\" action=\"" . $_SERVER['PHP_SELF'] . "\"");
     ?>
     <div class="baseHeight">
     <?php 
     // Signature Capture support
     // If:
     //   a) enabled
     //   b) a Credit transaction
     //   c) Over limit threshold OR a return
     $isCredit = CoreLocal::get('CacheCardType') == 'CREDIT' || CoreLocal::get('CacheCardType') == '' ? true : false;
     // gift doesn't set CacheCardType so customer swipes and
     // cashier types don't overwrite each other's type
     if (CoreLocal::get('paycard_type') == PaycardLib::PAYCARD_TYPE_GIFT) {
         $isCredit = false;
     }
     $needSig = CoreLocal::get('paycard_amount') > CoreLocal::get('CCSigLimit') || CoreLocal::get('paycard_amount') < 0 ? true : false;
     $isVoid = CoreLocal::get('paycard_mode') == PaycardLib::PAYCARD_MODE_VOID ? true : false;
     if (CoreLocal::get("PaycardsSigCapture") == 1 && $isCredit && $needSig && !$isVoid) {
         echo "<div id=\"boxMsg\" class=\"centeredDisplay\">";
         echo "<div class=\"boxMsgAlert coloredArea\">";
         echo "Waiting for signature";
         echo "</div>";
         echo "<div class=\"\">";
         echo "<div id=\"imgArea\"></div>";
         echo '<div class="textArea">';
         echo '$' . sprintf('%.2f', CoreLocal::get('paycard_amount')) . ' as CREDIT';
         echo '<br />';
         echo '<span id="sigInstructions" style="font-size:90%;">';
         echo '[enter] to get re-request signature, [void] ' . _('to reverse the charge');
         echo '<br />';
         if (isset($_REQUEST['reginput']) && ($_REQUEST['reginput'] == '' || $_REQUEST['reginput'] == 'CL')) {
             echo '<b>';
         }
         echo '[reprint] to quit &amp; use paper slip';
         if (isset($_REQUEST['reginput']) && ($_REQUEST['reginput'] == '' || $_REQUEST['reginput'] == 'CL')) {
             echo '</b>';
         }
         echo '</span>';
         echo "</div>";
         echo "</div>";
         // empty class
         echo "</div>";
         // #boxMsg
         UdpComm::udpSend('termSig');
         $this->add_onload_command("addToForm('doCapture', '1');\n");
     } else {
         echo DisplayLib::boxMsg(CoreLocal::get("boxMsg"), "", true);
         UdpComm::udpSend('termApproved');
     }
     CoreLocal::set("CachePanEncBlock", "");
     CoreLocal::set("CachePinEncBlock", "");
     ?>
     </div>
     <?php 
     echo "<div id=\"footer\">";
     Database::getsubtotals();
     // in case of partial approval shows remainder due
     echo DisplayLib::printfooter();
     echo "</div>";
     $rp_type = '';
     if (isset($_REQUEST['receipt']) && strlen($_REQUEST['receipt']) > 0) {
         $rp_type = $_REQUEST['receipt'];
         $this->add_onload_command("\$('#reginput').val('RP');\n");
         $this->add_onload_command("submitWrapper();\n");
     } elseif (CoreLocal::get("paycard_type") == PaycardLib::PAYCARD_TYPE_GIFT) {
         if (CoreLocal::get("paycard_mode") == PaycardLib::PAYCARD_MODE_BALANCE) {
             $rp_type = "gcBalSlip";
         } else {
             $rp_type = "gcSlip";
         }
     } elseif (CoreLocal::get("paycard_type") == PaycardLib::PAYCARD_TYPE_CREDIT) {
         $rp_type = "ccSlip";
     } elseif (CoreLocal::get("paycard_type") == PaycardLib::PAYCARD_TYPE_ENCRYPTED) {
         $rp_type = "ccSlip";
     }
     printf("<input type=\"hidden\" id=\"rp_type\" value=\"%s\" />", $rp_type);
 }
Ejemplo n.º 12
0
 function preprocess()
 {
     $this->box_color = "coloredArea";
     $this->msg = _("enter admin password");
     // get calling class (required)
     $class = isset($_REQUEST['class']) ? $_REQUEST['class'] : '';
     $pos_home = MiscLib::base_url() . 'gui-modules/pos2.php';
     if ($class === '' || !class_exists($class)) {
         $this->change_page($pos_home);
         return False;
     }
     // make sure calling class implements required
     // method and properties
     try {
         $method = new ReflectionMethod($class, 'adminLoginCallback');
         if (!$method->isStatic() || !$method->isPublic()) {
             throw new Exception('bad method adminLoginCallback');
         }
         $property = new ReflectionProperty($class, 'adminLoginMsg');
         if (!$property->isStatic() || !$property->isPublic()) {
             throw new Exception('bad property adminLoginMsg');
         }
         $property = new ReflectionProperty($class, 'adminLoginLevel');
         if (!$property->isStatic() || !$property->isPublic()) {
             throw new Exception('bad property adminLoginLevel');
         }
     } catch (Exception $e) {
         $this->change_page($pos_home);
         return False;
     }
     $this->heading = $class::$adminLoginMsg;
     if (isset($_REQUEST['reginput']) || isset($_REQUEST['userPassword'])) {
         $passwd = '';
         if (isset($_REQUEST['reginput']) && !empty($_REQUEST['reginput'])) {
             $passwd = $_REQUEST['reginput'];
         } else {
             if (isset($_REQUEST['userPassword']) && !empty($_REQUEST['userPassword'])) {
                 $passwd = $_REQUEST['userPassword'];
             }
         }
         if (strtoupper($passwd) == "CL") {
             $class::adminLoginCallback(False);
             $this->change_page($this->page_url . "gui-modules/pos2.php");
             return False;
         } else {
             if (empty($passwd)) {
                 $this->box_color = "errorColoredArea";
                 $this->msg = _("re-enter admin password");
             } else {
                 $db = Database::pDataConnect();
                 if (Authenticate::checkPermission($passwd, $class::$adminLoginLevel)) {
                     $row = Authenticate::getEmployeeByPassword($passwd);
                     TransRecord::add_log_record(array('upc' => $row['emp_no'], 'description' => substr($class::$adminLoginMsg . ' ' . $row['FirstName'], 0, 30), 'charflag' => 'PW', 'num_flag' => $row['emp_no']));
                     if (CoreLocal::get('LoudLogins') == 1) {
                         UdpComm::udpSend('twoPairs');
                     }
                     $result = $class::adminLoginCallback(True);
                     if ($result === True) {
                         $this->change_page(MiscLib::base_url() . 'gui-modules/pos2.php');
                     } else {
                         $this->change_page($result);
                     }
                     return False;
                 } else {
                     $this->box_color = "errorColoredArea";
                     $this->msg = _("re-enter admin password");
                     TransRecord::add_log_record(array('upc' => $passwd, 'description' => substr($class::$adminLoginMsg, 0, 30), 'charflag' => 'PW'));
                     if (CoreLocal::get('LoudLogins') == 1) {
                         UdpComm::udpSend('errorBeep');
                     }
                 }
             }
         }
     } else {
         // beep on initial page load
         if (CoreLocal::get('LoudLogins') == 1) {
             UdpComm::udpSend('twoPairs');
         }
     }
     return True;
 }
Ejemplo n.º 13
0
 function check($str)
 {
     if ($str == "TERMMANUAL") {
         UdpComm::udpSend("termManual");
         CoreLocal::set("paycard_keyed", true);
         return true;
     } else {
         if ($str == "TERMRESET" || $str == "TERMREBOOT") {
             if ($str == "TERMRESET") {
                 UdpComm::udpSend("termReset");
             } else {
                 UdpComm::udpSend("termReboot");
             }
             CoreLocal::set("paycard_keyed", false);
             CoreLocal::set("CachePanEncBlock", "");
             CoreLocal::set("CachePinEncBlock", "");
             CoreLocal::set("CacheCardType", "");
             CoreLocal::set("CacheCardCashBack", 0);
             CoreLocal::set('ccTermState', 'swipe');
             return true;
         } else {
             if ($str == "CCFROMCACHE") {
                 return true;
             } else {
                 if (substr($str, 0, 9) == "PANCACHE:") {
                     CoreLocal::set("CachePanEncBlock", substr($str, 9));
                     CoreLocal::set('ccTermState', 'type');
                     if (CoreLocal::get('PaycardsStateChange') == 'coordinated') {
                         if (CoreLocal::get('PaycardsAllowEBT') == 1) {
                             UdpComm::udpSend('termGetTypeWithFS');
                         } else {
                             UdpComm::udpSend('termGetType');
                         }
                     } else {
                         // check for out of order messages from terminal
                         if (CoreLocal::get('CacheCardType') != '' && CoreLocal::get('CacheCardType') == 'CREDIT') {
                             CoreLocal::set('ccTermState', 'ready');
                         } else {
                             if (CoreLocal::get('CacheCardType') != '' && CoreLocal::get('CachePinEncBlock') != '') {
                                 CoreLocal::set('ccTermState', 'ready');
                             }
                         }
                     }
                     return true;
                 } else {
                     if (substr($str, 0, 9) == "PINCACHE:") {
                         CoreLocal::set("CachePinEncBlock", substr($str, 9));
                         CoreLocal::set('ccTermState', 'ready');
                         if (CoreLocal::get('PaycardsStateChange') == 'coordinated') {
                             UdpComm::udpSend('termWait');
                         }
                         return true;
                     } else {
                         if (substr($str, 0, 6) == "VAUTH:") {
                             CoreLocal::set("paycard_voiceauthcode", substr($str, 6));
                             return true;
                         } else {
                             if (substr($str, 0, 8) == "EBTAUTH:") {
                                 CoreLocal::set("ebt_authcode", substr($str, 8));
                                 return true;
                             } else {
                                 if (substr($str, 0, 5) == "EBTV:") {
                                     CoreLocal::set("ebt_vnum", substr($str, 5));
                                     return true;
                                 } else {
                                     if ($str == "TERMCLEARALL") {
                                         CoreLocal::set("CachePanEncBlock", "");
                                         CoreLocal::set("CachePinEncBlock", "");
                                         CoreLocal::set("CacheCardType", "");
                                         CoreLocal::set("CacheCardCashBack", 0);
                                         CoreLocal::set('ccTermState', 'swipe');
                                         return true;
                                     } elseif ($str == 'TERMAUTOENABLE') {
                                         CoreLocal::set('PaycardsStateChange', 'direct');
                                         $query = "\n                UPDATE parameters\n                SET param_value='direct'\n                WHERE param_key='PaycardsStateChange'\n                    AND (lane_id=0 OR lane_id=?)";
                                         $db = Database::pDataConnect();
                                         $prep = $db->prepare($query);
                                         $res = $db->execute($prep, array(CoreLocal::get('laneno')));
                                         return true;
                                     } elseif ($str == 'TERMAUTODISABLE') {
                                         CoreLocal::set('PaycardsStateChange', 'coordinated');
                                         $query = "\n                UPDATE parameters\n                SET param_value='coordinated'\n                WHERE param_key='PaycardsStateChange'\n                    AND (lane_id=0 OR lane_id=?)";
                                         $db = Database::pDataConnect();
                                         $prep = $db->prepare($query);
                                         $res = $db->execute($prep, array(CoreLocal::get('laneno')));
                                         return true;
                                     } else {
                                         if (substr($str, 0, 5) == "TERM:") {
                                             CoreLocal::set("CacheCardType", substr($str, 5));
                                             switch (CoreLocal::get('CacheCardType')) {
                                                 case 'CREDIT':
                                                     CoreLocal::set('ccTermState', 'ready');
                                                     if (CoreLocal::get('PaycardsStateChange') == 'coordinated') {
                                                         UdpComm::udpSend('termWait');
                                                     }
                                                     break;
                                                 case 'DEBIT':
                                                     if (CoreLocal::get('PaycardsOfferCashBack') == 1) {
                                                         CoreLocal::set('ccTermState', 'cashback');
                                                         if (CoreLocal::get('PaycardsStateChange') == 'coordinated') {
                                                             if (CoreLocal::get('runningtotal') >= 0) {
                                                                 UdpComm::udpSend('termCashBack');
                                                             } else {
                                                                 // skip ahead to PIN entry on refunds
                                                                 CoreLocal::set('ccTermState', 'cashback');
                                                                 UdpComm::udpSend('termGetPin');
                                                             }
                                                         }
                                                     } elseif (CoreLocal::get('PaycardsOfferCashBack') == 2 && CoreLocal::get('isMember') == 1) {
                                                         CoreLocal::set('ccTermState', 'cashback');
                                                         if (CoreLocal::get('PaycardsStateChange') == 'coordinated') {
                                                             if (CoreLocal::get('runningtotal') >= 0) {
                                                                 UdpComm::udpSend('termCashBack');
                                                             } else {
                                                                 // skip ahead to PIN entry on refunds
                                                                 CoreLocal::set('ccTermState', 'cashback');
                                                                 UdpComm::udpSend('termGetPin');
                                                             }
                                                         }
                                                     } else {
                                                         CoreLocal::set('ccTermState', 'pin');
                                                         if (CoreLocal::get('PaycardsStateChange') == 'coordinated') {
                                                             UdpComm::udpSend('termGetPin');
                                                         }
                                                     }
                                                     break;
                                                 case 'EBTFOOD':
                                                     CoreLocal::set('ccTermState', 'pin');
                                                     if (CoreLocal::get('PaycardsStateChange') == 'coordinated') {
                                                         UdpComm::udpSend('termGetPin');
                                                     }
                                                     break;
                                                 case 'EBTCASH':
                                                     if (CoreLocal::get('PaycardsOfferCashBack') == 1) {
                                                         CoreLocal::set('ccTermState', 'cashback');
                                                         if (CoreLocal::get('PaycardsStateChange') == 'coordinated') {
                                                             if (CoreLocal::get('runningtotal') >= 0) {
                                                                 UdpComm::udpSend('termCashBack');
                                                             } else {
                                                                 // skip ahead to PIN entry on refunds
                                                                 CoreLocal::set('ccTermState', 'cashback');
                                                                 UdpComm::udpSend('termGetPin');
                                                             }
                                                         }
                                                     } else {
                                                         CoreLocal::set('ccTermState', 'pin');
                                                         if (CoreLocal::get('PaycardsStateChange') == 'coordinated') {
                                                             UdpComm::udpSend('termGetPin');
                                                         }
                                                     }
                                                     break;
                                             }
                                             if (CoreLocal::get('PaycardsStateChange') == 'direct') {
                                                 // check for out of order messages from terminal
                                                 if (CoreLocal::get('CacheCardType') != '' && CoreLocal::get('CachePanEncBlock') != '' && CoreLocal::get('CachePinEncBlock') != '') {
                                                     CoreLocal::set('ccTermState', 'ready');
                                                 }
                                             }
                                             return true;
                                         } elseif (substr($str, 0, 7) == "TERMCB:") {
                                             $cashback = substr($str, 7);
                                             $termLimit = CoreLocal::get('PaycardsTermCashBackLimit');
                                             if ($termLimit === '') {
                                                 $termLimit = 40;
                                             }
                                             if ($cashback <= $termLimit) {
                                                 $this->cb_error = false;
                                                 CoreLocal::set("CacheCardCashBack", $cashback);
                                             } else {
                                                 $this->cb_error = true;
                                             }
                                             CoreLocal::set('ccTermState', 'pin');
                                             if (CoreLocal::get('PaycardsStateChange') == 'coordinated') {
                                                 UdpComm::udpSend('termGetPin');
                                             }
                                             return true;
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return false;
 }
Ejemplo n.º 14
0
 function cancelorder()
 {
     CoreLocal::set("plainmsg", _("transaction cancelled"));
     UdpComm::udpSend("rePoll");
 }
Ejemplo n.º 15
0
 /**
   Examine XML response from Datacap transaction,
   log results, determine next step
   @return [int] PaycardLib error code
 */
 public function handleResponseDataCap($xml)
 {
     $rawXml = $xml;
     $ref = $this->refnum(CoreLocal::get('paycard_id'));
     if (CoreLocal::get('LastEmvReqType') == 'void') {
         $request = new PaycardVoidRequest($ref);
     } elseif (CoreLocal::get('LastEmvReqType') == 'gift') {
         $request = new PaycardGiftRequest($ref);
     } else {
         $request = new PaycardRequest($ref);
     }
     $id_set = CoreLocal::get('LastEmvPcId');
     $request->last_paycard_transaction_id = $id_set[0];
     $request->last_req_id = $id_set[1];
     $this->last_paycard_transaction_id = $request->last_paycard_transaction_id;
     $response = new PaycardResponse($request, array('curlTime' => 0, 'curlErr' => 0, 'curlHTTP' => 200));
     $xml = new BetterXmlData($xml);
     $validResponse = 1;
     $responseCode = $xml->query('/RStream/CmdResponse/CmdStatus');
     $resultMsg = $responseCode;
     if ($responseCode) {
         $responseCode = $this->responseToNumber($responseCode);
     } else {
         $validResponse = -3;
     }
     $response->setResponseCode($responseCode);
     $resultCode = $xml->query('/RStream/CmdResponse/DSIXReturnCode');
     $response->setResultCode($resultCode);
     $apprNumber = $xml->query('/RStream/TranResponse/AuthCode');
     $response->setApprovalNum($apprNumber);
     $rMsg = $resultMsg;
     if ($resultMsg) {
         $rMsg = $resultMsg;
         if ($responseCode == 1) {
             // approved
             if ($apprNumber) {
                 $rMsg .= ' ' . $apprNumber;
             }
         } else {
             $processor_text = $xml->query('/RStream/CmdResponse/TextResponse');
             if ($processor_text) {
                 $rMsg = $processor_text;
             }
         }
     }
     $response->setResultMsg($rMsg);
     $xTransID = $xml->query('/RStream/TranResponse/RefNo');
     $response->setTransactionID($xTransID);
     if ($xTransID === false) {
         $validResponse = -3;
     }
     $issuer = $xml->query('/RStream/TranResponse/CardType');
     $resp_balance = $xml->query('/RStream/TranResponse/Balance');
     $ebtbalance = 0;
     if ($issuer == 'Foodstamp' && $resp_balance !== false) {
         $issuer = 'EBT';
         CoreLocal::set('EbtFsBalance', $resp_balance);
         $ebtbalance = $resp_balance;
     } elseif ($issuer == 'Cash' && $resp_balance !== false) {
         $issuer = 'EBT';
         CoreLocal::set('EbtCaBalance', $resp_balance);
         $ebtbalance = $resp_balance;
     } elseif ($xml->query('/RStream/TranResponse/TranType') == 'PrePaid' && $resp_balance !== false) {
         $issuer = 'NCG';
         $ebtbalance = $resp_balance;
         CoreLocal::set('GiftBalance', $resp_balance);
     }
     $response->setBalance($ebtbalance);
     $dbc = Database::tDataConnect();
     $tran_code = $xml->query('/RStream/TranResponse/TranCode');
     if (substr($tran_code, 0, 3) == 'EMV' && strpos($rawXml, 'x____') !== false) {
         CoreLocal::set('EmvSignature', true);
     } else {
         CoreLocal::set('EmvSignature', false);
     }
     if (substr($tran_code, 0, 3) == 'EMV') {
         $printData = $xml->query('/RStream/PrintData/*', false);
         if (strlen($printData) > 0) {
             $receiptID = $transID;
             if (CoreLocal::get('paycard_mode') == PaycardLib::PAYCARD_MODE_VOID) {
                 $receiptID++;
             }
             $printP = $dbc->prepare('
                 INSERT INTO EmvReceipt
                     (dateID, tdate, empNo, registerNo, transNo, transID, content)
                 VALUES 
                     (?, ?, ?, ?, ?, ?, ?)');
             $dbc->execute($printP, array(date('Ymd'), date('Y-m-d H:i:s'), $cashierNo, $laneNo, $transNo, $receiptID, $printData));
         }
     }
     // put normalized value in validResponse column
     $normalized = $validResponse == 0 ? 4 : 0;
     if ($responseCode == 1) {
         $normalized = 1;
     } else {
         if ($responseCode == 2) {
             $normalized = 2;
         } else {
             if ($responseCode == 0) {
                 $normalized = 3;
             }
         }
     }
     $response->setNormalizedCode($normalized);
     $response->setToken($xml->query('/RStream/TranResponse/RecordNo'), $xml->query('/RStream/TranResponse/ProcessData'), $xml->query('/RStream/TranResponse/AcqRefData'));
     try {
         $response->saveResponse();
     } catch (Exception $ex) {
         echo $ex->getMessage() . "\n";
     }
     /** handle partial auth **/
     if ($responseCode == 1) {
         $amt = $xml->query('/RStream/TranResponse/Amount/Authorize');
         if ($amt != abs(CoreLocal::get("paycard_amount"))) {
             $request->changeAmount($amt);
             CoreLocal::set("paycard_amount", $amt);
             CoreLocal::set("paycard_partial", True);
             UdpComm::udpSend('goodBeep');
         }
     }
     $pan = $xml->query('/RStream/TranResponse/AcctNo');
     $resp_name = $xml->query('/RStream/TranResponse/CardholderName');
     $name = $resp_name ? $resp_name : 'Cardholder';
     $issuer = $xml->query('/RStream/TranResponse/CardType');
     $request->updateCardInfo($pan, $name, $issuer);
     switch (strtoupper($xml->query('/RStream/CmdResponse/CmdStatus'))) {
         case 'APPROVED':
             return PaycardLib::PAYCARD_ERR_OK;
         case 'DECLINED':
             if ($issuer == 'EBT') {
                 // if EBT is declined but lists a balance less than the
                 // requested authorization, it may be possible to
                 // charge the card for a less amount.
                 TransRecord::addcomment("");
                 CoreLocal::set('boxMsg', sprintf('Card Balance: $%.2f', $ebtbalance));
             } elseif (substr($tran_code, 0, 3) == 'EMV') {
                 CoreLocal::set('paycard_amount', 0);
                 return PaycardLib::PAYCARD_ERR_OK;
             }
             UdpComm::udpSend('termReset');
             CoreLocal::set('ccTermState', 'swipe');
             // intentional fallthrough
         // intentional fallthrough
         case 'ERROR':
             CoreLocal::set("boxMsg", "");
             $texts = $xml->query('/RStream/CmdResponse/TextResponse');
             CoreLocal::set("boxMsg", "Error: {$texts}");
             $dsix = $xml->query('/RStream/CmdResponse/DSIXReturnCode');
             if ($dsix == '001007' || $dsix == '003007' || $dsix == '003010') {
                 /* These error codes indicate a potential connectivity
                  * error mid-transaction. Do not add a comment record to
                  * the transaction to avoid incrementing InvoiceNo
                  */
             } else {
                 TransRecord::addcomment("");
             }
             break;
         default:
             CoreLocal::set("boxMsg", "An unknown error occurred<br />at the gateway");
             TransRecord::addcomment("");
     }
     return PaycardLib::PAYCARD_ERR_PROC;
 }
Ejemplo n.º 16
0
 if ($receiptType != "none") {
     $receiptContent[] = ReceiptLib::printReceipt($receiptType, $receiptNum, false, $doEmail);
 }
 if ($receiptType == "ccSlip" || $receiptType == 'gcSlip') {
     // don't mess with reprints
 } elseif (CoreLocal::get("autoReprint") == 1) {
     CoreLocal::set("autoReprint", 0);
     $receiptContent[] = ReceiptLib::printReceipt($receiptType, $receiptNum, true);
 }
 // use same email class for sending the receipt
 // as was used to generate the receipt
 $email_class = ReceiptLib::emailReceiptMod();
 if ($transFinished) {
     CoreLocal::set("End", 0);
     $output = $yesSync;
     UdpComm::udpSend("termReset");
     $sd = MiscLib::scaleObject();
     if (is_object($sd)) {
         $sd->ReadReset();
     }
     CoreLocal::set('ccTermState', 'swipe');
     uploadAndReset($receiptType);
 }
 // close session so if printer hangs
 // this script won't lock the session file
 if (session_id() != '') {
     session_write_close();
 }
 if ($receiptType == "full" && $dokick) {
     ReceiptLib::drawerKick();
 }
Ejemplo n.º 17
0
 public function testUdpComm()
 {
     UdpComm::udpSend('most likely no one is listening...');
 }