You are here

function Braintree_TransactionTest::testRefund in Commerce Braintree 7

File

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

Class

Braintree_TransactionTest

Code

function testRefund() {
  $transaction = $this
    ->createTransactionToRefund();
  $result = Braintree_Transaction::refund($transaction->id);
  $this
    ->assertTrue($result->success);
  $refund = $result->transaction;
  $this
    ->assertEquals(Braintree_Transaction::CREDIT, $refund->type);
  $this
    ->assertEquals($transaction->id, $refund->refundedTransactionId);
  $this
    ->assertEquals($refund->id, Braintree_Transaction::find($transaction->id)->refundId);
}