Ejemplo n.º 1
0
 /**
  * @param  string $requestCode
  * @return string
  * @throws Exception
  */
 public function callAccessToken($requestCode)
 {
     $appId = $this->config->getAppId();
     $appSecret = $this->config->getAppSecret();
     $appAccessToken = sprintf('AA|%s|%s', $appId, $appSecret);
     $response = $this->call($this->config->getUrlToken(), ['query' => ['grant_type' => 'authorization_code', 'code' => $requestCode, 'access_token' => $appAccessToken]]);
     $authResponse = $this->convertResponse($response);
     if (!isset($authResponse['access_token'])) {
         throw new ResponseFieldException('access_token');
     }
     return $authResponse['access_token'];
 }
 /**
  * @covers Ingresse\Accountkit\Config
  */
 public function testConfig()
 {
     $config = new Config(['app_id' => 123, 'app_secret' => 'abc123']);
     $this->assertEquals(123, $config->getAppId());
     $this->assertEquals('abc123', $config->getAppSecret());
 }