Hi,

I created a new state and status called Payment received. I set up a rule: when the order's first paid in full, update the order state to Payment received. I modified the checkout rule Update the order status on checkout completion to make sure that it didn't overwrite the state set in my new rule. To test the rule I used commerce_no_payment. The test fails because the event When an order is first paid in full is called before commerce_checkout_form_submit() which changes the order's state again (to checkout_payment, then checkout_complete).

I presume I can fix this behaviour by using a presave rule that checks the balance and order state, and if less than or equal to zero and in the pending state then change to payment received, but obviously this doesn't feel as neat as using When an order is first paid in full. I'd expect that most of the time the notification from my payment method will occur later than it does for commerce_no_payment, but I worry about assuming that (ie I'd like to have a system that could cope with an absolutely immediate payment notification).

Any suggestions?

Thanks for your time!

Comments

rszrama’s picture

Status: Active » Closed (fixed)

I'd probably just add a condition to the default checkout completion rule to not update the status if it had already been moved.

AndyF’s picture

Status: Closed (fixed) » Active

Thanks for such a quick reply! It's not the checkout completion rule (I've already added the condition - and then just plain disabled it) causing problems. The problem is there's a direct call to commerce_order_status_update() from commerce_checkout_form_submit(), which is being called after the event When an order is first paid in full. Does that make sense?!

Thanks again for your time,

Andy

rszrama’s picture

Status: Active » Closed (fixed)

Ahh, yeah, because it's going from page to page. Sorry, I got my fixes mixed up, but in your case I'd probably just change my rule to only update the order status to payment received if the order is no longer in a checkout status. Then I'd add a checkout completion rule to check the balance of the order and update the order status if it was $0.

This would be a good question for http://www.drupalcommerce.org/questions. Can you repost the question there and put a link here? I'll be happy to go repost my answer there.

AndyF’s picture

OK, that makes sense. And I've added a Q. Thanks again for the superquick support, and I'll post future questions to the Stack Exchange thingy you got going on :)

AndyF’s picture

Issue summary: View changes

bit of clarification