/** * 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(); }
/** * 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? }
/** * 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(); }