Example #1
0
 /**
  *
  * Get post data sent by VPOS.
  *
  * @return Response object
  *
  **/
 public static function read()
 {
     $self = new self();
     $self->response = HTTP::read();
     return $self;
 }
Example #2
0
 /**
  *
  * Prepare url and post data to Bancard configured enviroment url.
  * If successful sets up redirect url.
  * Raise exception on error.
  *
  * @return bool
  *
  **/
 protected function post()
 {
     $this->url = $this->environment . $this->path;
     $this->response_data = HTTP::post($this->url, $this->json());
     if (!$this->response_data) {
         throw new \RuntimeException("No response data was found.");
     }
     $this->response = $this->response();
     if ($this->response->status == "error") {
         throw new \Exception("[" . $this->response->messages[0]->key . "] " . $this->response->messages[0]->dsc);
     }
     if (!empty($this->response()->process_id)) {
         $this->redirect_to = $this->environment . Config::get("redirect_path") . "?process_id=" . $this->response()->process_id;
     }
     return true;
 }