Пример #1
0
 /**
   Input processing function
 */
 function preprocess()
 {
     // a selection was made
     if (FormLib::get('comment') !== '') {
         if (FormLib::get('cleared') === '1') {
             $this->change_page($this->page_url . "gui-modules/pos2.php");
             return False;
         }
         $comment = str_replace("\r", '', FormLib::get('comment'));
         // remove trailing newline from double enter
         $comment = substr($comment, 0, strlen($comment) - 1);
         $lines = explode("\n", $comment);
         foreach ($lines as $line) {
             $line = trim($line);
             if (strlen($line) == 0) {
                 continue;
             } elseif (strlen($line) <= 30) {
                 TransRecord::addcomment($line);
             } else {
                 $wrap = wordwrap($line, 30, "\n", True);
                 $shorter_lines = explode("\n", $wrap);
                 foreach ($shorter_lines as $short_line) {
                     TransRecord::addcomment($short_line);
                 }
             }
         }
         $this->change_page($this->page_url . "gui-modules/pos2.php");
         return False;
     }
     return True;
 }
Пример #2
0
 function preprocess()
 {
     if (isset($_REQUEST["selectlist"])) {
         $input = $_REQUEST["selectlist"];
         if ($input == "CL") {
             CoreLocal::set("msgrepeat", 0);
             CoreLocal::set("strRemembered", "");
             CoreLocal::set("refundComment", "");
         } else {
             if ($input == "Other") {
                 return True;
             } else {
                 $input = str_replace("'", "", $input);
                 CoreLocal::set("strRemembered", CoreLocal::get("refundComment"));
                 // add comment calls additem(), which wipes
                 // out refundComment; save it
                 TransRecord::addcomment("PO: " . $input);
                 CoreLocal::set("refundComment", CoreLocal::get("strRemembered"));
                 CoreLocal::set("msgrepeat", 1);
                 //CoreLocal::set("refund",1);
             }
         }
         $this->change_page($this->page_url . "gui-modules/pos2.php");
         return False;
     }
     return True;
 }
Пример #3
0
 public function apply()
 {
     if ($this->card_no === false) {
         return true;
     }
     if (!empty($this->message)) {
         TransRecord::addcomment('Tax Ex ID# ' . $this->message);
     }
     TransRecord::addTaxExempt();
     return true;
 }
Пример #4
0
 function parse($str)
 {
     $ret = $this->default_json();
     if (strlen($str) > 2) {
         $comment = substr($str, 2);
         TransRecord::addcomment($comment);
         $ret['output'] = DisplayLib::lastpage();
     } else {
         $ret['main_frame'] = MiscLib::base_url() . 'gui-modules/bigComment.php';
     }
     return $ret;
 }
Пример #5
0
 /**
   Apply action
   @return [boolean] true if the action
     completes successfully (or is not
     necessary at all) or [string] url
     to redirect to another page for
     further decisions/input.
 */
 public function apply()
 {
     // Is the before-tax total within range?
     if (CoreLocal::get("runningTotal") <= 4.0) {
         $totalBefore = CoreLocal::get("amtdue");
         $ret = Database::changeLttTaxCode("HST", "GST");
         if ($ret !== true) {
             TransRecord::addcomment("{$ret}");
         } else {
             Database::getsubtotals();
             $saved = $totalBefore - CoreLocal::get("amtdue");
             $comment = sprintf("OMTR OK. You saved: \$%.2f", $saved);
             TransRecord::addcomment("{$comment}");
         }
     } else {
         TransRecord::addcomment("Does NOT qualify for OMTR");
     }
     return true;
 }
Пример #6
0
 /**
   Total the transaction, which the cashier thinks may be eligible for the
      Ontario Meal Tax Rebate.
   @return
    True - total successfully
    String - URL
   If ttl() returns a string, go to that URL for
   more information on the error or to resolve the
   problem. 
   The most common error, by far, is no 
   member number in which case the return value
   is the member-entry page.
   The Ontario Meal Tax Rebate refunds the provincial part of the
   Harmonized Sales Tax if the total of the transaction is not more
   than a certain amount.
   If the transaction qualifies,
    change the tax status for each item at the higher rate to the lower rate.
    Display a message that a change was made.
   Otherwise display a message about that.
   Total the transaction as usual.
 */
 public static function omtr_ttl()
 {
     // Must have gotten member number before totaling.
     if (CoreLocal::get("memberID") == "0") {
         return MiscLib::base_url() . "gui-modules/memlist.php";
     } else {
         self::addRemoveDiscountViews();
         CoreLocal::set("ttlflag", 1);
         Database::setglobalvalue("TTLFlag", 1);
         // Refresh totals after staff and member discounts.
         Database::getsubtotals();
         // Is the before-tax total within range?
         if (CoreLocal::get("runningTotal") <= 4.0) {
             $totalBefore = CoreLocal::get("amtdue");
             $ret = Database::changeLttTaxCode("HST", "GST");
             if ($ret !== True) {
                 TransRecord::addcomment("{$ret}");
             } else {
                 Database::getsubtotals();
                 $saved = $totalBefore - CoreLocal::get("amtdue");
                 $comment = sprintf("OMTR OK. You saved: \$%.2f", $saved);
                 TransRecord::addcomment("{$comment}");
             }
         } else {
             TransRecord::addcomment("Does NOT qualify for OMTR");
         }
         /* If member can do Store Charge, warn on certain conditions.
          * Important preliminary is to refresh totals.
          */
         $temp = self::chargeOk();
         if (CoreLocal::get("balance") < CoreLocal::get("memChargeTotal") && CoreLocal::get("memChargeTotal") > 0) {
             if (CoreLocal::get('msgrepeat') == 0) {
                 CoreLocal::set("boxMsg", sprintf("<b>A/R Imbalance</b><br />\n                    Total AR payments \$%.2f exceeds AR balance %.2f<br />", CoreLocal::get("memChargeTotal"), CoreLocal::get("balance")));
                 CoreLocal::set('boxMsgButtons', array('Confirm [enter]' => '$(\'#reginput\').val(\'\');submitWrapper();', 'Cancel [clear]' => '$(\'#reginput\').val(\'CL\');submitWrapper();'));
                 CoreLocal::set("strEntered", "TL");
                 return MiscLib::base_url() . "gui-modules/boxMsg2.php?quiet=1";
             }
         }
         // Display discount.
         if (CoreLocal::get("percentDiscount") > 0) {
             TransRecord::addRecord(array('description' => CoreLocal::get('percentDiscount') . '% Discount', 'trans_type' => 'C', 'trans_status' => 'D', 'unitPrice' => MiscLib::truncate2(-1 * CoreLocal::get('transDiscount')), 'voided' => 5));
         }
         $amtDue = str_replace(",", "", CoreLocal::get("amtdue"));
         // Compose the member ID string for the description.
         if (CoreLocal::get("memberID") != CoreLocal::get("defaultNonMem")) {
             $memline = " #" . CoreLocal::get("memberID");
         } else {
             $memline = "";
         }
         // Put out the Subtotal line.
         $peek = self::peekItem();
         if (True || substr($peek, 0, 9) != "Subtotal ") {
             TransRecord::addRecord(array('description' => 'Subtotal ' . MiscLib::truncate2(CoreLocal::get('subtotal')) . ', Tax' . MiscLib::truncate2(CoreLocal::get('taxTotal')) . $memline, 'trans_type' => 'C', 'trans_status' => 'D', 'unitPrice' => $amtDue, 'voided' => 3));
         }
         if (CoreLocal::get("fntlflag") == 1) {
             TransRecord::addRecord(array('description' => 'Foodstamps Eligible', 'trans_type' => '0', 'trans_status' => 'D', 'unitPrice' => MiscLib::truncate2(CoreLocal::get('fsEligible')), 'voided' => 7));
         }
     }
     return True;
     // omtr_ttl
 }
Пример #7
0
 private function handleResponseAuth($authResult)
 {
     $xml = new xmlData($authResult['response']);
     $dbTrans = PaycardLib::paycard_db();
     // prepare some fields to store the parsed response; we'll add more as we verify it
     $today = date('Ymd');
     // numeric date only, it goes in an 'int' field as part of the primary key
     $now = date('Y-m-d H:i:s');
     // full timestamp
     $cashierNo = CoreLocal::get("CashierNo");
     $laneNo = CoreLocal::get("laneno");
     $transNo = CoreLocal::get("transno");
     $transID = CoreLocal::get("paycard_id");
     $cvv2 = CoreLocal::get("paycard_cvv2");
     $sqlColumns = $dbTrans->identifier_escape('date') . ",cashierNo,laneNo,transNo,transID," . $dbTrans->identifier_escape('datetime') . ",seconds,commErr,httpCode";
     $sqlValues = sprintf("%d,%d,%d,%d,%d,", $today, $cashierNo, $laneNo, $transNo, $transID) . sprintf("'%s',", $now) . sprintf("%f,%d,%d", $authResult['curlTime'], $authResult['curlErr'], $authResult['curlHTTP']);
     $validResponse = $xml->isValid() ? 1 : 0;
     $refNum = $xml->get("ORDER_ID");
     if ($refNum) {
         $sqlColumns .= ",refNum";
         $sqlValues .= sprintf(",'%s'", $refNum);
     }
     $responseCode = $xml->get("STATUS");
     if ($responseCode) {
         $sqlColumns .= ",xResponseCode";
         $sqlValues .= sprintf(",%d", $responseCode);
     } else {
         $validResponse = -3;
     }
     // aren't two separate codes from goemerchant
     $resultCode = $xml->get_first("STATUS");
     if ($resultCode) {
         $sqlColumns .= ",xResultCode";
         $sqlValues .= sprintf(",%d", $resultCode);
     }
     $resultMsg = $xml->get_first("AUTH_RESPONSE");
     $rMsg = $resultMsg;
     if ($resultMsg) {
         $sqlColumns .= ",xResultMessage";
         $rMsg = $resultMsg;
         if (strlen($rMsg) > 100) {
             $rMsg = substr($rMsg, 0, 100);
         }
         $sqlValues .= sprintf(",'%s'", $rMsg);
     }
     $xTransID = $xml->get("REFERENCE_NUMBER");
     if ($xTransID) {
         $sqlColumns .= ",xTransactionID";
         $sqlValues .= sprintf(",'%s'", $xTransID);
     } else {
         $validResponse = -3;
     }
     $apprNumber = $xml->get("AUTH_CODE");
     if ($apprNumber) {
         $sqlColumns .= ",xApprovalNumber";
         $sqlValues .= sprintf(",'%s'", $apprNumber);
     }
     // valid credit (return) transactions don't have an approval number
     $sqlColumns .= ",validResponse";
     $sqlValues .= sprintf(",%d", $validResponse);
     $table_def = $dbTrans->table_definition('efsnetResponse');
     if (isset($table_def['efsnetRequestID'])) {
         $sqlColumns .= ', efsnetRequestID';
         $sqlValues .= sprintf(', %d', $this->last_req_id);
     }
     $sql = "INSERT INTO efsnetResponse (" . $sqlColumns . ") VALUES (" . $sqlValues . ")";
     if ($dbTrans->table_exists('efsnetResponse')) {
         PaycardLib::paycard_db_query($sql, $dbTrans);
     }
     /**
       Log transaction in newer table
     */
     $normalized = $validResponse == 0 ? 4 : 0;
     if ($resultCode == 1) {
         $normalized = 1;
     } else {
         if ($resultCode == 2) {
             $normalized = 2;
         } else {
             if ($resultCode == 0) {
                 $normalized = 3;
             }
         }
     }
     $finishQ = sprintf("UPDATE PaycardTransactions\n                            SET responseDatetime='%s',\n                                seconds=%f,\n                                commErr=%d,\n                                httpCode=%d,\n                                validResponse=%d,\n                                xResultCode=%d,\n                                xApprovalNumber='%s',\n                                xResponseCode=%d,\n                                xResultMessage='%s',\n                                xTransactionID='%s'\n                            WHERE paycardTransactionID=%d", $now, $authResult['curlTime'], $authResult['curlErr'], $authResult['curlHTTP'], $normalized, $responseCode, $apprNumber, $resultCode, $rMsg, $xTransID, $this->last_paycard_transaction_id);
     $dbTrans->query($finishQ);
     if ($authResult['curlErr'] != CURLE_OK || $authResult['curlHTTP'] != 200) {
         TransRecord::addcomment("");
         if ($authResult['curlHTTP'] == '0') {
             CoreLocal::set("boxMsg", "No response from processor<br />\n                            The transaction did not go through");
             return PaycardLib::PAYCARD_ERR_PROC;
         }
         return $this->setErrorMsg(PaycardLib::PAYCARD_ERR_COMM);
     }
     switch ($xml->get("STATUS")) {
         case 1:
             // APPROVED
             return PaycardLib::PAYCARD_ERR_OK;
         case 2:
             // DECLINED
             CoreLocal::set("boxMsg", $resultMsg);
             TransRecord::addcomment("");
             break;
         case 0:
             // ERROR
             CoreLocal::set("boxMsg", "");
             $texts = $xml->get_first("ERROR");
             CoreLocal::set("boxMsg", "Error: {$texts}");
             TransRecord::addcomment("");
             break;
         default:
             TransRecord::addcomment("");
             CoreLocal::set("boxMsg", "An unknown error occurred<br />at the gateway");
     }
     return PaycardLib::PAYCARD_ERR_PROC;
 }
Пример #8
0
 function preprocess()
 {
     $this->box_color = "coloredArea";
     $this->msg = "Undo transaction";
     if (isset($_REQUEST['reginput'])) {
         $trans_num = strtoupper($_REQUEST['reginput']);
         // clear/cancel undo attempt
         if ($trans_num == "" || $trans_num == "CL") {
             $this->change_page($this->page_url . "gui-modules/pos2.php");
             return False;
         }
         // error: malformed transaction number
         if (!strpos($trans_num, "-")) {
             $this->box_color = "errorColoredArea";
             $this->msg = "Transaction not found";
             return True;
         }
         $temp = explode("-", $trans_num);
         // error: malformed transaction number (2)
         if (count($temp) != 3) {
             $this->box_color = "errorColoredArea";
             $this->msg = "Transaction not found";
             return True;
         }
         $emp_no = $temp[0];
         $register_no = $temp[1];
         $old_trans_no = $temp[2];
         // error: malformed transaction number (3)
         if (!is_numeric($emp_no) || !is_numeric($register_no) || !is_numeric($old_trans_no)) {
             $this->box_color = "errorColoredArea";
             $this->msg = "Transaction not found";
             return True;
         }
         $db = 0;
         $query = "";
         if ($register_no == CoreLocal::get("laneno")) {
             // look up transation locally
             $db = Database::tDataConnect();
             $query = "select upc, description, trans_type, trans_subtype,\n                    trans_status, department, quantity, scale, unitPrice,\n                    total, regPrice, tax, foodstamp, discount, memDiscount,\n                    discountable, discounttype, voided, PercentDiscount,\n                    ItemQtty, volDiscType, volume, VolSpecial, mixMatch,\n                    matched, card_no, trans_id\n                    from localtranstoday where register_no = {$register_no}\n                    and emp_no = {$emp_no} and trans_no = {$old_trans_no}\n                    and datetime >= " . $db->curdate() . "\n                    and trans_status <> 'X'\n                    order by trans_id";
         } else {
             if (CoreLocal::get("standalone") == 1) {
                 // error: remote lookups won't work in standalone
                 $this->box_color = "errorColoredArea";
                 $this->msg = "Transaction not found";
                 return True;
             } else {
                 // look up transaction remotely
                 $db = Database::mDataConnect();
                 $query = "select upc, description, trans_type, trans_subtype,\n                    trans_status, department, quantity, scale, unitPrice,\n                    total, regPrice, tax, foodstamp, discount, memDiscount,\n                    discountable, discounttype, voided, PercentDiscount,\n                    ItemQtty, volDiscType, volume, VolSpecial, mixMatch,\n                    matched, card_no, trans_id\n                    from dtransactions where register_no = {$register_no}\n                    and emp_no = {$emp_no} and trans_no = {$old_trans_no}\n                    and datetime >= " . $db->curdate() . "\n                    and trans_status <> 'X'\n                    order by trans_id";
             }
         }
         $result = $db->query($query);
         // transaction not found
         if ($db->num_rows($result) < 1) {
             $this->box_color = "errorColoredArea";
             $this->msg = "Transaction not found";
             return True;
         }
         /* change the cashier to the original transaction's cashier */
         $prevCashier = CoreLocal::get("CashierNo");
         CoreLocal::set("CashierNo", $emp_no);
         CoreLocal::set("transno", Database::gettransno($emp_no));
         /* rebuild the transaction, line by line, in reverse */
         $card_no = 0;
         TransRecord::addcomment("VOIDING TRANSACTION {$trans_num}");
         while ($row = $db->fetch_array($result)) {
             $card_no = $row["card_no"];
             if ($row["upc"] == "TAX") {
                 //TransRecord::addtax();
             } elseif ($row["trans_type"] == "T") {
                 if ($row["description"] == "Change") {
                     TransRecord::addchange(-1 * $row["total"]);
                 } elseif ($row["description"] == "FS Change") {
                     TransRecord::addfsones(-1 * $row["total"]);
                 } else {
                     TransRecord::addtender($row["description"], $row["trans_subtype"], -1 * $row["total"]);
                 }
             } elseif (strstr($row["description"], "** YOU SAVED")) {
                 $temp = explode("\$", $row["description"]);
                 TransRecord::adddiscount(substr($temp[1], 0, -3), $row["department"]);
             } elseif ($row["upc"] == "FS Tax Exempt") {
                 TransRecord::addfsTaxExempt();
             } elseif (strstr($row["description"], "% Discount Applied")) {
                 $temp = explode("%", $row["description"]);
                 TransRecord::discountnotify(substr($temp[0], 3));
             } elseif ($row["description"] == "** Order is Tax Exempt **") {
                 TransRecord::addTaxExempt();
             } elseif ($row["description"] == "** Tax Excemption Reversed **") {
                 TransRecord::reverseTaxExempt();
             } elseif ($row["description"] == " * Manufacturers Coupon") {
                 TransRecord::addCoupon($row["upc"], $row["department"], -1 * $row["total"]);
             } elseif (strstr($row["description"], "** Tare Weight")) {
                 $temp = explode(" ", $row["description"]);
                 TransRecord::addTare($temp[3] * 100);
             } elseif ($row["upc"] == "DISCOUNT") {
                 //TransRecord::addTransDiscount();
             } elseif ($row["trans_status"] != "M" && $row["upc"] != "0" && (is_numeric($row["upc"]) || strstr($row["upc"], "DP"))) {
                 $row["trans_status"] = "V";
                 $row["total"] *= -1;
                 $row["discount"] *= -1;
                 $row["memDiscount"] *= -1;
                 $row["quantity"] *= -1;
                 $row["ItemQtty"] *= -1;
                 TransRecord::addRecord($row);
             }
         }
         PrehLib::setMember($card_no, 1);
         CoreLocal::set("autoReprint", 0);
         /* do NOT restore logged in cashier until this transaction is complete */
         $this->change_page($this->page_url . "gui-modules/undo_confirm.php");
         return False;
     }
     return True;
 }
Пример #9
0
 function handleResponseAuth($authResult)
 {
     $inner_xml = $this->desoapify("SOAP-ENV:Body", $authResult['response']);
     $xml = new xmlData($inner_xml);
     $request = $this->last_request;
     $this->last_paycard_transaction_id = $request->last_paycard_transaction_id;
     $response = new PaycardResponse($request, $authResult);
     $dbTrans = PaycardLib::paycard_db();
     $cvv2 = CoreLocal::get("paycard_cvv2");
     $validResponse = $xml->isValid() ? 1 : 0;
     $statusMsg = $xml->get("fdggwsapi:TransactionResult");
     $responseCode = 4;
     switch (strtoupper($statusMsg)) {
         case 'APPROVED':
             $responseCode = 1;
             break;
         case 'DECLINED':
         case 'FRAUD':
             $responseCode = 2;
             break;
         case 'FAILED':
         case 'DUPLICATE':
             $responseCode = 0;
             break;
     }
     $response->setResponseCode($responseCode);
     // aren't two separate codes from goemerchant
     $resultCode = $responseCode;
     $response->setResultCode($resultCode);
     $resultMsg = $statusMsg;
     // already gathered above
     $response->setResultMsg($resultMsg);
     $xTransID = $xml->get("fdggwsapi:ProcessorReferenceNumber");
     $response->setTransactionID($xTransID);
     $apprNumber = $xml->get("fdggwsapi:ApprovalCode");
     $response->setApprovalNum($apprNumber);
     // valid credit transactions don't have an approval number
     $response->setValid(0);
     try {
         $response->saveResponse();
     } catch (Exception $ex) {
     }
     if ($authResult['curlErr'] != CURLE_OK || $authResult['curlHTTP'] != 200) {
         TransRecord::addcomment("");
         if ($authResult['curlHTTP'] == '0') {
             CoreLocal::set("boxMsg", "No response from processor<br />\n                            The transaction did not go through");
             return PaycardLib::PAYCARD_ERR_PROC;
         }
         return $this->setErrorMsg(PaycardLib::PAYCARD_ERR_COMM);
     }
     switch ($responseCode) {
         case 1:
             // APPROVED
             return PaycardLib::PAYCARD_ERR_OK;
         case 2:
             // DECLINED
             CoreLocal::set("boxMsg", 'Card Declined');
             break;
         case 0:
             // ERROR
             $texts = $xml->get_first("fdggwsapi:ProcessorResponseMessage");
             CoreLocal::set("boxMsg", "Error: {$texts}");
             break;
         default:
             CoreLocal::set("boxMsg", "An unknown error occurred<br />at the gateway");
     }
     return PaycardLib::PAYCARD_ERR_PROC;
 }
Пример #10
0
 /**
   Examine XML response from Datacap transaction,
   extract balance and/or error determine next step
   @return [int] PaycardLib error code
 */
 public function handleResponseDataCapBalance($xml)
 {
     $xml = new xmlData($xml);
     $validResponse = $xml->isValid() ? 1 : 0;
     $responseCode = $xml->get("CMDSTATUS");
     if ($responseCode) {
         $responseCode = $this->responseToNumber($responseCode);
     } else {
         $validResponse = -3;
     }
     $balance = $xml->get_first('BALANCE');
     switch (strtoupper($xml->get_first("CMDSTATUS"))) {
         case 'APPROVED':
             CoreLocal::set('DatacapBalanceCheck', $balance);
             return PaycardLib::PAYCARD_ERR_OK;
         case 'DECLINED':
             // intentional fallthrough
         // intentional fallthrough
         case 'ERROR':
             CoreLocal::set("boxMsg", "");
             $texts = $xml->get_first("TEXTRESPONSE");
             CoreLocal::set("boxMsg", "Error: {$texts}");
             TransRecord::addcomment("");
             break;
         default:
             CoreLocal::set("boxMsg", "An unknown error occurred<br />at the gateway");
             TransRecord::addcomment("");
     }
     return PaycardLib::PAYCARD_ERR_PROC;
 }
Пример #11
0
 public function testPrehLib()
 {
     if (!class_exists('lttLib')) {
         include 'lttLib.php';
     }
     lttLib::clear();
     TransRecord::addcomment('peek');
     $peek = PrehLib::peekItem();
     $this->assertEquals('peek', $peek);
     lttLib::clear();
     CoreLocal::set('percentDiscount', 5);
     CoreLocal::set('transDiscount', 0.51);
     CoreLocal::set('taxTotal', 1.45);
     CoreLocal::set('fsTaxExempt', 1.11);
     CoreLocal::set('amtdue', 9.550000000000001);
     // should add four records
     PrehLib::finalttl();
     // verify discount record
     $record = lttLib::genericRecord();
     $record['description'] = 'Discount';
     $record['trans_type'] = 'C';
     $record['trans_status'] = 'D';
     $record['unitPrice'] = -0.51;
     $record['voided'] = 5;
     lttLib::verifyRecord(1, $record, $this);
     // verify subtotal record
     $record = lttLib::genericRecord();
     $record['upc'] = 'Subtotal';
     $record['description'] = 'Subtotal';
     $record['trans_type'] = 'C';
     $record['trans_status'] = 'D';
     $record['unitPrice'] = 0.34;
     $record['voided'] = 11;
     lttLib::verifyRecord(2, $record, $this);
     // verify fs tax exempt record
     $record = lttLib::genericRecord();
     $record['upc'] = 'Tax';
     $record['description'] = 'FS Taxable';
     $record['trans_type'] = 'C';
     $record['trans_status'] = 'D';
     $record['unitPrice'] = 1.11;
     $record['voided'] = 7;
     lttLib::verifyRecord(3, $record, $this);
     // verify total record
     $record = lttLib::genericRecord();
     $record['upc'] = 'Total';
     $record['description'] = 'Total';
     $record['trans_type'] = 'C';
     $record['trans_status'] = 'D';
     $record['unitPrice'] = 9.550000000000001;
     $record['voided'] = 11;
     lttLib::verifyRecord(4, $record, $this);
     lttLib::clear();
     CoreLocal::set('cashierAge', 17);
     CoreLocal::set('cashierAgeOverride', 0);
     list($age_required, $json) = PrehLib::ageCheck(21, array());
     $this->assertEquals(true, $age_required);
     $this->assertInternalType('array', $json);
     CoreLocal::set('cashierAgeOverride', 1);
     list($age_required, $json) = PrehLib::ageCheck(21, array());
     $this->assertEquals(true, $age_required);
     $this->assertInternalType('array', $json);
     CoreLocal::set('memAge', date('Ymd', strtotime('21 years ago')));
     list($age_required, $json) = PrehLib::ageCheck(21, array());
     $this->assertEquals(false, $age_required);
     $this->assertInternalType('array', $json);
     CoreLocal::set('memAge', date('Ymd', strtotime('20 years ago')));
     list($age_required, $json) = PrehLib::ageCheck(21, array());
     $this->assertEquals(true, $age_required);
     $this->assertInternalType('array', $json);
 }
Пример #12
0
 static function requestInfoCallback($info)
 {
     TransRecord::addTaxExempt();
     TransRecord::addcomment("Tax Ex ID# " . $info);
     return True;
 }