You are here

protected function CommerceBraintreeTest::createTrDataInfo in Commerce Braintree 7.2

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

Return an array with credit card info.

1 call to CommerceBraintreeTest::createTrDataInfo()
CommerceBraintreeTest::testCommerceBraintreeRequest in tests/commerce_braintree.test

File

tests/commerce_braintree.test, line 80
Functional tests for the commerce payment module user interface.

Class

CommerceBraintreeTest
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(
        'submitForSettlement' => TRUE,
      ),
    ),
    'redirectUrl' => url('checkout/' . $order->order_id . '/payment/return/', array(
      'absolute' => TRUE,
    )),
  ));
  return $trData;
}