Jump to content

gateway page refresh issues


Guest tehgreedo

Recommended Posts

Guest tehgreedo

My client is using a gateway that uses an iframe. There's no "use another gateway" or "don't use an iframe" option for us. This is the reality of it and we're trying to make it work.

On checkout, if you're patient, everything works perfectly and the iframe loads. However, if you hit "refresh" while on the gateway page, you get the following screenshot:

c4rKE.png

We've removed the button to move forward because we didn't want people able to use the incorrect checkout page. The side effect of them being on this page is that there's no way to move forward. If they hit the "back" button it takes them back to their cart page... seems all well and good, except that in the admin the order is now set as "processing."

I can't for the life of me find where it's setting it as processing without going through the gateway. I'd like to totally eliminate the ability to hit this page... even if it means losing the cart, i'd like to redirect them somewhere else if they hit refresh. Everything I try just seems to break what's already there.

Any ideas on what's causing this weirdness or how to get around that page?

If anybody wants to check it out, please use the following link to use our test product so as to not skew any reporting:

link

Thanks!

-Given

Link to comment
Share on other sites

Guest tehgreedo

Why use an iframe and not a proper integrated module? Which payment provider are you using?

Optimal Payments. And it's got a gateway module. The reason we're using the iframe is because they got it in their head that if we give the credit card info directly to the gateway and doesn't get stored in the system it would be better for them. So we have what we have. It opens an iframe to the gateway, we pass some basic info through the iframe to the gateway, they handle the credit card info and basically return a "yes" or "no" and we act accordingly.

We've tried to talk them into using something else and they won't. That being said, the iframe part isn't the issue (surprisingly), it's that you can get somewhere you shouldn't be by refreshing a page and then hitting "back" puts the order into processing without ever putting in any payment info.

-Given

Link to comment
Share on other sites

Guest tehgreedo

What I ended up using is fairly "hacky" but effective.

Basically I went into the order class (/classes/cart/order.php) and edited the orderStatus function. Any time it tries to set the status to "2" (processing) it first checks to see if there's a transaction that goes with the cart id. If it does, it sends the email and sets the status to 2. This way the only way to get into processing is to have a successful payment through the gateway.

This is the code I used to check the transaction table:


$sql = "SELECT * FROM `".$glob['dbprefix']."CubeCart_transactions` WHERE `order_id` = '" . $cart_order_id . "' AND `status` LIKE '%ACCEPTED%' AND `notes` LIKE '%No Error%' LIMIT 1;";

$has_transaction = $db->select($sql);



$has_transaction is "false" if there isn't one, so I was able to use that as a flag in multiple places.





This may only pertain to Optimal, but I also discovered that I was still having issues because it was trying to set the status before saving the transaction (/modules/gateway/optimal/call.inc.php), so I moved the block that included 
$order->storeTrans($transData)
 to be above 
$order->orderStatus(2, $order_data[0]['cart_order_id']);

and that solved all my issues.

Cheers,

tehgreedo

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...