function _commerce_braintree_get_transaction_informations in Commerce Braintree 7
Same name and namespace in other branches
- 7.3 commerce_braintree.module \_commerce_braintree_get_transaction_informations()
- 7.2 commerce_braintree.module \_commerce_braintree_get_transaction_informations()
Prepare data that will be sent during a Braintree transaction.
Parameters
$order:
Return value
array
2 calls to _commerce_braintree_get_transaction_informations()
- commerce_braintree_cof_redirect_form in ./
commerce_braintree.commerce_braintree_cof.inc - Payment method callback: redirect form.
- commerce_braintree_redirect_form in ./
commerce_braintree.commerce_braintree.inc - Payment method callback: redirect form.
File
- ./
commerce_braintree.module, line 474 - Implementations of the Braintree payment gateway (http://braintreepayments.com) for drupal commerce.
Code
function _commerce_braintree_get_transaction_informations($order) {
$wrapper = entity_metadata_wrapper('commerce_order', $order);
// Get financial info.
$currency_code = $wrapper->commerce_order_total->currency_code
->value();
$amount = $wrapper->commerce_order_total->amount
->value();
// Customer data.
$customer_name = $wrapper->commerce_customer_billing->commerce_customer_address->name_line
->value();
$country = $wrapper->commerce_customer_billing->commerce_customer_address->country
->value();
$thoroughfare = $wrapper->commerce_customer_billing->commerce_customer_address->thoroughfare
->value();
$locality = $wrapper->commerce_customer_billing->commerce_customer_address->locality
->value();
$postal_code = $wrapper->commerce_customer_billing->commerce_customer_address->postal_code
->value();
$administrative_area = $wrapper->commerce_customer_billing->commerce_customer_address->administrative_area
->value();
$wrapper2 = entity_metadata_wrapper('user', $order->uid);
$customer_mail = $wrapper2->mail
->value();
return array(
$amount,
$customer_name,
$country,
$thoroughfare,
$locality,
$postal_code,
$administrative_area,
$customer_mail,
);
}