original_string: public function request($uri,array $param, $state)
      {
  
          /** @var CheckoutApi_Lib_RespondObj $respond */
          $respond = CheckoutApi_Lib_Factory::getSingletonInstance('CheckoutApi_Lib_RespondObj');
          $this->setConfig($param);
  
          if(!isset($param['postedParam'])) {
  
              $param['postedParam'] = array();
          }
          $param['rawpostedParam'] = $param['postedParam'];
          $param['postedParam'] = $this->getParser()->preparePosted($param['postedParam']);
  
          $respondArray = null;
  
          if($state){
              $headers = $this->initHeader();
              $param['headers'] = $headers;
  
              /** @var CheckoutApi_Client_Adapter_Abstract $adapter */
              $adapter =  $this->getAdapter($this->getProcessType(),array('uri'=>$uri,'config'=>$param));
  
              if($adapter){
                  $adapter->connect();
                  $respondString = $adapter->request()->getRespond();
                  $statusResponse = $adapter->getResourceInfo();
                  $this->getParser()->setResourceInfo($statusResponse);
                  $respond = $this->getParser()->parseToObj($respondString);
  
                  if($respond && isset($respond['errors'])  && $respond->hasErrors()  ) {
  
                      /** @var CheckoutApi_Lib_ExceptionState  $exceptionStateObj */
                      $exceptionStateObj = $respond->getExceptionState();
                      $errors = $respond->getErrors()->toArray();
                      $exceptionStateObj->flushState();
  
                      foreach( $errors as $error) {
                          $this->throwException($error, $respond->getErrors()->toArray());
                      }
                  }elseif( $respond && isset($respond['errorCode']) && $respond->hasErrorCode()) {
                      /** @var CheckoutApi_Lib_ExceptionState  $exceptionStateObj */
                      $exceptionStateObj = $respond->getExceptionState();
  
                      $this->throwException($respond->getMessage(),$respond->toArray() );
  
                  }elseif($respond && $respond->getHttpStatus()!='200') {
                      $this->throwException('Gateway is temporary down',$param );
                  }
  
                  $adapter->close();
              }
  
          }
  
          return $respond;
      }
code: public function request($uri,array $param, $state)
      {
  
          /** @var CheckoutApi_Lib_RespondObj $respond */
          $respond = CheckoutApi_Lib_Factory::getSingletonInstance('CheckoutApi_Lib_RespondObj');
          $this->setConfig($param);
  
          if(!isset($param['postedParam'])) {
  
              $param['postedParam'] = array();
          }
          $param['rawpostedParam'] = $param['postedParam'];
          $param['postedParam'] = $this->getParser()->preparePosted($param['postedParam']);
  
          $respondArray = null;
  
          if($state){
              $headers = $this->initHeader();
              $param['headers'] = $headers;
  
              /** @var CheckoutApi_Client_Adapter_Abstract $adapter */
              $adapter =  $this->getAdapter($this->getProcessType(),array('uri'=>$uri,'config'=>$param));
  
              if($adapter){
                  $adapter->connect();
                  $respondString = $adapter->request()->getRespond();
                  $statusResponse = $adapter->getResourceInfo();
                  $this->getParser()->setResourceInfo($statusResponse);
                  $respond = $this->getParser()->parseToObj($respondString);
  
                  if($respond && isset($respond['errors'])  && $respond->hasErrors()  ) {
  
                      /** @var CheckoutApi_Lib_ExceptionState  $exceptionStateObj */
                      $exceptionStateObj = $respond->getExceptionState();
                      $errors = $respond->getErrors()->toArray();
                      $exceptionStateObj->flushState();
  
                      foreach( $errors as $error) {
                          $this->throwException($error, $respond->getErrors()->toArray());
                      }
                  }elseif( $respond && isset($respond['errorCode']) && $respond->hasErrorCode()) {
                      /** @var CheckoutApi_Lib_ExceptionState  $exceptionStateObj */
                      $exceptionStateObj = $respond->getExceptionState();
  
                      $this->throwException($respond->getMessage(),$respond->toArray() );
  
                  }elseif($respond && $respond->getHttpStatus()!='200') {
                      $this->throwException('Gateway is temporary down',$param );
                  }
  
                  $adapter->close();
              }
  
          }
  
          return $respond;
      }
code_tokens: public function request ( $ uri , array $ param , $ state ) { /** @var CheckoutApi_Lib_RespondObj $respond */ $ respond = CheckoutApi_Lib_Factory :: getSingletonInstance ( 'CheckoutApi_Lib_RespondObj' ) ; $ this -> setConfig ( $ param ) ; if ( ! isset ( $ param [ 'postedParam' ] ) ) { $ param [ 'postedParam' ] = array ( ) ; } $ param [ 'rawpostedParam' ] = $ param [ 'postedParam' ] ; $ param [ 'postedParam' ] = $ this -> getParser ( ) -> preparePosted ( $ param [ 'postedParam' ] ) ; $ respondArray = null ; if ( $ state ) { $ headers = $ this -> initHeader ( ) ; $ param [ 'headers' ] = $ headers ; /** @var CheckoutApi_Client_Adapter_Abstract $adapter */ $ adapter = $ this -> getAdapter ( $ this -> getProcessType ( ) , array ( 'uri' => $ uri , 'config' => $ param ) ) ; if ( $ adapter ) { $ adapter -> connect ( ) ; $ respondString = $ adapter -> request ( ) -> getRespond ( ) ; $ statusResponse = $ adapter -> getResourceInfo ( ) ; $ this -> getParser ( ) -> setResourceInfo ( $ statusResponse ) ; $ respond = $ this -> getParser ( ) -> parseToObj ( $ respondString ) ; if ( $ respond && isset ( $ respond [ 'errors' ] ) && $ respond -> hasErrors ( ) ) { /** @var CheckoutApi_Lib_ExceptionState  $exceptionStateObj */ $ exceptionStateObj = $ respond -> getExceptionState ( ) ; $ errors = $ respond -> getErrors ( ) -> toArray ( ) ; $ exceptionStateObj -> flushState ( ) ; foreach ( $ errors as $ error ) { $ this -> throwException ( $ error , $ respond -> getErrors ( ) -> toArray ( ) ) ; } } elseif ( $ respond && isset ( $ respond [ 'errorCode' ] ) && $ respond -> hasErrorCode ( ) ) { /** @var CheckoutApi_Lib_ExceptionState  $exceptionStateObj */ $ exceptionStateObj = $ respond -> getExceptionState ( ) ; $ this -> throwException ( $ respond -> getMessage ( ) , $ respond -> toArray ( ) ) ; } elseif ( $ respond && $ respond -> getHttpStatus ( ) != '200' ) { $ this -> throwException ( 'Gateway is temporary down' , $ param ) ; } $ adapter -> close ( ) ; } } return $ respond ; }
docstring: Build up the request to the gateway
  @param string $uri endpoint to be used
  @param array $param payload param
  @param boolean $state if error occured don't send charge
  @return CheckoutApi_Lib_RespondObj
  @throws Exception
docstring_tokens: Build up the request to the gateway