public static function createCredentials($params)
 {
     $gateway = new Braintree_Gateway(array('clientId' => $params['clientId'], 'clientSecret' => $params['clientSecret']));
     $code = Braintree_OAuthTestHelper::createGrant($gateway, array('merchant_public_id' => $params['merchantId'], 'scope' => 'read_write'));
     $credentials = $gateway->oauth()->createTokenFromCode(array('code' => $code, 'scope' => 'read_write'));
     return $credentials;
 }
示例#2
0
 function testCreateTokenFromRefreshToken()
 {
     $gateway = new Braintree_Gateway(array('clientId' => 'client_id$development$integration_client_id', 'clientSecret' => 'client_secret$development$integration_client_secret'));
     $code = Braintree_OAuthTestHelper::createGrant($gateway, array('merchant_public_id' => 'integration_merchant_id', 'scope' => 'read_write'));
     $refreshToken = $gateway->oauth()->createTokenFromCode(array('code' => $code, 'scope' => 'read_write'))->refreshToken;
     $result = $gateway->oauth()->createTokenFromRefreshToken(array('refreshToken' => $refreshToken, 'scope' => 'read_write'));
     $this->assertEquals(true, $result->success);
     $this->assertNotNull($result->accessToken);
     $this->assertNotNull($result->refreshToken);
     $this->assertEquals('bearer', $result->tokenType);
     $this->assertNotNull($result->expiresAt);
 }