How can I make a robust payment received rule?
I created a new order 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).