You are here

function commerce_cardonfile_data_load_multiple in Commerce Card on File 7

Loads stored card data for a user by payment method instance.

Parameters

$uid: The user ID of the user whose card data should be loaded.

$instance_id: The payment method instance ID to load card data for.

$active: Boolean indicating whether or not to only return active card data; defaults to TRUE.

Return value

An associative array of all applicable card data keyed by card_id or an empty array if no matching data exists.

5 calls to commerce_cardonfile_data_load_multiple()
commerce_cardonfile_delete_form_submit in includes/commerce_cardonfile.pages.inc
Form submit handler: delete stored card data.
commerce_cardonfile_form_alter in ./commerce_cardonfile.module
Implements hook_form_alter().
commerce_cardonfile_overview in includes/commerce_cardonfile.pages.inc
Displays the card data overview for the "Stored payment methods" account tab.
commerce_cardonfile_update_form_submit in includes/commerce_cardonfile.pages.inc
Form submit handler: update stored card data.
commerce_cardonfile_user_access in ./commerce_cardonfile.module
Determines if the current user has access to the specified account's "Stored payment methods" tab.

File

./commerce_cardonfile.module, line 376
Supports card on file functionality for credit card payment methods by associating card data reference IDs from payment gateways with user accounts.

Code

function commerce_cardonfile_data_load_multiple($uid, $instance_id = NULL, $active = TRUE) {
  $query = db_select('commerce_card_data', 'ccd')
    ->fields('ccd')
    ->condition('ccd.uid', $uid);
  if (!empty($instance_id)) {
    $query
      ->condition('ccd.instance_id', $instance_id);
  }
  if ($active) {
    $query
      ->condition('ccd.status', 1);
  }
  return $query
    ->execute()
    ->fetchAllAssoc('card_id', PDO::FETCH_ASSOC);
}