You are here

function Braintree_CreditCardTest::testUpdate_withCardVerification in Commerce Braintree 7

File

braintree_php/tests/integration/CreditCardTest.php, line 661

Class

Braintree_CreditCardTest

Code

function testUpdate_withCardVerification() {
  $customer = Braintree_Customer::createNoValidate();
  $initialCreditCard = Braintree_CreditCard::create(array(
    'customerId' => $customer->id,
    'number' => '5105105105105100',
    'expirationDate' => '05/12',
  ))->creditCard;
  $result = Braintree_CreditCard::update($initialCreditCard->token, array(
    'billingAddress' => array(
      'region' => 'IL',
    ),
    'options' => array(
      'verifyCard' => true,
    ),
  ));
  $this
    ->assertFalse($result->success);
  $this
    ->assertEquals(Braintree_Result_CreditCardVerification::PROCESSOR_DECLINED, $result->creditCardVerification->status);
  $this
    ->assertEquals('2000', $result->creditCardVerification->processorResponseCode);
  $this
    ->assertEquals('Do Not Honor', $result->creditCardVerification->processorResponseText);
  $this
    ->assertEquals('I', $result->creditCardVerification->cvvResponseCode);
  $this
    ->assertEquals(null, $result->creditCardVerification->avsErrorResponseCode);
  $this
    ->assertEquals('I', $result->creditCardVerification->avsPostalCodeResponseCode);
  $this
    ->assertEquals('I', $result->creditCardVerification->avsStreetAddressResponseCode);
  $this
    ->assertEquals(Braintree_TestHelper::defaultMerchantAccountId(), $result->creditCardVerification->merchantAccountId);
}