I have a shop supporting multiple payment methods, e.g. uc_credit module and PayPal Express Checkout. I ran into a problem where the uc_paypal_ec_submit_form_submit() function was been executed whenever the uc_cart_checkout_review_form form was submitted - even if Express Checkout was not chosen as the payment method! This caused it to send the DoExpressCheckoutPayment nvp request to PayPal, which obviously failed, as no payer id, etc was present in the request.

The attached patch changes it so that the ec submit handler is only added to the list of submit functions if the payment method chosen was "paypal_ec".

CommentFileSizeAuthor
paypal_multiple_payment_methods.patch817 bytesstella

Comments

Status: Needs review » Needs work

The last submitted patch, paypal_multiple_payment_methods.patch, failed testing.

longwave’s picture

Status: Needs review » Needs work

What about !empty($_SESSION['TOKEN'])? The code should be skipped if there is no PayPal token in the session.

(although admittedly that's a bad choice of variable name, it should be namespaced)

longwave’s picture

Status: Needs work » Needs review

The last submitted patch, paypal_multiple_payment_methods.patch, failed testing.

stella’s picture

What about !empty($_SESSION['TOKEN'])? The code should be skipped if there is no PayPal token in the session.

(although admittedly that's a bad choice of variable name, it should be namespaced)

I must have another session variable with the same name, or maybe it's not being unset from an earlier transaction? In any case that code was definitely being triggered, drupal_set_message()s confirmed it.

Don't know why this keeps failing on the testbot.

longwave’s picture

Version: 6.x-2.7 » 6.x-2.x-dev
Status: Needs work » Needs review

Not sure testbot works properly on fixed point releases.

longwave’s picture

longwave’s picture

Status: Needs review » Closed (cannot reproduce)

Unable to reproduce this, and nobody else has reported it, so I suspect this was particular to your exact setup.