I'm using Ubercart Atos/Sips Credit Card payment with ubercart 2.2 and mercanet (bnp paribas services)
For some of my orders, when the user come back grom the banks site, everything is fine, I get this in the order comments:

In checkout		Order paid via website with Ubercart ATOS/SIPS
Pending		The user came back from the bank site and validated the payment with ATOS/SIPS

And this is the admin comments

The stock level for CD1387 has been decreased to 35.
Order created through website.

But for other orders, I think that the user don't click on the return button, I get this in the order comments:

In checkout		Order paid via website with Ubercart ATOS/SIPS

And this is the admin comments

This order has no admin comments associated with it.

Does someone see where things could be wrong ?
thanks

Comments

eme’s picture

Simple : some clients come back from the store, clicking on "back to the store" (retour à la boutique), and then the order is validated.

But the order is not validated for the others that do not come back. This is a huge issue.

Are you using 3D Secure? Cause everything worked well till I went to 3D Secure : then there is no "autoresponse" : you have to come back to validate, which is not an excellent thing...

hades666evil’s picture

To solve this issue I've added
uc_cart_complete_sale($order);
Just after
uc_payment_enter($order->order_id, 'atos', $response['amount'] / 100, $user->uid, array('authorisation_id' => $response['authorisation_id'], 'autoresponse' => $autoresponse), $message);

And removed
uc_order_update_status($order->order_id, uc_order_state_default('post_checkout'));

Then, the order is set to "payment received" immediately, the stock is decreased, but to not have a double stock decreasing (same issue for paypal IPN), in conditionnal actions, under the "Customer completes checkout" Trigger, for each predicate, I check that the order status is "In checkout".
Because if not, when the customer return to the shop by clicking on the return button from the payment form, the order is recompleted.

eme’s picture

But if I understand well, it means that your stock will be decreased even if the customer eventually do not pay. And your order is officially validated even if it is not paid... How do you know if it has been really paid?

So I'll go to your shop and validate averything but the payment on the bank server!

hades666evil’s picture

at this state, the payment is considered as validated, isn't it ?
All checks are done above :

function _uc_atos_complete_order($autoresponse = FALSE) {
  //We check that the bank accepted the payment
  //...
  //We simply check that the order exists
  //...
  //To differentiate several payments, we need the authorisation_id
  //...
  //We check that, for this order, there isn't already a paiement
  //...
  /** All seems ok, we save the payment info. **/
  //Saving the payment
  //...
  uc_payment_enter($order->order_id, 'atos', $response['amount'] / 100, $user->uid, array('authorisation_id' => $response['authorisation_id'], 'autoresponse' => $autoresponse), $message);
  uc_cart_complete_sale($order);
eme’s picture

I'll study this as I have a similar issue. I would say that your method has drawbacks.

I'll tell you more later on.

eme’s picture

Well it seems your are entirely right : you spotted the right line. Indeed the order is definitely validated at this stage.

About your double decreased stock, I understand the issue : your order is validated twice : once when the user is back to cart/checkout/complete and once with you calling uc_cart_complete_sale($order) with the autoresponse.

One interesting thing with your way is that by calling uc_cart_complete_sale($order) you create the user associated to the order if the user do not exist, which is not the case I think with the other way. We'll have to check what is triggered when this function is called twice (which is not normal, but I think it is fine).

Is it all right for you? I mean do the customer goes back to cart/checkout/complete or do they land on just cart?

See also http://drupal.org/node/338079, which would be related to this.

hades666evil’s picture

My website is running, and everything seems to go well
About the user account creation, I can't really tell about what is going on because I don't allow unregistered user to order

anrikun’s picture

Status: Active » Closed (duplicate)