Test\Helper::generate3DSNonce PHP Method

generate3DSNonce() public static method

public static generate3DSNonce ( $params )
    public static function generate3DSNonce($params)
    {
        $http = new Braintree\Http(Braintree\Configuration::$global);
        $path = Braintree\Configuration::$global->merchantPath() . '/three_d_secure/create_nonce/' . self::threeDSecureMerchantAccountId();
        $response = $http->post($path, $params);
        return $response['paymentMethodNonce']['nonce'];
    }

Usage Example

 public function testFind_exposesThreeDSecureInfo()
 {
     $creditCard = ['creditCard' => ['number' => '4111111111111111', 'expirationMonth' => '12', 'expirationYear' => '2020']];
     $nonce = Helper::generate3DSNonce($creditCard);
     $foundNonce = Braintree\PaymentMethodNonce::find($nonce);
     $info = $foundNonce->threeDSecureInfo;
     $this->assertEquals($nonce, $foundNonce->nonce);
     $this->assertEquals('CreditCard', $foundNonce->type);
     $this->assertEquals('Y', $info->enrolled);
     $this->assertEquals('authenticate_successful', $info->status);
     $this->assertTrue($info->liabilityShifted);
     $this->assertTrue($info->liabilityShiftPossible);
 }