You are here

function Braintree_TransactionTest::testSale_storeInVaultOnSuccessWithFailedTransaction in Commerce Braintree 7

File

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

Class

Braintree_TransactionTest

Code

function testSale_storeInVaultOnSuccessWithFailedTransaction() {
  $result = Braintree_Transaction::sale(array(
    'amount' => Braintree_Test_TransactionAmounts::$decline,
    'creditCard' => array(
      'cardholderName' => 'Card Holder',
      'number' => '5105105105105100',
      'expirationDate' => '05/12',
    ),
    'customer' => array(
      'firstName' => 'Dan',
      'lastName' => 'Smith',
      'company' => 'Braintree Payment Solutions',
      'email' => 'dan@example.com',
      'phone' => '419-555-1234',
      'fax' => '419-555-1235',
      'website' => 'http://getbraintree.com',
    ),
    'options' => array(
      'storeInVaultOnSuccess' => true,
    ),
  ));
  $transaction = $result->transaction;
  $this
    ->assertNull($transaction->creditCardDetails->token);
  $this
    ->assertNull($transaction
    ->vaultCreditCard());
  $this
    ->assertNull($transaction->customerDetails->id);
  $this
    ->assertNull($transaction
    ->vaultCustomer());
}