Exemplo n.º 1
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") {
             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;
 }
Exemplo n.º 2
0
 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;
 }
Exemplo n.º 3
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;
 }