Exemplo n.º 1
0
 /**
  * checks PostValidate()
  * if TRUE checks if request type is execute response
  * 			if it is updates ack in db
  * 			saves data to db.
  * 			send request to internal and returns response ack.
  * if FALSE 
  * 		puts FALSE in ACK
  * @return void 
  */
 public function ExecuteResponse()
 {
     $validate = $this->request->PostValidate();
     if ($validate === true) {
         $this->request->setCorrectAck();
         $this->saveDB();
         $internalModel = new Application_Model_Internal($this->data);
         $json = $internalModel->SendRequestToInternal($this->request);
         $obj = json_decode($json);
         $reject_reason_code = $this->request->getRejectReasonCode();
         // send auto request only if no reject reason code
         if (empty($reject_reason_code)) {
             $internalModel->sendAutoRequest($this->request->type);
         }
         if (isset($obj->more)) {
             $this->request->postInternalRequest($obj->more);
         }
         if (isset($obj->status)) {
             if (strtolower($obj->status) == 'true' || strtolower($obj->status) == 'false') {
                 $ret = 'Ack00';
             } else {
                 $ret = $obj->status;
             }
         } else {
             if (isset($obj->resultCode) && strtoupper($obj->resultCode) != "OK") {
                 // backward compatibility
                 $ret = $obj->resultCode;
             } else {
                 if (!isset($obj->resultCode) && !isset($obj->status)) {
                     $ret = "Ack00";
                 }
             }
         }
     } else {
         if ($validate !== FALSE) {
             $ret = $validate;
         }
     }
     $this->request->setAck($ret);
 }