/** * @expectedException Braintree_Exception_Configuration * @expectedExceptionMessage Braintree_Configuration::publicKey needs to be set. */ function testAssertGlobalHasAccessTokenOrKeysWithoutPublicKey() { Braintree_Configuration::environment('development'); Braintree_Configuration::merchantId('integration_merchant_id'); Braintree_Configuration::publicKey(''); Braintree_Configuration::privateKey('integration_private_key'); Braintree_Configuration::assertGlobalHasAccessTokenOrKeys(); }
public static function verify($challenge) { if (!preg_match('/^[a-f0-9]{20,32}$/', $challenge)) { throw new Braintree_Exception_InvalidChallenge("challenge contains non-hex characters"); } Braintree_Configuration::assertGlobalHasAccessTokenOrKeys(); $publicKey = Braintree_Configuration::publicKey(); $digest = Braintree_Digest::hexDigestSha1(Braintree_Configuration::privateKey(), $challenge); return "{$publicKey}|{$digest}"; }