Esempio n. 1
0
 /**
  * Constructor 
  * Gets Params and places them accordingly as Header or Body Fields
  * using the Switch Case
  * 
  * @param array $options 
  */
 protected function __construct(&$options)
 {
     $this->type = str_replace("Np_Method_", "", get_class($this));
     $this->header = $this->body = array();
     if (is_object($options)) {
         // soap - let's  tranform to one dimension array
         $options = $this->soapToArray($options);
     }
     Application_Model_General::writeToLog($options);
     //SET HEADER - for all methods
     foreach ($options as $key => $value) {
         switch (ucwords(strtolower($key))) {
             case "Request_id":
             case "Process_type":
             case "Msg_type":
             case "Trx_no":
             case "Version_no":
             case "Retry_no":
             case "Retry_date":
             case "From":
             case "To":
                 $this->setHeader($key, $value);
                 break;
             case "From_provider":
                 $this->setHeader('From', $value);
                 break;
             case "To_provider":
                 $this->setHeader('To', $value);
                 break;
             case "Ack_code":
             case "Ack_date":
                 $this->setBodyField($key, $value);
                 break;
         }
     }
 }
Esempio n. 2
0
 /**
  * locks request process according to request id 
  * and sends execute message to provider
  * 
  * @param array $request 
  * @return void
  */
 public function executeTransferOut($request)
 {
     $params = array('REQUEST_ID' => $request['request_id'], 'PROCESS_TYPE' => "PORT", 'MSG_TYPE' => "Execute_response", 'TO' => Application_Model_General::getSettings('InternalProvider'), 'FROM' => $request['from_provider'], "RETRY_DATE" => Application_Model_General::getDateTimeIso(), "RETRY_NO" => "1", "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
     //fix bug #5285
     $params['PHONE_NUMBER'] = Application_Model_General::getFieldFromRequests("phone_number", $params['REQUEST_ID']);
     //end of fix bug #5285
     Application_Model_General::writeToLog($params);
     $reqModel->ExecuteFromInternal();
 }
Esempio n. 3
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();
 }