createFromTransparentRedirect() public static method

Deprecation: since version 2.3.0
public static createFromTransparentRedirect ( string $queryString ) : Braintree\Result\Successful
$queryString string
return Braintree\Result\Successful
 public function testParseAndValidateQueryString_throwsAuthenticationErrorIfBadCredentials()
 {
     Test\Helper::suppressDeprecationWarnings();
     $privateKey = Braintree\Configuration::privateKey();
     Braintree\Configuration::privateKey('incorrect');
     try {
         $trData = Braintree\TransparentRedirect::createCustomerData(array("redirectUrl" => "http://www.example.com"));
         $queryString = Test\Helper::submitTrRequest(Braintree\Customer::createCustomerUrl(), array(), $trData);
         $this->setExpectedException('Braintree\\Exception\\Authentication');
         Braintree\Customer::createFromTransparentRedirect($queryString);
     } catch (Braintree\Exception $e) {
     }
     $privateKey = Braintree\Configuration::privateKey($privateKey);
     if (isset($e)) {
         throw $e;
     }
 }
示例#2
0
 public function testCreateFromTransparentRedirect_withValidationErrors()
 {
     Test\Helper::suppressDeprecationWarnings();
     $queryString = $this->createCustomerViaTr(['customer' => ['first_name' => str_repeat('x', 256), 'credit_card' => ['number' => 'invalid', 'expiration_date' => '']]], []);
     $result = Braintree\Customer::createFromTransparentRedirect($queryString);
     $this->assertFalse($result->success);
     $errors = $result->errors->forKey('customer')->onAttribute('firstName');
     $this->assertEquals(Braintree\Error\Codes::CUSTOMER_FIRST_NAME_IS_TOO_LONG, $errors[0]->code);
     $errors = $result->errors->forKey('customer')->forKey('creditCard')->onAttribute('number');
     $this->assertEquals(Braintree\Error\Codes::CREDIT_CARD_NUMBER_INVALID_LENGTH, $errors[0]->code);
     $errors = $result->errors->forKey('customer')->forKey('creditCard')->onAttribute('expirationDate');
     $this->assertEquals(Braintree\Error\Codes::CREDIT_CARD_EXPIRATION_DATE_IS_REQUIRED, $errors[0]->code);
 }