Download & Extend

Authorize.net doesn't charge card unless...

Project:Ubercart Optional Checkout Review
Version:7.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs work

Issue Summary

I found a solution for a problem I've had.

I'm using the uc_authorizenet module that comes with ubercart inconjunction with uc_optional_checkout_review.

On submission of cart/checkout page the "uc_authorizenet_charge" function wasn't be called from uc_credit_uc_order and just redirecting to complete page; however, uc_authorizenet_charge would be called if you enter in some wrong credit card details first. Then when you corrected the data it would all work.

The problem I found to the problem was in uc_optional_checkout_review_uc_cart_checkout_form_submit().
The line causing the problem was "$order = uc_order_load($_SESSION['cart_order']);"
This was sending over the $order without $order->payment_method being set.
My guess is that the order in $_SESSION wasn't updated yet from the form submission yet like it would be if you went to the review page.

The solution was to replace "$order = uc_order_load($_SESSION['cart_order']);" with "$order = $form_state['build_info']['args'][0];"
This way the $order object was the object that was modified right before from the checkout_form_submit function, which had the right fields set. Everything worked after that.

I also needed a line earlier not to get an error that someone else has posted...
if (module_exists('uc_credit') && isset($_SESSION['sescrd'])) {
$_POST['sescrd'] = base64_encode($_SESSION['sescrd']);
}

I hope this helps someone else.

Comments

#1

Definitely helps...

#2

Priority:critical» normal
Status:active» needs work

Is this with Authorize.net's "silent post" (IPN) method?

Can you post a patch, or a copy of your uc_optional_checkout_review.module?

Thanks

#3

While cleaning the queue, found:

* sescrd issue duplicates #1519042: Notice: Undefined index: sescrd in uc_credit_cart_review_pre_form_submit()

* "$order = uc_order_load[...]" issue duplicates #1594650: Warning: Missing argument 3 for uc_cart_checkout_review_form()

Can you confirm?

Thanks