9 replies [Last post]
bob-hinrichs's picture
Offline
Joined: 09/08/2008
Juice: 5
Was this information Helpful?

We ran into a problem where we were running through orders in a batch (for payment processing) and the static $cc_cache variable in uc_credit_cache was returning the result of the credit card of the first order of the batch. I am not sure of the fix for this other than removing the static designation from the variable.

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: uc_credit_cache assumes no batch processing of orders

Hmm... I haven't heard of such batch processing... perhaps you shouldn't be using that function? The whole idea is that the CC data for a card should persist in there, hence the static designation.

hinrichsislcocom's picture
Offline
Bug Finder
Joined: 05/28/2008
Juice: 92
Re: Re: uc_credit_cache assumes no batch processing of orders

Thanks Ryan (BTW you are awesome for responding so well to everyone here, it is great for your software). To clarify, we have a remote fulfillment house; we use the cron hook to load up a list of submitted orders; for each order found, re run uc_order_load to populate the info, we charge the sale using uc_payflowpro_charge, and if successful, send it to the fulfillment house's web services. The cc_cache('load') gets called while order_load occurs and the uc_credit module loads up the payment_details. So we have found, if you have a list of orders you are loading to process in sequence within a single process, the cache does not get updated.

I think there is an easy solution, but I just wanted to add this to the forum since it seems to be a possible gotcha--it took some time unraveling why all of our customers had the same credit card information while our batch was running.

Bob Hinrichs
ISL Consulting
http://www.islco.com

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Re: Re: uc_credit_cache assumes no batch processing of order

Ahh, I see. Yeah, that is a problem and should be fixed in core. At the very least, I imagine running this line before the next order should solve it:

<?php
  uc_credit_cache
('save', array(), FALSE);
?>

But maybe I should add in a 'clear' $op just to make it explicit.

hinrichsislcocom's picture
Offline
Bug Finder
Joined: 05/28/2008
Juice: 92
Re: Re: Re: Re: uc_credit_cache assumes no batch processing of o

Thank you Ryan, it works perfectly. As always Ubercart is the best-supported e-commerce platform out there.

After encountering this, based on the confusion of order_load containing another order's info, I wonder if cc_cache could return the cache based on some key. Maybe $cc_cache is key=>value? Hmm...since it looks like that function is made to return its value with minimal params (e.g. just 'load'), maybe there could be another static var holding the "current" order's id, which is set when order ops are called? Or, if the "current" order's id has changed, it sets a flag for any cacheable functions to automatically reset static values?

Just brainstorming there, thinking that perhaps the uc_credit's method of caching could have further application in UC.

Bob Hinrichs
ISL Consulting
http://www.islco.com

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Re: Re: Re: Re: uc_credit_cache assumes no batch processing

Thanks for your encouragement. Smiling

Re: the func - that was my alternate thought that I didn't post... allow you to pass in an $order_id and cache based on that. I've bookmarked this and will try to revisit it when I polish up the 1.4 release next week.

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Re: Re: Re: Re: Re: uc_credit_cache assumes no batch process

For now, I decided to just add an explicit 'clear' $op to uc_credit_cache() so as to not affect the API. This simple change won't require the amount of testing that a more robust change would take. Trying not to break too much in these minor releases. Laughing out loud

This will be in the 1.4 release.

herchenx's picture
Offline
Joined: 12/09/2008
Juice: 37
Re: Re: Re: Re: Re: uc_credit_cache assumes no batch processing

Bob, you accomplished precisely what we are beating our heads against the wall to do.

A few questions, if you have a moment?

uc_payflowpro_charge - unless I am mistaken this is in uc_payflowpro - which looks like it has either been abandoned or is in indefinite testing. Can you verify that this is the module you are using?

Are you just using the built-in functionality (not uc_payflowpro) of ubercart's uc_paypal module to authorize only, keeping the site in debug mode to store the credit card info, and then calling the uc_payflowpro_charge function of uc_payflowpro?

Any guidance would be very helpful. I have been wary of trying to install uc_payflowpro but it may be necessary.

Thanks a lot.

John

luketarplin's picture
Offline
Joined: 04/26/2010
Juice: 187
Same problem as bob-hinrichs with batch processing

Hi, I wonder if anybody could shed some light on a problem or help steer me in the right direction. I have a similar problem with Ubercart 2.x as the original poster of this forum. I am looking up recent orders for a user and iterating through the results, the problem is that the $order-payment_details are not the details for the actual order but appear to be cached to the latest order. After some digging around I found this forum and have determined that the function uc_credit_order is causing this behaviour as it is looking for cached credit details on load. When I comment out '$arg1->payment_details = uc_credit_cache('load');' in the uc_credit_order function it works as expected. I wondered if there was a setting or a way to disable this particular cache lookup? Regards Luke

michaelm111's picture
Offline
Joined: 05/15/2012
Juice: 3
uc_credit_cache and recurring module

Has anyone found a permanent fix for this? We're running into the same problem when running recurring batch and new orders that are generated have the wrong credit card details. Any suggestions are appreciated.