After updating to the newest release of commerce_authnet, I got the following errors on checkout:

Notice: Undefined index: card_types in commerce_authnet_aim_submit_form() (line 280 of /.../sites/all/modules/commerce_authnet/commerce_authnet.module).
Warning: array_values() expects parameter 1 to be array, null given in commerce_authnet_aim_submit_form() (line 280 of /.../sites/all/modules/commerce_authnet/commerce_authnet.module).
Warning: array_diff(): Argument #1 is not an array in commerce_authnet_aim_submit_form() (line 280 of /.../sites/all/modules/commerce_authnet/commerce_authnet.module).

After editing the AIM payment settings and clicking Save without modifying anything, it the warnings are then suppressed. It looks like commerce_authnet_aim_submit_form() assumes that the 'card_types' index is available in the payment gateway settings without checking first.

I did not verify, but would assume this is easy to reproduce on a new site by enabling the AIM payment gateway without first editing the settings and then attempting checkout.

Comments

dwkitchen’s picture

Version: 7.x-1.0-rc1 » 7.x-1.x-dev
Assigned: Unassigned » dwkitchen
Status: Active » Fixed

I have changed the lines to:

  // Add the credit card types array if necessary.
  if (isset($payment_method['settings']['card_types'])) {
    $card_types = array_diff(array_values($payment_method['settings']['card_types']), array(0));

    if (!empty($card_types)) {
      $fields['type'] = $card_types;
    }
  }

so it will check if the card_types has been set first.

This will be in the next dev release and then in the 1.1 release.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.