public function indexAction()
 {
     $cnpj = "31804115000243";
     $request = new Application_Model_Request();
     $request->getDataSintegraByCnpj($cnpj);
     return;
 }
Ejemplo n.º 2
0
 /**
  * Provider Action - "http://SERVER/internal/Provider"   
  * gets params from Internal Model in GET and Sends to Provider
  * 
  */
 public function providerAction()
 {
     $params = Application_Model_General::getParamsArray($this->getRequest()->getParams());
     if (isset($params['SLEEP'])) {
         sleep((int) $params['SLEEP']);
     }
     if (isset($params['REQID'])) {
         $params['REQUEST_ID'] = $params['REQID'];
     }
     $reqModel = new Application_Model_Request($params);
     $reqModel->ExecuteFromInternal();
 }
Ejemplo n.º 3
0
 /**
  * internal Action - "http://SERVER/Provider/internal"
  * 
  * Gets params from GET and puts them in a new Request Model Object .
  * then calls executeRequest() to send the message to internal. 
  * 
  * @package		ApplicationController      
  * @subpackage	ProviderController
  */
 public function internalAction()
 {
     $params = Application_Model_General::getParamsArray($this->getRequest()->getParams());
     if (isset($params['SLEEP'])) {
         sleep((int) $params['SLEEP']);
     }
     if (isset($params['NUMBER'])) {
         $params['PHONE_NUMBER'] = $params['NUMBER'];
     }
     //		error_log(print_R($params, 1));
     $reqModel = new Application_Model_Request($params);
     $manual = isset($params['MANUAL']) && $params['MANUAL'];
     $reqModel->ExecuteRequest($manual);
 }
Ejemplo n.º 4
0
 /**
  * sendMessage method defined by NP wsdl
  * called by external providers to send transaction messages to internal
  * the call to internal will be forward by forking
  * 
  * @param		Array $params
  * @return		array "NP_ACK" or string
  */
 public function sendMessage($params)
 {
     Application_Model_General::virtualSleep();
     $reqModel = new Application_Model_Request($params);
     //prepares data for sending internal the message
     $ack = $reqModel->Execute();
     // log all received calls if request log enabled
     if (Application_Model_General::getSettings('EnableRequestLog')) {
         Application_Model_General::logRequestResponse($params, $ack, $reqModel->getRequest()->getHeaderField('REQUEST_ID'), '[Input] ');
     }
     if ($ack === FALSE || strpos(strtolower($ack), "ack") === FALSE) {
         $ack = "Ack00";
     }
     return array('NP_ACK' => array('ACK_CODE' => $ack, 'ACK_DATE' => Application_Model_General::getDateTimeIso()));
 }
Ejemplo n.º 5
0
 public function requestReceivedAction()
 {
     $usersNs = new Zend_Session_Namespace("members");
     $userId = $usersNs->userId;
     /*--search---*/
     $search = trim($this->_getParam('search'));
     $where = "d.department_head_id='{$userId}' and d.type='operations'";
     $this->view->linkArray = array();
     $this->view->search = "Search...";
     if ($search != "" && $search != "Search...") {
         $where = "d.department_head_id='{$userId}' and d.type='operations' and (request like '%{$search}%' or d.title like '%{$search}%' or u.email like '%{$search}%' or u.last_name like '%{$search}%' or u.first_name like '%{$search}%' or r.status like '%{$search}%') ";
         $this->view->linkArray = array('search' => $search);
         $this->view->search = $search;
     }
     $this->view->page_size = $page_size = $this->_getParam('page_size', 25);
     $page = $this->_getParam('page', 1);
     $model = new Application_Model_Request();
     $table = $model->getMapper()->getDbTable();
     //print_r($table->info());
     //$select = $table->select()->order('addedon DESC')->where($where);
     $select = $table->select()->setIntegrityCheck(false)->from(array("r" => 'request'))->join(array("d" => 'department'), 'r.department_id=d.id', array('department_name' => 'title'))->join(array("u" => 'user'), 'r.requested_by=u.id', array('first_name', 'last_name', 'email', 'employee_code'))->order('status asc')->order('addedon DESC')->where($where);
     //->join('department', 'department.id=request.department_id')
     //echo $select->_toString();
     //echo $sql = $select->__toString();
     $paginator = Base_Paginator::factory($select);
     $paginator->setItemCountPerPage($page_size);
     $paginator->setCurrentPageNumber($page);
     $this->view->paginator = $paginator;
 }
Ejemplo n.º 6
0
 /**
  * send publish to specific provider
  * 
  * @param array $request 
  * @return void
  */
 public function executePublish($request)
 {
     $params = Application_Model_General::getParamsArray($request);
     // let's check if it's port (means we have execute response before)
     $execute_exists = Application_Model_General::getTransactions($request['request_id'], 'Execute_response', 'null');
     if (empty($execute_exists) || !is_array($execute_exists) || !count($execute_exists)) {
         $publish_type = "Rtrn";
     } else {
         $publish_type = "Port";
     }
     $params['PROCESS_TYPE'] = "PORT";
     $params['MSG_TYPE'] = "Publish";
     $params['FROM'] = Application_Model_General::getSettings('InternalProvider');
     $params['DONOR'] = $params['FROM_PROVIDER'];
     //$row['DONOR'] = $provider;
     $params['PUBLISH_TYPE'] = $publish_type;
     $params["RETRY_DATE"] = Application_Model_General::getDateTimeIso();
     $params["RETRY_NO"] = $this->get_retry_no($params);
     $params["VERSION_NO"] = Application_Model_General::getSettings("VersionNo");
     $reqModel = new Application_Model_Request($params);
     // make sure the request is ok.
     // can use $reqModel->RequestValidate() but maybe there is no need becuse i'm building it
     // TODO.oc666: why we execute from internal?
     $reqModel->ExecuteFromInternal();
     //what with the ack in the DB - status 1 for each?
 }
Ejemplo n.º 7
0
 private function setModel($row)
 {
     $model = new Application_Model_Request();
     $model->setId($row->id)->setDepartmentId($row->department_id)->setRequest($row->request)->setStatus($row->status)->setRequestedBy($row->requested_by)->setRemarks($row->remarks)->setUserId($row->user_id)->setAddedon($row->addedon)->setUpdatedon($row->updatedon);
     if ($department = $row->findParentRow("Application_Model_DbTable_Department")) {
         $model->setDepartment($department->title);
     } else {
         $model->setDepartment("N/A");
     }
     if ($user = $row->findParentRow("Application_Model_DbTable_User", "User")) {
         $userM = new Application_Model_User();
         $user = $userM->setModel($user);
         $model->setUser($user);
     } else {
         $model->setUser(null);
     }
     if ($user = $row->findParentRow("Application_Model_DbTable_User", "RequestedBy")) {
         $userM = new Application_Model_User();
         $user = $userM->setModel($user);
         $model->setRequestedByObj($user);
     } else {
         $model->setRequestedByObj(null);
     }
     return $model;
 }
Ejemplo n.º 8
0
 /**
  * sends automatic response to transaction messages sent to internal.
  * 
  * @param bool $status
  * 
  * @todo refactoring to bridge classes
  */
 public function CreateMethodResponse($status)
 {
     //update DB ack!
     //SEND RESPONSE TO PROVIDER
     $response = array('REQUEST_ID' => $this->params['REQUEST_ID'], 'PROCESS_TYPE' => $this->params['PROCESS_TYPE'], 'MSG_TYPE' => $this->params['MSG_TYPE'] . "_response", 'REQUEST_TRX_NO' => $this->params['TRX_NO'], 'FROM' => $this->params['TO'], 'TO' => $this->params['FROM'], 'REQUEST_RETRY_DATE' => $this->params['RETRY_DATE'], 'RETRY_DATE' => Application_Model_General::getDateTimeIso(), 'RETRY_NO' => isset($this->params['RETRY_NO']) ? $this->params['RETRY_NO'] : 1, 'VERSION_NO' => Application_Model_General::getSettings("VersionNo"), 'NETWORK_TYPE' => Application_Model_General::getSettings('NetworkType'), 'NUMBER_TYPE' => isset($this->params['NUMBER_TYPE']) ? $this->params['NUMBER_TYPE'] : Application_Model_General::getSettings("NumberType"));
     $phone_number = array("PHONE_NUMBER" => $this->params['PHONE_NUMBER']);
     Application_Model_General::writeToLog(array_merge($response, $phone_number));
     //check $status
     if (($status->status == "Ack00" || $status->status == "true") && !isset($status->resultCode) || $status->status == NULL && $status->resultCode == "Ack00") {
         $response['APPROVAL_IND'] = "Y";
     } elseif ($status->status == "Gen07") {
         $response['APPROVAL_IND'] = "N";
         $response['REJECT_REASON_CODE'] = "Gen07";
     } else {
         $response['APPROVAL_IND'] = "N";
         $response['REJECT_REASON_CODE'] = $status->status;
     }
     if ($this->params['MSG_TYPE'] == "Execute") {
         $time = isset($status->DISCONNECT_TIME) ? $status->DISCONNECT_TIME : null;
         $response['DISCONNECT_TIME'] = Application_Model_General::getDateTimeIso($time);
     }
     if ($response['MSG_TYPE'] == "Inquire_number_response") {
         $response['CURRENT_OPERATOR'] = isset($status->current_operator) ? $status->current_operator : $status->more->current_operator;
     }
     if (isset($status->resultCode) && !empty($status->resultCode)) {
         $response['REJECT_REASON_CODE'] = $status->resultCode;
     }
     $reqModel = new Application_Model_Request($response);
     $reqModel->ExecuteFromInternal(FALSE);
     // ExecuteResponse();
 }