/**
  * Set Token
  * Token linked to the authorization request, once authorized
  * @param  object $value
  * @return $this
  */
 public function setToken($value)
 {
     if (is_object($value)) {
         $this->token = $value;
     } else {
         $obj = new Token($this->client);
         $obj->fillWithData($value);
         $this->token = $obj;
     }
     return $this;
 }
Example #2
0
 /**
  * Find a customer's token by its ID.
  * @param string $tokenId
  * @param array $options
  * @return Token
  */
 public function findToken($tokenId, $options = array())
 {
     $request = new Request($this->client);
     $path = "/customers/" . urlencode($this->getId()) . "/tokens/" . urlencode($tokenId) . "";
     $data = array();
     $response = $request->get($path, $data, $options);
     $returnValues = array();
     // Handling for field token
     $body = $response->getBody();
     $body = $body['token'];
     $token = new Token($this->client);
     $returnValues['token'] = $token->fillWithData($body);
     return array_values($returnValues)[0];
 }