I keep getting the following after processing the payment. Any ideas what could be going wrong? I've tried it on two installations and have the same on both. Is it regarding the details that need to be captured i.e billing details or such, or something else?

"Notice: Undefined index: payment_details in commerce_payment_order_transaction_add_form_validate() (line 197 of ...sites/all/modules/commerce/modules/payment/includes/commerce_payment.forms.inc).
An invalid WorldPay payment method choice was recived. Please try choosing a payment method again."

CommentFileSizeAuthor
#9 DRAFT-Issue-1569386.patch2.72 KBmagicmyth
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

magicmyth’s picture

Thanks for the report. Could you give me some details on your configuration in the Drupal Commerce payment configuration page for this method? E.g. are you using "Select payment method localy" or not?

FilipNest’s picture

Thanks for looking into it, here are the configuration settings on the payment page:

Installation ID: included
Debug mode: screen
Log notifications with the full WorldPay Pyament Notifications during validation and processing (used for debugging).
Payment methods: all checked
Enable test mode: checked
Test mode result: authorised
Submit the cart contents as the order description: unchecked
Cancel order in Commerce if cancelled during payment: unchecked
Enable editing of contact details on the WorldPay's payment page: unchecked
Show the contact details on the payment page: unchecked
Language: en-GB
Use WorldPay installation password? Yes
urls:
https://secure-test.worldpay.com/wcc/purchase
https://secure.wp3.rbsworldpay.com/wcc/purchase
Use SSL for payment notifications: unchecked
Force http (non-ssl) return links: unchecked

I have played around with various options for the above but always seem to get the same message. Anything I can do on a clean site install to troubleshoot?

magicmyth’s picture

Do you have the Billing profile disabled on the checkout process? I currently have a hard dependency on that field and the addressfield in it. I can likely in the future make it function soundly with the addressfield (commerce_customer_address) removed but I'm not sure about the billing profile field at this time because I don't know what dependency Drupal Commerce might have on it itself. But hopefully removing that dependency will be safe as well. I won't be trying that for at least a couple of weeks though so patches welcome all ;)

FilipNest’s picture

I have Billing Profile enabled. It includes one field, the addressfield, with name First Name, Last Name and Address form (country-specific) ticked. United Kingdom is the default. Is that how it should be configured for this?

magicmyth’s picture

That all sounds perfectly fine. I just tested with the address field set to use the two separate name fields (using a registered and anonymous user) and did not receive that notice. What version of Drupal Commerce do you have installed?

I'm guessing that for some reason on your setup commerce_payment_order_transaction_add_form_validate() does not have $form_state['values']['payment_details'] set.

Blue_Jumpers_Filip, could you do me a favour? In commerce/modules/payment/includes/commerce_payment.forms.inc in function commerce_payment_order_transaction_add_form_validate() change:

    if ($callback = commerce_payment_method_callback($payment_method, 'submit_form_validate')) {
      $callback($payment_method, $form['payment_terminal']['payment_details'], $form_state['values']['payment_details'], $order, array('payment_details'));
    }

To:

    if ($callback = commerce_payment_method_callback($payment_method, 'submit_form_validate')) {
      debug($form_state['values'], "commerce_payment_order_transaction_add_form_validate: $callback values");
      $callback($payment_method, $form['payment_terminal']['payment_details'], $form_state['values']['payment_details'], $order, array('payment_details'));
    }

Then when you are on the payment redirect page could you attach the output of the debug section please? You may want to edit it first to remove sensitive information like the WorldPay password.

Thanks

FilipNest’s picture

Thank you. I'll give it a go. First of all I'll install it on a clean site install and the latest version of commerce and this module just in case that fixes things itself. I'll do that in the next hour or so.

magicmyth’s picture

I just noticed you did not mention whether you have: "Select payment method localy" checked. I've just tried with it disabled and got the following:

Notice: Undefined index: payment_details in commerce_payment_pane_checkout_form_validate() (line 150 of /home/magicmyth/webapps/drup/sites/all/modules/contrib/commerce/modules/payment/includes/commerce_payment.checkout_pane.inc).
An invalid WorldPay payment method choice was recived. Please try choosing a payment method again.

Weirdly the issue of the undefined index is in a different place but that may be because I already had been through but cancelled the checkout with that anonymous session.

Anyway seems I broke the functionality at some point for when the payment method is chosen on WorldPay. I'll take a quick look at that.

FilipNest’s picture

You've spotted it. Just ran through another install with the same settings and got the same error, was about to do the forms.inc change and then noticed your post. It was the Select payment method localy checkbox that triggered it. The payment now goes through when it's checked.

magicmyth’s picture

FileSize
2.72 KB

I'm attaching a quick patch that should make the process work for you when payment method selection is not local. Pull the latest git commits and then this patch should apply cleanly. Note that I am getting the following error messages with this patch:

Notice: Undefined index: payment_details in commerce_payment_pane_checkout_form_validate() (line 150 of sites/all/modules/contrib/commerce/modules/payment/includes/commerce_payment.checkout_pane.inc).
Notice: Undefined index: payment_details in commerce_payment_pane_checkout_form_submit() (line 190 of sites/all/modules/contrib/commerce/modules/payment/includes/commerce_payment.checkout_pane.inc).

Need to figure out why payment_details is not set when 'pm_select_localy' is not set. A quick scan through the code does not reveal anything else that would be influenced by that setting. I can't look at that till later now.

Thanks for helping Blue_Jumpers_Filip.

Adam

magicmyth’s picture

Assigned: Unassigned » magicmyth
magicmyth’s picture

Since we seem to have two separate but related issues here I have created a new issue (#1598338) for the failure of non-local payment method selection.

hadsie’s picture

This is probably fixed now in the latest dev version of commerce, see #1705862: Notice: Undefined index: payment_details in commerce_payment_pane_checkout_form_submit()

rszrama’s picture

Status: Active » Closed (duplicate)