You are here

function commerce_braintree_cardonfile_entities_by_user in Commerce Braintree 7.3

Same name and namespace in other branches
  1. 7.2 commerce_braintree.module \commerce_braintree_cardonfile_entities_by_user()

Fetch card on file entities by user for all Braintree modules.

Parameters

$uid: The Drupal user id.

Return value

array An array of commerce_cardonfile entities.

1 call to commerce_braintree_cardonfile_entities_by_user()
commerce_braintree_js_cardonfile_form_submit in ./commerce_braintree.module
Submit handler for commerce_cardonfile form callbacks.

File

./commerce_braintree.module, line 1437
Integrates Braintree Transparent Redirect with Drupal Commerce.

Code

function commerce_braintree_cardonfile_entities_by_user($uid) {
  $cards = (array) commerce_cardonfile_load_multiple_by_uid($uid);
  foreach ($cards as $card) {
    if (strpos($card->payment_method, 'braintree') !== 0) {
      unset($cards[$card->card_id]);
    }
  }
  return $cards;
}