2016-06-08 34 views
0

我已經爲我的(沙盒)檢出以下代碼: (我已經略去了最初的變量聲明)布倫特裏DropInUI網關拒絕卡驗證沒有失敗(PHP)

require_once("braintree/braintree_init.php"); 

$nonceFromTheClient = 'fake-gateway-rejected-fraud-nonce'; 

$result = Braintree_Customer::create([ 
    'id' => $userId, 
    'firstName' => $firstName, 
    'lastName' => $lastName, 
    'email' => $email, 
    'paymentMethodNonce' => $nonceFromTheClient, 
    'creditCard' => [ 
     'billingAddress' => [ 
      'streetAddress' => $billingAddress, 
      'locality' => $billingCity, 
      'region' => $billingState, 
      'postalCode' => $billingZip 
     ] 
    ] 
]); 

if ($result->success) { 
    echo "create: success"; 
    $token = $result->customer->paymentMethods[0]->token; 
} else { 
    echo "create: fail"; 
    foreach($result->errors->deepAll() AS $error) { 
     echo($error->code . ": " . $error->message . "\n"); 
    } 
    $verification = $result->creditCardVerification; 
    echo $verification->status; 
    echo $verification->processorResponseCode; 
    echo $verification->processorResponseText; 
    echo $verification->gatewayRejectionReason; 
    $verificationError = "There was a problem processing your credit card; please double check your payment information and try again."; 
    return false; 
} 

$result = Braintree_Subscription::create([ 
    'paymentMethodToken' => $token, 
    'planId' => $subId 
]); 

if ($result->success) { 
    $subscriptionId = $result->subscription->id; 
    header("Location: transaction.php?i=".$subscriptionId.""); 
} else { 
    foreach($result->errors->deepAll() AS $error) { 
     echo($error->code . ": " . $error->message . "\n"); 
    } 
} 

我試圖讓卡驗證失敗。我爲控制面板中的所有卡啓用了驗證。當我使用提供的$ nonceFromTheClient ='假門戶拒絕欺詐隨機數'時,客戶創建仍然成功。

如果我使用卡號4000111111111115從不成功的信用卡驗證列表,它仍然是成功的,雖然承認我不清楚卡號應使用什麼隨機數。

如果我使用'假處理器拒絕 - 簽證 - 隨機'它失敗(如預期)。

所以我不確定爲什麼卡驗證在前兩次嘗試中仍然成功?

回答

0

完全披露:我在布倫特裏工作。如果您有任何其他問題,請隨時聯繫我們的support team

Credit cards are not verified by default什麼時候在我們的網關中存放。您必須將verifyCard選項設置爲true才能驗證該卡。

$result = Braintree_Customer::create([ 
    'firstName' => 'Fred', 
    'lastName' => 'Jones', 
    'creditCard' => [ 
     'paymentMethodNonce' => nonceFromTheClient, 
     'options' => [ 
      'verifyCard' => true 
     ] 
    ] 
]); 

我們的文檔的The testing section進一步闡述了使用我們的假測試隨機數的。