You are here

protected function CommerceBraintreeCofTest::createTrDataInfo in Commerce Braintree 7.2

Same name and namespace in other branches
  1. 7.3 tests/commerce_braintree_cof.test \CommerceBraintreeCofTest::createTrDataInfo()
  2. 7 tests/commerce_braintree_cof.test \CommerceBraintreeCofTest::createTrDataInfo()

Return an array with credit card info.

1 call to CommerceBraintreeCofTest::createTrDataInfo()
CommerceBraintreeCofTest::testCommerceBraintreeCofRequest in tests/commerce_braintree_cof.test
Test a card on File request. Be sure we store the credit card.

File

tests/commerce_braintree_cof.test, line 85
Functional tests for the commerce payment module user interface.

Class

CommerceBraintreeCofTest
Test payment user interface.

Code

protected function createTrDataInfo($order) {
  $order_wrapper = entity_metadata_wrapper('commerce_order', $order);
  $this
    ->getCredentials();
  $trData = Braintree_TransparentRedirect::transactionData(array(
    // Add transaction related data.
    'transaction' => array(
      'type' => Braintree_Transaction::SALE,
      'amount' => $this->price,
      'orderId' => $order->order_id,
      'customer' => array(
        'firstName' => 'Test User',
        'email' => 'test@exemple.com',
      ),
      'billing' => array(
        'countryCodeAlpha2' => 'US',
      ),
      'options' => array(
        'storeInVault' => TRUE,
        'submitForSettlement' => TRUE,
      ),
    ),
    'redirectUrl' => url('checkout/' . $order->order_id . '/payment/return/', array(
      'absolute' => TRUE,
    )),
  ));
  return $trData;
}