public function PostValidate() { $this->setAck($this->validateParams($this->getHeaders())); //first step is GEN if (!$this->checkDirection()) { return "Gen04"; } //HOW TO CHECK Gen05 // if (!$this->ValidateDB()) { // return "Gen07"; // } if (($timer_ack = Np_Timers::validate($this)) !== TRUE) { return $timer_ack; } $tbl = new Application_Model_DbTable_Requests(Np_Db::master()); $updateArray = array('last_transaction' => $this->getHeaderField("MSG_TYPE")); // if we received success return_response and we are not the initiator we need to publish it after (so leave it with status on) if ($this->getHeaderField("TO") == Application_Model_General::getSettings('InternalProvider')) { $updateArray['status'] = 0; } else { $updateArray['status'] = 1; } $whereArray = array('request_id =?' => $this->getHeaderField("REQUEST_ID")); if (!$tbl->update($updateArray, $whereArray)) { return false; } return true; }
public function PostValidate() { $this->setAck($this->validateParams($this->getHeaders())); //first step is GEN if (!$this->checkDirection()) { return "Gen04"; } //HOW TO CHECK Gen05 // if (!$this->ValidateDB()) { // return "Gen07"; // } if (($timer_ack = Np_Timers::validate($this)) !== TRUE) { return $timer_ack; } return true; }
/** * overridden from np_method * * @return mixed string Reject Reason Code or TRUE */ public function PostValidate() { $this->setAck($this->validateParams($this->getHeaders())); //HOW TO CHECK Gen05 if (!$this->ValidateDB()) { return "Gen07"; } $providers = Application_Model_General::getProviderArray(true); if (!in_array($this->getBodyField('DONOR'), $providers)) { return 'Pub05'; } if (($timer_ack = Np_Timers::validate($this)) !== TRUE) { return $timer_ack; } return true; }
/** * Method to validate request timers * * @param object $request Request Object * @return boolean true when the request timing is valid * string when request timing is not valid with the correct ack */ public static function validate($request) { //reset the failure for next validation self::$failure = FALSE; $ret = TRUE; $isTimeout = FALSE; //we're on check - no timers if (!isset($request->last_method_time) && !$request->last_method_time) { return TRUE; } $msg_type = strtolower($request->getHeaderField('MSG_TYPE')); self::$last_transaction = $request->last_method; self::$last_request_time = $request->last_method_time; self::$last_port_time = $request->last_transfer_time; self::$port_time = $request->getBodyField("PORT_TIME"); // current port time if (isset(self::$timerMethodArr[$msg_type])) { $timer = self::$timerMethodArr[$msg_type]; // Application_Model_Agg::insertInvalidProcessByTimer($timer, $request->getHeaderField('MSG_TYPE') , $waiting); if ($timer['time'] == "PORT") { $input_time = self::$last_port_time; } else { $input_time = self::$last_request_time; } if ($timer['lt']) { $isTimeout = self::isTimeout($timer['code'], $input_time); //true of false } else { $isTimeout = self::isTimeout($timer['code'], $input_time, null, FALSE); //true of false } } // the first timeout should return true or false (no further use for the timer code) if ($isTimeout === TRUE) { Application_Model_General::writeToTimersActivity($request->getHeaders(), self::$failure); if (self::isDebug()) { error_log("Timer is not valid: " . $ret); } return "Gen07"; } $method_name = $msg_type . "Timeout"; if (in_array($method_name, get_class_methods("Np_Timers"))) { self::$method_name(); if (self::$failure !== FALSE) { $ret = ucfirst(strtolower(self::$failure)); Application_Model_General::writeToTimersActivity($request->getHeaders(), $ret); if (self::isDebug()) { error_log("Timer is not valid: " . $ret); } return $ret; } } return $ret; }
/** * sets ack code in body field using validate params * post validation checks for general soap field errors * * @return mixed String or BOOL */ public function PostValidate() { $this->setAck($this->validateParams($this->getHeaders())); //first step is GEN if (!$this->checkDirection()) { return "Gen04"; } if (!$this->ValidateDB()) { return "Gen07"; } if (($timer_ack = Np_Timers::validate($this)) !== TRUE) { $timers_array = array('T2DR1', 'T2DR2', 'T3DR1', 'T3RK1', 'T3DR1U', 'T3RK1', 'T3RK2', 'T3DR1D', 'T3RK3', 'T3KR', 'T4DR0', 'T4DR1', 'T4DR11', 'T4DR2', 'T4DR3', 'T4RR1', 'T4RR11', 'T4OR1', 'T4OR11', 'T4RO1', 'TNP', 'TNP1', 'TNP2', 'TNP3', 'TNP4', 'TNPS', 'TNPB', 'T5BA2', 'T5BA3', 'T5AO1', 'T5OR1', 'T5001', 'T5002', 'T5003', 'TACK1', 'TACK2', 'TRES2', 'T5BA2', 'T5BA22', 'PNP1', 'PNP2', 'PNP3', 'PNP4', 'RACK3', 'N2DR4', 'PNP10', 'PNP4', 'RACK3'); if (in_array($timer_ack, $timers_array)) { Application_Model_General::writeToTimersActivity($this->getHeaders(), $timer_ack); } return $timer_ack; } return true; }
/** * If Request is sent before T2DR2 timer return FALSE * * @return BOOL */ protected function previousCheckExists() { $tbl = new Application_Model_DbTable_Requests(Np_Db::slave()); $select = $tbl->select()->order("id DESC")->where('phone_number=?', $this->params['PHONE_NUMBER'])->where('status=?', 1)->order('id DESC'); $result = $select->query()->fetchObject(); if ($result) { $last_request_time_diff = time() - strtotime($result->last_request_time); if (in_array($result->last_transaction, Application_Model_General::$inProcess) || $result->last_transaction == "Check_response" && $last_request_time_diff < Np_Timers::get("T2DR2")) { return true; } } return false; }