/** * Generates a new access token * * @param array $config * @return null */ private function generateAccessToken($config, $refreshToken = null) { $params = array('grant_type' => 'client_credentials'); if ($refreshToken != null) { // If the refresh token is provided, it would get access token using refresh token // Used for Future Payments $params['grant_type'] = 'refresh_token'; $params['refresh_token'] = $refreshToken; } $payload = http_build_query($params); $response = $this->getToken($config, $this->clientId, $this->clientSecret, $payload); if ($response == null || !isset($response["access_token"]) || !isset($response["expires_in"])) { $this->accessToken = null; $this->tokenExpiresIn = null; $this->logger->warning("Could not generate new Access token. Invalid response from server: " . $response); } else { $this->accessToken = $response["access_token"]; $this->tokenExpiresIn = $response["expires_in"]; } $this->tokenCreateTime = time(); return $this->accessToken; }
/** * @test */ public function testWarning() { $this->object->warning('Test Warning Message'); }