Can't get to review page.

Project:UC Test Payment
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:fixed
Description
Project: 
Save for Later

I'm testing our ubercart module and I can't seem to get to the review page. Every time I hit the check out button and the button of the page I get this error "To protect our customers from identity theft, credit card details are erased when a browser refreshes on the checkout review page. Please enter your card details again and re-submit the form." I have tried everything. I have updated to the latest module. I have tried disabling almost everything. In my reports, I'm getting this error 3 times anytime someone tries to click the checkout button. (image of error attached) I have spent all day trying to figure this out with no luck. I have tried both Test Payment gateway and authorize.net. Nothing is working.

There's this block of code in the uc_credit module that is stopping me. If I comment it out, I get to the review page but none of credit card details are getting passed to the page. I believe the $_POST['sescrd'] is never getting populated, but I dont know where/how to fix it.

if (isset($_SESSION['cc_pay']) && !isset($_SESSION['sescrd']) && empty($_POST['sescrd'])) {
// Send them back to the checkout form to put in their details again.
drupal_set_message(t('To protect our customers from identity theft, credit card details are erased when a browser refreshes on the checkout review page. Please enter your card details again and re-submit the form.'), 'error');

$_SESSION['clear_cc'] = TRUE;
unset($_SESSION['cc_pay']);
drupal_goto('cart/checkout');
}

Version: 
Ubercart 2.x-dev
PreviewAttachmentSize
Screen shot 2010-08-16 at 11.46.15 AM.pngScreen shot 2010-08-16 at 11.46.15 AM.png36.43 KB
bradjmsu's picture
Offline
Joined: 03/25/2011
Juice: 14
#1
Status:active» patch (needs review)

I found a way around this problem. I think the issue is with the encryption. In sites/all/modules/ubercart/payment/uc_credit you need to modify the encryption functions. At around line 534 you will find a line of code that reads:
$_SESSION['sescrd'] = $crypt->encrypt($key, serialize($order->payment_details));

Change this to:
$_SESSION['sescrd'] = base64_encode(serialize($order->payment_details));

(I know, its less secure, but it WORKS)

Then around line 1284 look for:
$cc_cache = unserialize($crypt->decrypt($key, $data));

Change this to:
$cc_cache = unserialize(base64_decode($data));

and it should work for you.

NOTE: These are not exact line numbers. I have debugging code commented out in my code, so you will have to look for the specific code that I indicated above.

Message me if you need any more help.

Brad
Beautiful Bridal Jewelry

ehudash's picture
Offline
Joined: 10/27/2009
Juice: 10
#2

Same issue here.
bradjmsu's workaround did resolve the issue.
Is this also relevant to the other gateways (real cc gateways, not just test gateway)?
If so I hope this will this be submitted as a fix to the module in the next version.

Regards,
Ehud Ashkenazi

bradjmsu's picture
Offline
Joined: 03/25/2011
Juice: 14
#3

Ehud,

I tested this with Authorize.net and I don't seem to be having any problems with it. I have seen some successful conversions so I assume there are no existing issues with the solution.

Brad
Web Development Blog

torrance123's picture
Offline
Joined: 04/10/2011
Juice: 5
#4

If it helps anyone, I had this problem and the issue turned out to be that the uc_encryption_class was borking on a hidden newline character at the end of the file uc_credit.key. Removing this resolved my issue. It would seem to me that a patch for the uc_encryption_class that ignores white space characters etc. would help.

Also, there's an error property as part of the uc_encryption_class (eg. $crypt->error) that you can investigate for clues as to why the encryption is failing. Note that error is a property, not a method as the documentation suggests.

dmsky's picture
Offline
Joined: 04/25/2011
Juice: 6
#5
Priority:critical» normal
Status:patch (needs review)» fixed

i also had this problem, & i didn't want mess around with the modeule source code...i eventually found the found the culprit in the Payment Settings area

In the Credit Card Settings (Choose Payment Methods >> Payment Settings >> Credit Card Settings), and look to the Card Type Select Box Options -switch this field to PLAIN TEXT, and get rid of all the HTML tags, and save.

Problem solved!