You are here

function commerce_braintree_cardonfile_update_delete in Commerce Braintree 7

Same name and namespace in other branches
  1. 7.3 commerce_braintree.module \commerce_braintree_cardonfile_update_delete()
  2. 7.2 commerce_braintree.module \commerce_braintree_cardonfile_update_delete()

Callback for card on file update or delete.

1 string reference to 'commerce_braintree_cardonfile_update_delete'
commerce_braintree_commerce_payment_method_info in ./commerce_braintree.module
Implements hook_commerce_payment_method_info().

File

./commerce_braintree.module, line 94
Implementations of the Braintree payment gateway (http://braintreepayments.com) for drupal commerce.

Code

function commerce_braintree_cardonfile_update_delete($form, &$form_state, $payment_method, $card_data) {
  if ($form['#id'] == 'commerce-cardonfile-delete-form') {
    _commerce_braintree_init_credentials($payment_method);
    $result = Braintree_CreditCard::delete($card_data['remote_id']);
    if ($result->success) {
      db_delete('commerce_card_data')
        ->condition('card_id', $card_data['card_id'])
        ->execute();
    }
    return TRUE;
  }
}