Exemple #1
0
 /**
  * @throws RequiredFieldMissingException
  */
 private function validateCredentials()
 {
     if (empty($this->apiConfiguration->getUsername())) {
         throw new RequiredFieldMissingException('ApiConfiguration', 'username');
     } elseif (empty($this->apiConfiguration->getPassword())) {
         throw new RequiredFieldMissingException('ApiConfiguration', 'password');
     } elseif (empty($this->apiConfiguration->getClientId())) {
         throw new RequiredFieldMissingException('ApiConfiguration', 'clientId');
     } elseif (empty($this->apiConfiguration->getClientSecret())) {
         throw new RequiredFieldMissingException('ApiConfiguration', 'clientSecret');
     } elseif (empty($this->apiConfiguration->getScope())) {
         throw new RequiredFieldMissingException('ApiConfiguration', 'scope');
     }
 }
Exemple #2
0
 /**
  * @return Responses\CreateAccessTokenResponse
  * @throws Exceptions\RequiredFieldMissingException
  * @throws Exceptions\UnauthorizedClientException
  */
 public function refreshAccessToken()
 {
     $accessTokenResponse = $this->httpRequest->requestAccessToken();
     $this->apiConfiguration->setAccessToken($accessTokenResponse->getAccessToken());
     return $accessTokenResponse;
 }