You are here

function commerce_cardonfile_get_properties in Commerce Card on File 7.2

Entity Metadata getter callback.

1 string reference to 'commerce_cardonfile_get_properties'
commerce_cardonfile_entity_property_info in ./commerce_cardonfile.info.inc
Implements hook_entity_property_info().

File

./commerce_cardonfile.module, line 1513
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_get_properties($item, array $options, $name, $type, $context) {
  switch ($name) {
    case 'card_number':
      return commerce_cardonfile_format_credit_card_number($item->card_number, $item->card_type);
    case 'card_exp':
      $month = str_pad($item->card_exp_month, 2, '0', STR_PAD_LEFT);
      $year = $item->card_exp_year;
      return format_string('@month/@year', array(
        '@month' => $month,
        '@year' => $year,
      ));
  }
}