You are here

function Braintree_TransactionTest::testGatewayRejectionOnAvsAndCvv in Commerce Braintree 7

File

braintree_php/tests/integration/TransactionTest.php, line 1214

Class

Braintree_TransactionTest

Code

function testGatewayRejectionOnAvsAndCvv() {
  $old_merchant_id = Braintree_Configuration::merchantId();
  $old_public_key = Braintree_Configuration::publicKey();
  $old_private_key = Braintree_Configuration::privateKey();
  Braintree_Configuration::merchantId('processing_rules_merchant_id');
  Braintree_Configuration::publicKey('processing_rules_public_key');
  Braintree_Configuration::privateKey('processing_rules_private_key');
  $result = Braintree_Transaction::sale(array(
    'amount' => '100.00',
    'billing' => array(
      'postalCode' => '20000',
    ),
    'creditCard' => array(
      'number' => '5105105105105100',
      'expirationDate' => '05/12',
      'cvv' => '200',
    ),
  ));
  Braintree_Configuration::merchantId($old_merchant_id);
  Braintree_Configuration::publicKey($old_public_key);
  Braintree_Configuration::privateKey($old_private_key);
  $this
    ->assertFalse($result->success);
  $transaction = $result->transaction;
  $this
    ->assertEquals(Braintree_Transaction::AVS_AND_CVV, $transaction->gatewayRejectionReason);
}