コード例 #1
0
ファイル: signed.php プロジェクト: trustly/trustly-client-php
 /**
  * Call the API with the prepared request
  *
  * @throws Trustly_DataException Upon failure to add all the communication
  *		parameters to the data or if the incoming data fails the basic
  *		sanity checks
  *
  * @throws Trustly_ConnectionException When failing to communicate with the
  *		API.
  *
  * @throws Trustly_SignatureException If the incoming message has an
  *		invalid signature
  *
  * @param Trustly_Data_JSONRPCRequest $request Outgoing request
  *
  * @return Trustly_Data_JSONRPCSignedResponse Response from the API.
  */
 public function call($request)
 {
     $uuid = $request->getUUID();
     if ($uuid === NULL) {
         $request->setUUID($this->generateUUID());
     }
     return parent::call($request);
 }
コード例 #2
0
 /**
  * Issue an unsigned API call. As the unsigned API contains a huge array of
  * functions we will use the call() method directly for the majority of
  * operations. The data in params will be matched into the parameters of
  * the outgoing call. Take care when supplying the arguments for the call
  * so they match the function prototype properly.
  *
  * @param string $method API method to call
  *
  * @param Trustly_Data_JSONRPCRequest $params Outgoing call params
  *
  * @return Trustly_Data_JSONRPCResponse Response from the API.
  */
 public function call($method, $params = NULL)
 {
     $request = new Trustly_Data_JSONRPCRequest($method);
     if (isset($params)) {
         foreach ($params as $key => $value) {
             $request->setParam($key, $value);
         }
     }
     if (!$this->hasSessionUUID()) {
         $this->newSessionCookie();
     }
     return parent::call($request);
 }