I believe there's a small issue with the payment module that triggers this error on some payment methods. When I checkout using commerce_no_payment module the error is triggered, and after a quick google it seems that module is not alone:

* #1230666: Creating transactions throws undefined index for payment details
* #1670752: Notice: Undefined index: payment_details in commerce_payment_pane_checkout_form_submit()
* #1646096: Undefined index: payment_details in commerce_payment_order_transaction_add_form_validate()
* #1569386: Notice: Undefined index: payment_details

This code assumes that $pane_values has a 'payment_details' value set, which seems to not be the case always.

        if ($callback = commerce_payment_method_callback($payment_method, 'submit_form_submit')) {
          // If payment fails, rebuild the checkout form without progressing.
          if ($callback($payment_method, $pane_form['payment_details'], $pane_values['payment_details'], $order, $balance) === FALSE) {
            $form_state['rebuild'] = TRUE;

The attached patch simply sets that value as needed. Not sure if it has other implications but it's no longer generating the PHP notice for me and all seems to be working fine with commerce_no_payment.

#2 commerce_payment_1705862-1.patch984 byteshadsie
PASSED: [[SimpleTest]]: [MySQL] 3,589 pass(es). View
#1 commerce_payment_1705862.patch986 byteshadsie
PASSED: [[SimpleTest]]: [MySQL] 3,589 pass(es). View
Members fund testing for the Drupal project. Drupal Association Learn more


hadsie’s picture

986 bytes
PASSED: [[SimpleTest]]: [MySQL] 3,589 pass(es). View
hadsie’s picture

984 bytes
PASSED: [[SimpleTest]]: [MySQL] 3,589 pass(es). View

Sorry, the above patch does nothing... I'd commented out the only line that does anything for testing :). Anyway, this patch should actually do something.

rar’s picture

Worked for me to get rid of the error message. Nice job.

rszrama’s picture

Status: Needs review » Fixed

Good catch. I've fixed this with a slightly different approach - basically initializing the payment details array in the $pane_values array if it doesn't exist yet:

  // Initialize the payment details array to accommodate payment methods
  // that don't add any additional details to the checkout pane form.
  if (empty($pane_values['payment_details'])) {
    $pane_values['payment_details'] = array();

Commit: http://drupalcode.org/project/commerce.git/commitdiff/a1021f4

Status: Fixed » Closed (fixed)

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

rszrama’s picture

And just did the same for the validate callback.

Commit: http://drupalcode.org/project/commerce.git/commitdiff/ce87876