public function entered($validate, $json) { $enabled = PaycardDialogs::enabledCheck(); if ($enabled !== true) { $json['output'] = $enabled; return $json; } $this->trans_pan['pan'] = CoreLocal::get("paycard_PAN"); // error checks based on processing mode switch (CoreLocal::get("paycard_mode")) { case PaycardLib::PAYCARD_MODE_VOID: // use the card number to find the trans_id $pan4 = substr($this->trans_pan['pan'], -4); $trans = array(CoreLocal::get('CashierNo'), CoreLocal::get('laneno'), CoreLocal::get('transno')); list($success, $result) = PaycardDialogs::voidableCheck($pan4, $trans); if ($success === true) { return $this->paycard_void($result, $trans[1], $trans[2], $json); } else { $json['output'] = $result; return $json; } break; case PaycardLib::PAYCARD_MODE_AUTH: if ($validate) { $valid = PaycardDialogs::validateCard($this->trans_pan['pan']); if ($valid !== true) { $json['output'] = $valid; return $json; } } return PaycardLib::setupAuthJson($json); break; } // switch mode // if we're still here, it's an error PaycardLib::paycard_reset(); $json['output'] = PaycardDialogs::invalidMode(); return $json; }
public function entered($validate, $json) { $enabled = PaycardDialogs::enabledCheck(); if ($enabled !== true) { $json['output'] = $enabled; return $json; } // error checks based on processing mode if (CoreLocal::get("paycard_mode") == PaycardLib::PAYCARD_MODE_VOID) { // use the card number to find the trans_id $pan4 = substr($this->getPAN(), -4); $trans = array(CoreLocal::get('CashierNo'), CoreLocal::get('laneno'), CoreLocal::get('transno')); list($success, $result) = PaycardDialogs::voidableCheck($pan4, $trans); if ($success === true) { return $this->paycard_void($result, -1, -1, $json); } else { $json['output'] = $result; return $json; } } // check card data for anything else if ($validate) { $valid = PaycardDialogs::validateCard(CoreLocal::get('paycard_PAN'), false); if ($valid !== true) { $json['output'] = $valid; return $json; } } // other modes switch (CoreLocal::get("paycard_mode")) { case PaycardLib::PAYCARD_MODE_AUTH: return PaycardLib::setupAuthJson($json); case PaycardLib::PAYCARD_MODE_ACTIVATE: case PaycardLib::PAYCARD_MODE_ADDVALUE: CoreLocal::set("paycard_amount", 0); CoreLocal::set("paycard_id", CoreLocal::get("LastID") + 1); // kind of a hack to anticipate it this way.. $plugin_info = new Paycards(); $json['main_frame'] = $plugin_info->pluginUrl() . '/gui/paycardboxMsgGift.php'; return $json; case PaycardLib::PAYCARD_MODE_BALANCE: $json['main_frame'] = $plugin_info->pluginUrl() . '/gui/paycardboxMsgBalance.php'; return $json; } // switch mode // if we're still here, it's an error $json['output'] = PaycardDialogs::invalidMode(); return $json; }
/** Updated for E2E Status: done */ public function entered($validate, $json) { $enabled = PaycardDialogs::enabledCheck(); if ($enabled !== true) { $json['output'] = $enabled; return $json; } // error checks based on processing mode switch (CoreLocal::get("paycard_mode")) { case PaycardLib::PAYCARD_MODE_VOID: // use the card number to find the trans_id $pan4 = substr($this->trans_pan['pan'], -4); $trans = array(CoreLocal::get('CashierNo'), CoreLocal::get('laneno'), CoreLocal::get('transno')); list($success, $result) = PaycardDialogs::voidableCheck($pan4, $trans); if ($success === true) { return $this->paycard_void($result, $trans[1], $trans[2], $json); } else { $json['output'] = $result; return $json; } break; case PaycardLib::PAYCARD_MODE_AUTH: // set initial variables //Database::getsubtotals(); $e2e = EncBlock::parseEncBlock(CoreLocal::get('paycard_PAN')); if (empty($e2e['Block']) || empty($e2e['Key'])) { PaycardLib::paycard_reset(); $json['output'] = PaycardLib::paycard_msgBox(PaycardLib::PAYCARD_TYPE_CREDIT, "Swipe Error", "Error reading card. Swipe again.", "[clear] to cancel"); UdpComm::udpSend('termReset'); return $json; } return PaycardLib::setupAuthJson($json); break; } // switch mode // if we're still here, it's an error PaycardLib::paycard_reset(); $json['output'] = PaycardDialogs::invalidMode(); return $json; }