Braintree\WebhookNotification::verify PHP 메소드

verify() 공개 정적인 메소드

public static verify ( $challenge )
    public static function verify($challenge)
    {
        if (!preg_match('/^[a-f0-9]{20,32}$/', $challenge)) {
            throw new Exception\InvalidChallenge("challenge contains non-hex characters");
        }
        Configuration::assertGlobalHasAccessTokenOrKeys();
        $publicKey = Configuration::publicKey();
        $digest = Digest::hexDigestSha1(Configuration::privateKey(), $challenge);
        return "{$publicKey}|{$digest}";
    }

Usage Example

 /**
  * @expectedException Braintree\Exception\Configuration
  * @expectedExceptionMessage Braintree\Configuration::merchantId needs to be set (or accessToken needs to be passed to Braintree\Gateway)
  */
 public function testVerifyRaisesErrorWhenEnvironmentNotSet()
 {
     Braintree\Configuration::reset();
     Braintree\WebhookNotification::verify('20f9f8ed05f77439fe955c977e4c8a53');
 }