You are here

function Braintree_TransactionTest::testGatewayRejectionOnAvs in Commerce Braintree 7

File

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

Class

Braintree_TransactionTest

Code

function testGatewayRejectionOnAvs() {
  $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(
      'streetAddress' => '200 2nd Street',
    ),
    'creditCard' => array(
      'number' => '5105105105105100',
      'expirationDate' => '05/12',
    ),
  ));
  Braintree_Configuration::merchantId($old_merchant_id);
  Braintree_Configuration::publicKey($old_public_key);
  Braintree_Configuration::privateKey($old_private_key);
  $this
    ->assertFalse($result->success);
  Braintree_TestHelper::assertPrintable($result);
  $transaction = $result->transaction;
  $this
    ->assertEquals(Braintree_Transaction::AVS, $transaction->gatewayRejectionReason);
}