You are here

function commerce_cardonfile_save in Commerce Card on File 7.2

Saves a card.

Parameters

$card: The card entity to save.

Return value

SAVED_NEW or SAVED_UPDATED depending on the operation performed.

4 calls to commerce_cardonfile_save()
CommerceCardOnFile::save in includes/commerce_cardonfile.entity.inc
Overrides Entity::save().
commerce_cardonfile_card_form_submit in includes/commerce_cardonfile.pages.inc
Submit callback for commerce_cardonfile_card_form().
commerce_cardonfile_testing_payment_submit_form_submit in tests/commerce_cardonfile_testing/commerce_cardonfile_testing.module
Payment method callback: submit form submission.
commerce_cardonfile_update_anonymous in ./commerce_cardonfile.rules.inc
Action callback; Associate anonymous card data with the newly created user.

File

./commerce_cardonfile.module, line 905
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_save($card) {
  $order = menu_get_object('commerce_order');
  if (empty($card->order_id) && isset($order)) {
    $card->order_id = $order->order_id;
  }
  return entity_save('commerce_cardonfile', $card);
}