You are here

function commerce_authnet_cim_cardonfile_delete in Commerce Authorize.Net 7

Card on file callback: deletes the associated customer payment profile.

1 string reference to 'commerce_authnet_cim_cardonfile_delete'
commerce_authnet_commerce_payment_method_info in ./commerce_authnet.module
Implements hook_commerce_payment_method_info().

File

./commerce_authnet.module, line 1448
Implements Authorize.Net payment services for use in Drupal Commerce.

Code

function commerce_authnet_cim_cardonfile_delete($form, &$form_state, $payment_method, $card_data) {

  // Extract the Customer Profile and Payment Profile IDs from the remote_id.
  list($cim_customer_profile_id, $cim_payment_profile_id) = explode('|', $card_data->remote_id);

  // Fetch the response from the API server and let Card on File know that the
  // delete was either successful or not necessary.
  $xml_response = commerce_authnet_cim_delete_customer_payment_profile_request($payment_method, $cim_customer_profile_id, $cim_payment_profile_id);
  $code = (string) $xml_response->messages->message->code;
  return in_array($code, array(
    'I00001',
    'E00040',
  ));
}