public function paycard_void($transID, $laneNo = -1, $transNo = -1, $json = array()) { // situation checking $enabled = PaycardDialogs::enabledCheck(); if ($enabled !== true) { $json['output'] = $enabled; return $json; } // initialize $cashier = CoreLocal::get("CashierNo"); $lane = CoreLocal::get("laneno"); $trans = CoreLocal::get("transno"); if ($laneNo != -1) { $lane = $laneNo; } if ($transNo != -1) { $trans = $transNo; } list($success, $request) = PaycardDialogs::getRequest(array($cashier, $lane, $trans), $transID); if ($success === false) { $json['output'] = $request; return $json; } list($success, $response) = PaycardDialogs::getResponse(array($cashier, $lane, $trans), $transID); if ($success === false) { $json['output'] = $response; return $json; } // look up any previous successful voids $eligible = PaycardDialogs::notVoided(array($cashier, $lane, $trans), $transID); if ($eligible === false) { $json['output'] = $eligible; return $json; } list($success, $lineitem) = PaycardDialogs::getTenderLine(array($cashier, $lane, $trans), $transID); if ($success === false) { $json['output'] = $lineitem; return $json; } $valid = PaycardDialogs::validateVoid($request, $response, $lineitem, $transID); if ($valid !== true) { $json['output'] = $valid; return $json; } // save the details CoreLocal::set("paycard_PAN", $request['PAN']); if ($request['mode'] == 'refund' || $request['mode'] == 'Return') { CoreLocal::set("paycard_amount", -$request['amount']); } else { CoreLocal::set("paycard_amount", $request['amount']); } CoreLocal::set("paycard_id", $transID); CoreLocal::set("paycard_type", PaycardLib::PAYCARD_TYPE_GIFT); if ($lineitem['trans_type'] == "T" && $lineitem['trans_subtype'] == "GD") { CoreLocal::set("paycard_mode", PaycardLib::PAYCARD_MODE_VOID); } else { CoreLocal::set("paycard_mode", PaycardLib::PAYCARD_MODE_VOIDITEM); } // display FEC code box $plugin_info = new Paycards(); $json['main_frame'] = $plugin_info->pluginUrl() . '/gui/paycardboxMsgVoid.php'; return $json; }
public function paycard_void($transID, $laneNo = -1, $transNo = -1, $json = array()) { $this->voidTrans = ""; $this->voidRef = ""; // situation checking $enabled = PaycardDialogs::enabledCheck(); if ($enabled !== true) { $json['output'] = $enabled; return $json; } // initialize $cashier = CoreLocal::get("CashierNo"); $lane = CoreLocal::get("laneno"); $trans = CoreLocal::get("transno"); if ($laneNo != -1) { $lane = $laneNo; } if ($transNo != -1) { $trans = $transNo; } list($success, $request) = PaycardDialogs::getRequest(array($cashier, $lane, $trans), $transID); if ($success === false) { $json['output'] = $request; return $json; } list($success, $response) = PaycardDialogs::getResponse(array($cashier, $lane, $trans), $transID); if ($success === false) { $json['output'] = $response; return $json; } // look up any previous successful voids $eligible = PaycardDialogs::notVoided(array($cashier, $lane, $trans), $transID); if ($eligible === false) { $json['output'] = $eligible; return $json; } // look up the transaction tender line-item list($success, $lineitem) = PaycardDialogs::getTenderLine(array($cashier, $lane, $trans), $transID); if ($success === false) { $json['output'] = $lineitem; return $json; } $valid = PaycardDialogs::validateVoid($request, $response, $lineitem, $transID); if ($valid !== true) { $json['output'] = $valid; return $json; } // save the details CoreLocal::set("paycard_amount", ($request['mode'] == 'retail_alone_credit' ? -1 : 1) * $request['amount']); CoreLocal::set("paycard_id", $transID); CoreLocal::set("paycard_trans", $cashier . "-" . $lane . "-" . $trans); CoreLocal::set("paycard_type", PaycardLib::PAYCARD_TYPE_CREDIT); CoreLocal::set("paycard_mode", PaycardLib::PAYCARD_MODE_VOID); CoreLocal::set("paycard_name", $request['name']); // display FEC code box CoreLocal::set("inputMasked", 1); $plugin_info = new Paycards(); $json['main_frame'] = $plugin_info->pluginUrl() . '/gui/paycardboxMsgVoid.php'; return $json; }