public function __construct(array $files) { parent::__construct([]); foreach ($files as $i => $file) { $this->content(\Html::script($file . '.js')); } }
function testTenderDbRecords() { lttLib::clear(); $t = new TenderModule('CA', 1.0); $t->add(); $record = lttLib::genericRecord(); $record['trans_type'] = 'T'; $record['trans_subtype'] = 'CA'; $record['description'] = 'Cash'; $record['total'] = -1.0; lttLib::verifyRecord(1, $record, $this); CoreLocal::set('currentid', 1); $v = new Void(); $this->assertEquals(true, $v->check('VD')); $json = $v->parse('VD'); $this->assertInternalType('array', $json); $record['total'] *= -1; $record['voided'] = 1; $record['trans_status'] = 'V'; lttLib::verifyRecord(2, $record, $this); }
public static function init() { // Obfuscated self::$PRIMITIVE_TYPES[self::OBFUSCATED_CLASS_REFIX . BOOLEAN_TYPE] = Boolean::typeClass(); self::$PRIMITIVE_TYPES[self::OBFUSCATED_CLASS_REFIX . BYTE_TYPE] = Byte::typeClass(); self::$PRIMITIVE_TYPES[self::OBFUSCATED_CLASS_REFIX . CHAR_TYPE] = Character::typeClass(); self::$PRIMITIVE_TYPES[self::OBFUSCATED_CLASS_REFIX . DOUBLE_TYPE] = Double::typeClass(); self::$PRIMITIVE_TYPES[self::OBFUSCATED_CLASS_REFIX . FLOAT_TYPE] = Float::typeClass(); self::$PRIMITIVE_TYPES[self::OBFUSCATED_CLASS_REFIX . INT_TYPE] = Integer::typeClass(); self::$PRIMITIVE_TYPES[self::OBFUSCATED_CLASS_REFIX . LONG_TYPE] = Long::typeClass(); self::$PRIMITIVE_TYPES[self::OBFUSCATED_CLASS_REFIX . SHORT_TYPE] = Short::typeClass(); self::$PRIMITIVE_TYPES[self::OBFUSCATED_CLASS_REFIX . VOID_TYPE] = Void::typeClass(); // Regular self::$PRIMITIVE_TYPES[Boolean::typeClass()->getName()] = Boolean::typeClass(); self::$PRIMITIVE_TYPES[Byte::typeClass()->getName()] = Byte::typeClass(); self::$PRIMITIVE_TYPES[Character::typeClass()->getName()] = Character::typeClass(); self::$PRIMITIVE_TYPES[Double::typeClass()->getName()] = Double::typeClass(); self::$PRIMITIVE_TYPES[Float::typeClass()->getName()] = Float::typeClass(); self::$PRIMITIVE_TYPES[Integer::typeClass()->getName()] = Integer::typeClass(); self::$PRIMITIVE_TYPES[Long::typeClass()->getName()] = Long::typeClass(); self::$PRIMITIVE_TYPES[Short::typeClass()->getName()] = Short::typeClass(); self::$PRIMITIVE_TYPES[Void::typeClass()->getName()] = Void::typeClass(); }
public function cleanup($json) { switch (CoreLocal::get("paycard_mode")) { case PaycardLib::PAYCARD_MODE_BALANCE: $resp = CoreLocal::get("paycard_response"); CoreLocal::set("boxMsg", "<b>Success</b><font size=-1>\n <p>Gift card balance: \$" . $resp["Balance"] . "\n <p>\"rp\" to print\n <br>[enter] to continue</font>"); break; case PaycardLib::PAYCARD_MODE_ADDVALUE: case PaycardLib::PAYCARD_MODE_ACTIVATE: CoreLocal::set("autoReprint", 1); $ttl = CoreLocal::get("paycard_amount"); PrehLib::deptkey($ttl * 100, 9020); $resp = CoreLocal::get("paycard_response"); CoreLocal::set("boxMsg", "<b>Success</b><font size=-1>\n <p>New card balance: \$" . $resp["Balance"] . "\n <p>[enter] to continue\n <br>\"rp\" to reprint slip</font>"); break; case PaycardLib::PAYCARD_MODE_AUTH: CoreLocal::set("autoReprint", 1); $record_id = $this->last_paycard_transaction_id; $charflag = $record_id != 0 ? 'PT' : ''; TransRecord::addFlaggedTender("Gift Card", "GD", $amt, $record_id, $charflag); $resp = CoreLocal::get("paycard_response"); CoreLocal::set("boxMsg", "<b>Approved</b><font size=-1>\n <p>Used: \$" . CoreLocal::get("paycard_amount") . "\n <br />New balance: \$" . $resp["Balance"] . "\n <p>[enter] to continue\n <br>\"rp\" to reprint slip\n <br>[void] to cancel and void</font>"); break; case PaycardLib::PAYCARD_MODE_VOID: case PaycardLib::PAYCARD_MODE_VOIDITEM: CoreLocal::set("autoReprint", 1); $v = new Void(); $v->voidid(CoreLocal::get("paycard_id"), array()); $resp = CoreLocal::get("paycard_response"); CoreLocal::set("boxMsg", "<b>Voided</b><font size=-1>\n <p>New balance: \$" . $resp["Balance"] . "\n <p>[enter] to continue\n <br>\"rp\" to reprint slip</font>"); break; } return $json; }
public function testScreenDisplay() { lttLib::clear(); $u = new UPC(); $u->check('666'); $u->parse('666'); $records = DisplayLib::screenDisplay(0, 1); $item = array('description' => 'EXTRA BAG', 'comment' => '', 'total' => 0.05, 'status' => 'T', 'lineColor' => '004080', 'discounttype' => 0, 'trans_type' => 'I', 'trans_status' => '', 'voided' => 0, 'trans_id' => 1); $spec = array(1 => $item); $this->assertEquals(count($records), count($spec)); $view = $this->getViewVersion(0, 2); foreach (array_keys($records) as $i) { $this->assertArrayHasKey($i, $records); $this->assertArrayHasKey($i, $spec); $this->compareArrays($records[$i], $spec[$i]); $this->compareArrays($records[$i], $view[$i]); } $t = new TenderModule('CA', 1.0); $t->add(); $tender = array('description' => '', 'comment' => 'Cash', 'total' => -1.0, 'status' => '', 'lineColor' => '800000', 'discounttype' => 0, 'trans_type' => 'T', 'trans_status' => '', 'voided' => 0, 'trans_id' => 2); $spec[2] = $tender; $records = DisplayLib::screenDisplay(0, 2); $view = $this->getViewVersion(0, 2); $this->assertEquals(count($records), count($spec)); foreach (array_keys($records) as $i) { $this->assertArrayHasKey($i, $records); $this->assertArrayHasKey($i, $spec); $this->compareArrays($records[$i], $spec[$i]); $this->compareArrays($records[$i], $view[$i]); } CoreLocal::set('memberID', 1); CoreLocal::set('isMember', 1); CoreLocal::set('percentDiscount', 10); CoreLocal::set('memType', 1); PrehLib::ttl(); $notify = array('description' => '** 10% Discount Applied **', 'comment' => '', 'total' => '', 'status' => '', 'lineColor' => '408080', 'discounttype' => 0, 'trans_type' => '0', 'trans_status' => 'D', 'voided' => 4, 'trans_id' => 3); $discount = array('description' => '', 'comment' => 'Discount', 'total' => 0.0, 'status' => '', 'lineColor' => '408080', 'discounttype' => 0, 'trans_type' => 'C', 'trans_status' => 'D', 'voided' => 5, 'trans_id' => 4); $subtotal = array('description' => 'Subtotal -0.95, Tax0.00 #1', 'comment' => 'Total ', 'total' => -0.95, 'status' => '', 'lineColor' => '000000', 'discounttype' => 0, 'trans_type' => 'C', 'trans_status' => 'D', 'voided' => 3, 'trans_id' => 5); $spec[3] = $notify; $spec[4] = $discount; $spec[5] = $subtotal; $records = DisplayLib::screenDisplay(0, 5); $view = $this->getViewVersion(0, 5); $this->assertEquals(count($records), count($spec)); foreach (array_keys($records) as $i) { $this->assertArrayHasKey($i, $records); $this->assertArrayHasKey($i, $spec); $this->compareArrays($records[$i], $spec[$i]); $this->compareArrays($records[$i], $view[$i]); } CoreLocal::set('quantity', 2); CoreLocal::set('multiple', 1); $u = new UPC(); $u->check('4627'); $u->parse('4627'); $item = array('description' => 'PKALE', 'comment' => '2 @ 1.99', 'total' => 3.98, 'status' => 'F', 'lineColor' => '408080', 'discounttype' => 1, 'trans_type' => 'I', 'trans_status' => '', 'voided' => 0, 'trans_id' => 6); $notice = array('description' => '** YOU SAVED $0.60 **', 'comment' => '', 'total' => '', 'status' => '', 'lineColor' => '408080', 'discounttype' => 0, 'trans_type' => 'I', 'trans_status' => 'D', 'voided' => 2, 'trans_id' => 7); $spec[6] = $item; $spec[7] = $notice; $records = DisplayLib::screenDisplay(0, 7); $view = $this->getViewVersion(0, 7); $this->assertEquals(count($records), count($spec)); foreach (array_keys($records) as $i) { $this->assertArrayHasKey($i, $records); $this->assertArrayHasKey($i, $spec); $this->compareArrays($records[$i], $spec[$i]); $this->compareArrays($records[$i], $view[$i]); } CoreLocal::set('quantity', 0); CoreLocal::set('multiple', 0); CoreLocal::set('currentid', 1); $v = new Void(); $v->check('VD'); $v->parse('VD'); $void = array('description' => 'EXTRA BAG', 'comment' => '', 'total' => -0.05, 'status' => 'VD', 'lineColor' => '800000', 'discounttype' => 0, 'trans_type' => 'I', 'trans_status' => 'V', 'voided' => 1, 'trans_id' => 8); $spec[8] = $void; $spec[1]['voided'] = 1; $records = DisplayLib::screenDisplay(0, 8); $view = $this->getViewVersion(0, 8); $this->assertEquals(count($records), count($spec)); foreach (array_keys($records) as $i) { $this->assertArrayHasKey($i, $records); $this->assertArrayHasKey($i, $spec); $this->compareArrays($records[$i], $spec[$i]); $this->compareArrays($records[$i], $view[$i]); } TransRecord::addFsTaxExempt(); $fs = array('description' => '', 'comment' => 'FS Tax Exempt', 'total' => 0.0, 'status' => '', 'lineColor' => '800000', 'discounttype' => 0, 'trans_type' => 'C', 'trans_status' => 'D', 'voided' => 17, 'trans_id' => 9); $spec[9] = $fs; $records = DisplayLib::screenDisplay(0, 9); $view = $this->getViewVersion(0, 9); $this->assertEquals(count($records), count($spec)); foreach (array_keys($records) as $i) { $this->assertArrayHasKey($i, $records); $this->assertArrayHasKey($i, $spec); $this->compareArrays($records[$i], $spec[$i]); $this->compareArrays($records[$i], $view[$i]); $this->compareArrays($spec[$i], $view[$i]); } CoreState::memberReset(); lttLib::clear(); }
public function cleanup($json) { switch (CoreLocal::get("paycard_mode")) { case PaycardLib::PAYCARD_MODE_AUTH: // cast to string. tender function expects string input // numeric input screws up parsing on negative values > $0.99 $amt = "" . -1 * CoreLocal::get("paycard_amount"); $t_type = 'CC'; if (CoreLocal::get('paycard_issuer') == 'American Express') { $t_type = 'AX'; } // if the transaction has a non-zero paycardTransactionID, // include it in the tender line $record_id = $this->last_paycard_transaction_id; $charflag = $record_id != 0 ? 'PT' : ''; TransRecord::addFlaggedTender("Credit Card", $t_type, $amt, $record_id, $charflag); CoreLocal::set("boxMsg", "<b>Approved</b>\n <font size=-1>\n <p>Please verify cardholder signature\n <p>[enter] to continue\n <br>\"rp\" to reprint slip\n <br>[void] " . _('to reverse the charge') . "\n </font>"); if (CoreLocal::get("paycard_amount") <= CoreLocal::get("CCSigLimit") && CoreLocal::get("paycard_amount") >= 0) { CoreLocal::set("boxMsg", "<b>Approved</b>\n <font size=-1>\n <p>No signature required\n <p>[enter] to continue\n <br>[void] " . _('to reverse the charge') . "\n </font>"); } else { if (CoreLocal::get('PaycardsSigCapture') != 1) { $json['receipt'] = 'ccSlip'; } } break; case PaycardLib::PAYCARD_MODE_VOID: $v = new Void(); $v->voidid(CoreLocal::get("paycard_id"), array()); CoreLocal::set("boxMsg", "<b>Voided</b>\n <p><font size=-1>[enter] to continue\n <br>\"rp\" to reprint slip</font>"); break; } return $json; }
private static function encodeResponse(Clazz $responseClass, $object, $wasThrown, $flags, $serializationPolicy) { $stream = new ServerSerializationStreamWriter($serializationPolicy); $stream->setFlags($flags); $stream->prepareToWrite(); if ($responseClass !== Void::typeClass()) { $stream->serializeValue($object, $responseClass); } $bufferStr = ($wasThrown ? '//EX' : '//OK') . (string) $stream; return $bufferStr; }
public function testRemoveAll() { $handler = new Void(); $handler->removeAll(); }
function testOpenRings() { lttLib::clear(); $d = new DeptKey(); $this->assertEquals(true, $d->check('100DP10')); $json = $d->parse('100DP10'); $this->assertInternalType('array', $json); $record = lttLib::genericRecord(); $record['upc'] = '1DP1'; $record['description'] = 'BBAKING'; $record['trans_type'] = 'D'; $record['department'] = 1; $record['quantity'] = 1; $record['foodstamp'] = 1; $record['unitPrice'] = 1.0; $record['total'] = 1.0; $record['regPrice'] = 1.0; $record['ItemQtty'] = 1; lttLib::verifyRecord(1, $record, $this); CoreLocal::set('currentid', 1); $v = new Void(); $this->assertEquals(true, $v->check('VD')); $json = $v->parse('VD'); $this->assertInternalType('array', $json); $record['total'] *= -1; $record['quantity'] *= -1; $record['ItemQtty'] *= -1; $record['voided'] = 1; $record['trans_status'] = 'V'; lttLib::verifyRecord(2, $record, $this); lttLib::clear(); CoreLocal::set('refund', 1); CoreLocal::set('refundComment', 'TEST REFUND'); $d = new DeptKey(); $this->assertEquals(true, $d->check('100DP10')); $json = $d->parse('100DP10'); $this->assertInternalType('array', $json); $record = lttLib::genericRecord(); $record['upc'] = '1DP1'; $record['description'] = 'BBAKING'; $record['trans_type'] = 'D'; $record['trans_status'] = 'R'; $record['department'] = 1; $record['quantity'] = -1; $record['foodstamp'] = 1; $record['unitPrice'] = 1.0; $record['total'] = -1.0; $record['regPrice'] = 1.0; $record['ItemQtty'] = 1; lttLib::verifyRecord(1, $record, $this); CoreLocal::set('currentid', 1); $v = new Void(); $this->assertEquals(true, $v->check('VD')); $json = $v->parse('VD'); $this->assertInternalType('array', $json); $record['total'] *= -1; $record['quantity'] *= -1; $record['ItemQtty'] *= -1; $record['voided'] = 1; $record['trans_status'] = 'V'; lttLib::verifyRecord(2, $record, $this); }
public function testWriteln() { $output = new Void(); $output->writeln('foobar'); }
public function cleanup($json) { switch (CoreLocal::get("paycard_mode")) { case PaycardLib::PAYCARD_MODE_ADDVALUE: case PaycardLib::PAYCARD_MODE_ACTIVATE: CoreLocal::set("autoReprint", 1); $ttl = CoreLocal::get("paycard_amount"); PrehLib::deptkey($ttl * 100, 9020); $bal = CoreLocal::get('GiftBalance'); CoreLocal::set("boxMsg", "<b>Success</b><font size=-1>\n <p>New card balance: \$" . $bal . "\n <p>[enter] to continue\n <br>\"rp\" to reprint slip</font>"); break; case PaycardLib::PAYCARD_MODE_BALANCE: $bal = CoreLocal::get('DatacapBalanceCheck'); CoreLocal::set("boxMsg", "<b>Success</b><font size=-1>\n <p>Card balance: \$" . $bal . "\n <p>\"rp\" to print\n <br>[enter] to continue</font>"); break; case PaycardLib::PAYCARD_MODE_AUTH: // cast to string. tender function expects string input // numeric input screws up parsing on negative values > $0.99 $amt = "" . -1 * CoreLocal::get("paycard_amount"); $type = CoreLocal::get("CacheCardType"); $t_type = 'CC'; if (CoreLocal::get('paycard_issuer') == 'American Express') { $t_type = 'AX'; } if ($type == 'EBTFOOD') { // extra tax exemption steps TransRecord::addfsTaxExempt(); CoreLocal::set("fntlflag", 0); Database::setglobalvalue("FntlFlag", 0); } list($tender_code, $tender_description) = PaycardLib::getTenderInfo($type, CoreLocal::get('paycard_issuer')); // if the transaction has a non-zero paycardTransactionID, // include it in the tender line $record_id = $this->last_paycard_transaction_id; $charflag = $record_id != 0 ? 'PT' : ''; TransRecord::addFlaggedTender($tender_description, $tender_code, $amt, $record_id, $charflag); $appr_type = 'Approved'; if (CoreLocal::get('paycard_partial')) { $appr_type = 'Partial Approval'; } elseif (CoreLocal::get('paycard_amount') == 0) { $appr_type = 'Declined'; $json['receipt'] = 'ccDecline'; } CoreLocal::set('paycard_partial', false); $isCredit = CoreLocal::get('CacheCardType') == 'CREDIT' || CoreLocal::get('CacheCardType') == '' ? true : false; $needSig = CoreLocal::get('paycard_amount') > CoreLocal::get('CCSigLimit') || CoreLocal::get('paycard_amount') < 0 ? true : false; if (($isCredit || CoreLocal::get('EmvSignature') === true) && $needSig) { CoreLocal::set("boxMsg", "<b>{$appr_type}</b>\n <font size=-1>\n <p>Please verify cardholder signature\n <p>[enter] to continue\n <br>\"rp\" to reprint slip\n <br>[void] " . _('to reverse the charge') . "\n </font>"); if (CoreLocal::get('PaycardsSigCapture') != 1) { $json['receipt'] = 'ccSlip'; } } else { CoreLocal::set("boxMsg", "<b>{$appr_type}</b>\n <font size=-1>\n <p>No signature required\n <p>[enter] to continue\n <br>[void] " . _('to reverse the charge') . "\n </font>"); } break; case PaycardLib::PAYCARD_MODE_VOID: $void = new Void(); $void->voidid(CoreLocal::get("paycard_id"), array()); // advanced ID to the void line CoreLocal::set('paycard_id', CoreLocal::get('paycard_id') + 1); CoreLocal::set("boxMsg", "<b>Voided</b>\n <p><font size=-1>[enter] to continue\n <br>\"rp\" to reprint slip</font>"); break; } return $json; }