/** * @return Transaction * @throws Exception */ public function refresh() { if (!$this->auth->isRefreshTokenValid()) { throw new Exception('Refresh token has expired'); } // Synchronous $response = $this->authCall(self::TOKEN_ENDPOINT, array("grant_type" => "refresh_token", "refresh_token" => $this->auth->getRefreshToken(), "access_token_ttl" => self::ACCESS_TOKEN_TTL, "refresh_token_ttl" => $this->auth->isRemember() ? self::REFRESH_TOKEN_TTL_REMEMBER : self::REFRESH_TOKEN_TTL)); $this->auth->setData($response->getJson(false)); return $response; }
/** * @return ApiResponse * @throws ApiException */ public function refresh() { if (!$this->_auth->refreshTokenValid()) { throw new ApiException(null, new Exception('Refresh token has expired')); } // Synchronous $response = $this->requestToken(self::TOKEN_ENDPOINT, array("grant_type" => "refresh_token", "refresh_token" => $this->_auth->refreshToken(), "access_token_ttl" => self::ACCESS_TOKEN_TTL, "refresh_token_ttl" => self::REFRESH_TOKEN_TTL)); $this->_auth->setData($response->jsonArray()); return $response; }