{ "rules_update_order_status" : {
    "LABEL" : "Update status test",
    "PLUGIN" : "reaction rule",
    "REQUIRES" : [ "commerce_order", "commerce_payment" ],
    "ON" : [ "commerce_payment_transaction_insert" ],
    "DO" : [
      { "commerce_order_update_status" : {
          "order" : [ "payment-transaction:order" ],
          "order_status" : "completed"
        }
      }
    ]
  }
}

This rule seems to break the redirect when a successful payment returns... in my case I used paypal.

I get stuck on http://mysite.com/checkout/174/payment/return/5nlFpPZ6uwXeCyyGFg9d41j28d...

Comments

rszrama’s picture

Indeed. We'll need to document when and how to update order statuses. During the checkout process, access to particular pages is based on your order status... but it could be that the order save is what's actually causing the page to get stuck there. I think a better practice would be to allow checkout to complete and then make any checks upon checkout completion before updating the status further.

I suppose I should've asked for more information before recommending these events to you, but I don't think I'd considered the implications for timing. The problem you're having is that the IPN comes in before you actually visit that page and updates the status so that when you return the only valid URL would be checkout/174/complete instead of the payment URLs. So, what we need is for you to use the "Customer completes checkout" event and check the order balance at that point in time to see if the order has been paid in full.

To resolve this issue, I believe we need to document order status updates during checkout and add Rules support for checking the balance of an order (and maybe more Payment integration... it's pretty sparse right now).

roam2345’s picture

Got all my stuff working to night and launched the site.. This was one of the rules I was playing with and came across this.. So I'm not dependent on it. Also to note on some occasions it works. So their might also be some race thats happening here two.

In many cases I have tried on rules on the transaction save event if I did any data comparison or check before applying the action same scenario happened. But even though the redirect on the return page got stuck the rule completed.

PS: I crated custom action to check the transaction was successful and adding the keys off that. I used and order as the rules argument. Placed it on the checkout completes event and works like a dream from there.

damien tournoud’s picture

Category: bug » support

This is not actually a bug.

rszrama’s picture

Status: Active » Closed (works as designed)

And as it turns out, we actually added in an event after the initial support request to execute rules "When an order is first paid in full." That's the event to use now when you want to update the order status based on full payment.