You are here

function Braintree_CustomerTest::testCreditNoValidate_createsACreditUsingGivenId in Commerce Braintree 7

File

braintree_php/tests/integration/CustomerTest.php, line 889

Class

Braintree_CustomerTest

Code

function testCreditNoValidate_createsACreditUsingGivenId() {
  $customer = Braintree_Customer::createNoValidate(array(
    'creditCard' => array(
      'number' => '5105105105105100',
      'expirationDate' => '05/12',
    ),
  ));
  $creditCard = $customer->creditCards[0];
  $transaction = Braintree_Customer::creditNoValidate($customer->id, array(
    'amount' => '100.00',
  ));
  $this
    ->assertEquals('100.00', $transaction->amount);
  $this
    ->assertEquals(Braintree_Transaction::CREDIT, $transaction->type);
  $this
    ->assertEquals($customer->id, $transaction->customerDetails->id);
  $this
    ->assertEquals($creditCard->token, $transaction->creditCardDetails->token);
}