RESOLVED - Completing the checkout process not firing
Looking for a little advice on where to start debugging a problem that just cropped up. For some reason, it seems as though the "Completing the checkout process" isn't firing in rules. Other rules related to calculating the sale price of an item and payments are firing. Same behavior whether user is registered or anonymous. I am currently testing with commerce_paypal as the only payment method. Commerce 7-x-1.0, commerce_paypal 7.x-1.x-dev, rules 7.x-2.0. I do have rules logging enabled.
UPDATE: The rule does fire when using the example payment method. If I remember correctly, the commerce_paypal module updated recently. Hmmmm...
UPDATE #2: reverted back to an older version of commerce_paypal. No luck. I swear this used to work... At least I'm pretty sure... Or was that back when I was testing with no payment method enabled? Perhaps I'll head over to the commerce_paypal project page and post about the issue there.
UPDATE #3: OK, so that's what I get for trying to debug too late at night. Turns out I had a rule that was setting the order to "Complete" when the IPN payment notification rolled in. Problem was, the IPN notification was beating the user back to the website, therefore, the checkout was never being interpreted as complete. As a result, the "Completing the checkout process" condition was never met, so the rule never fired. Haven't dug into the code deep enough to see why exactly this happened, but the behavior was somewhat unexpected. Now I'm not sure how to go about marking an order as "paid" in using a Rule without upsetting the process. Any ideas?
Thanks in advance
Matt
Traverse City, MI
Comments
Commerce PayPal Issue
Have you updated to the latest release of commerce_paypal? Could this (recently fixed) issue be affecting the process: http://drupal.org/node/1130166?
Thanks for the input, but I'm
Thanks for the input, but I'm not sure my issue was related. It seems as though that by changing the order status using a rule when an IPN notification was received was causing the problem. The IPN notification was returning basically immediately after completing payment at Paypal, whereas the "Completing the checkout process" wasn't being evaluated until the the user returned to the website some ten seconds after the IPN arrived. Something about changing the order status prevented the rule (as far as I could tell) from being processed at all, i.e. it wasn't even being evaluated.
Crazy busy with the holiday (I'm currently immersed in the insanity of too many kids and dogs at my sister's house for T-day dinner), but hope to look into this more when life calms down a bit. Figure I'll have a couple weeks before the Christmas silliness takes over...
Matt
Glad I found this post -
Glad I found this post - thanks! I can confirm the exact same issue.
I had created a couple of rules to mark the order status as payment type - but as you say, the payment notification from either Paypal WPS or SAGE pay were stopping the account creation.
Disabling those rules fixed the issue.
I haven't had a chance to try yet - but I was thinking if those custom rules fired on 'checkout completion' - set to fire after the account creation rule this would work? We'd probably also need another condition to check order balance is 0 rather than the on first payment.
Agreed
spoonbow,
I had exactly the same problem as the OP.
I had a rule that triggered on 'When balance paid in full' would change the status of the order to 'Processing'. Just so the shop admin could see the orders in different states.
The problem was when payments were being put through Paypal WPS; accounts and emails were only being sent intermittently. Things seem to work on staging and on live it was sometimes failing.
The rules that used 'Completing the checkout process' were not triggering.
Anyway, disabling my rule that changed the status of the order fixed this.
Lesson learn - don't mess with my Order statuses :-)
Cheers,
Amarjit
Created an issue
I created [an issue for this](http://drupal.org/node/1460964) over in the Commerce Paypal queue.
Thanks so much for the detailed study of the problem. I just wish we had this in the issue queue before now. At least there's no mention of another issue I could find.
Had same issue for SagePay module
So I looked at the patch that was defined here for the PayPal WPS module here:
http://drupal.org/node/1130166#comment-4813116
Many thanks guillaumev!
The critical lines to add to your payment method module at successful transaction are the following:
$order = commerce_order_status_update($order, 'checkout_complete');
commerce_checkout_complete($order);
in my case in commerce_sagepay_direct.module I added the following to function commerce_sagepay_direct_transaction
switch($transaction_status){
case 'OK':
$transaction->status = COMMERCE_PAYMENT_STATUS_SUCCESS;
+ $order = commerce_order_status_update($order, 'checkout_complete');
+ commerce_checkout_complete($order);
break;
default:
$transaction->status = COMMERCE_PAYMENT_STATUS_FAILURE;
}
IPN issues
you might also want to turn on the debugging for payments with PayPal. My site wasn't firing the checkout completion because the emails between the sandbox and live PayPal wasn't the same email. Sandbox chekouts worked fine, live payments didn't.
The IPN was rejected because the emails didn't match. I never would have caught it without debugging on so I could see it in the logs.
TouchNet same problem
Just wanted to thank this thread, I had the same issue for my CC processor TouchNet. I had to add these to the payment method module:
$order = commerce_order_status_update($order, 'checkout_complete');
commerce_checkout_complete($order);
And things finally started to fire correctly. Thanks!