Re: Order status changes after batch capture on PayPal website
Quote:
Originally Posted by
Three Sisters
Oh wow - I totally missed your post! And have been too busy to check back... Sorry - didn't mean to appear so ungrateful.
Will try working on it Monday. (Tonight's too late, and tomorrow is crazy full.) I'll let you know how it goes.
Thanks heaps!
Well, I know it's rude to bump a post... :) But was definitely trying to provide assistance. Didn't think ungrateful, rude, or anything at all. Not knowing how many sales get processed, wanted to see that at least the code was available to attempt being processed if it was going to be used/tested/tried. All good on my side. In fact, only reason I'm responding is to let you know that all is good. :) And I guess to know if I should go to apply something similar elsewhere in the code.
Hope busy for because of the good things in life. I look forward to a yeah or neigh on it working.
Re: Order status changes after batch capture on PayPal website
OK - it's gonna take me a couple more days. I *was* super busy... Now I'm camping and there's not enough service here for me to do some of the work I planned to slip into this mini vacation. Oh well! Guess it's good to "un-plug" for a few days any how. :)
Will check back when I get home.
Re: Order status changes after batch capture on PayPal website
Quote:
Originally Posted by
Three Sisters
OK - it's gonna take me a couple more days. I *was* super busy... Now I'm camping and there's not enough service here for me to do some of the work I planned to slip into this mini vacation. Oh well! Guess it's good to "un-plug" for a few days any how. :)
Will check back when I get home.
Noooo problem. :) enjoy nature, wish you good weather.
Re: Order status changes after batch capture on PayPal website
Quote:
Originally Posted by
Three Sisters
OK - it's gonna take me a couple more days. I *was* super busy... Now I'm camping and there's not enough service here for me to do some of the work I planned to slip into this mini vacation. Oh well! Guess it's good to "un-plug" for a few days any how. :)
Will check back when I get home.
Quote:
Originally Posted by
mc12345678
Noooo problem. :) enjoy nature, wish you good weather.
Status?
Re: Order status changes after batch capture on PayPal website
Quote:
Originally Posted by
mc12345678
Status?
OK - Camping - done. International move - done. Now, back to work! :)
Very pleased to say that it worked perfectly. The change was breeze easy. The status remained the same ("complete - 5") after I captured the funds.
Thanks a million. I never would have figured out where and how to do that! I am really and truly thankful.
Re: Order status changes after batch capture on PayPal website
Quote:
Originally Posted by
Three Sisters
"...Very pleased to say that it worked perfectly."...
Well, sadly, I just found out my site lost the ability to do an express checkout with PayPal - or just any checkout with PayPal. Went back to the original ipn_main_handler.php and the problem is gone.
Any thoughts?
Re: Order status changes after batch capture on PayPal website
Forgive me, it was my fault. I was using a seldom used PayPal account and didn't realize the card on the account was expired. At the same time another customer's checkout failed, but that one was because of a processor decline. It was purely coincidental that both failed after the file change.
I've tested further and at this point, all appears to work perfectly. So, I thank you again!
Re: Order status changes after batch capture on PayPal website
Quote:
Originally Posted by
Three Sisters
Forgive me, it was my fault. I was using a seldom used PayPal account and didn't realize the card on the account was expired. At the same time another customer's checkout failed, but that one was because of a processor decline. It was purely coincidental that both failed after the file change.
I've tested further and at this point, all appears to work perfectly. So, I thank you again!
Sure?! :P
I do/did want to see that the reverse conditions also properly worked. That being, if in the sequence of working payments, etc. That if zc still had the item/purchase marked like pending and then the capture is done in paypal that the status does get updated like it is supposed to.
Scared me for a moment though. :)
Re: Order status changes after batch capture on PayPal website
Quote:
Originally Posted by
mc12345678
Not sure this is the location where this goes, but seemed like it. I haven't gone and done any test transactions, but looked like the right place.
So, if you open the ipn_main_handler.php located in the store's main directory go find (in ZC 1.5.1) line 454 that in this area looks like:
Code:
if ((int)$new_status == 0) $new_status = 1;
if (in_array($_POST['payment_status'], array('Refunded', 'Reversed', 'Denied', 'Failed'))
|| substr($txn_type,0,8) == 'cleared-' || $txn_type=='echeck-cleared' || $txn_type == 'express-checkout-cleared') {
and insert the following code the line below the one that ends with "-cleared') {":
Code:
//mc12345678 Start Override new_status
$sql = ("select orders_status from " . TABLE_ORDERS . "
where orders_id = '" . (int)$ordersID . "'");
$old_status = $db->Execute($sql);
if ($new_status < $old_status->fields['orders_status']) {
$new_status = $old_status->fields['orders_status'];
}//mc12345678 End Override new_status
Then if you test one transaction like you normally process or hope to prevent from occurring (from within PayPal whatever group transaction/processing that identified this situation) where the status of the order has already been bumped up to something past processing before the above test. (It may seem a little complicated for the setup, but...)
What the above is expected to do is, allow normal processing of an authorized payment, except if the calculated new order status (which if defined in the database is that value or a value of 2 I think is the default status) is less than the current status then basically the status is not updated. This is based on the principle that increasing order status is approaching a "final" desired state. There is no specific hard rule on that aspect, other than if you review the maximum and minimum values in some areas such as downloads and in the specific max/min area.
Let me know if that works for you. The assumption was that the paypal function ipn_update_orders_status_and_history is also called to make this happen in the setup that you have.. The code may need to go elsewhere; however, I'm not in a position to test those conditions.
Let me further state, test this at your own risk. I do not claim responsibility for any negative results. Ideally this could be done in a test environment rather than real payments...
Okay, since that worked, it would be good to add a little something, because this section of code applies to more than just the action you need it for. I haven't looked over the code more to see howmuch work it would be to separate this section out and to maintain the functionality, but I'm thinking that the code should look like this to ensure that all addressed functionality in this section will be maintained and that only the clearing process that has been a problem would stay changed as desired. So, the code should now look like this:
So, if you open the ipn_main_handler.php located in the store's main directory go find (in ZC 1.5.1) line 454 that in this area looks like:
Code:
if ((int)$new_status == 0) $new_status = 1;
if (in_array($_POST['payment_status'], array('Refunded', 'Reversed', 'Denied', 'Failed'))
|| substr($txn_type,0,8) == 'cleared-' || $txn_type=='echeck-cleared' || $txn_type == 'express-checkout-cleared') {
and insert the following code the line below the one that ends with "-cleared') {":
Code:
//mc12345678 Start Override new_status
$sql = ("select orders_status from " . TABLE_ORDERS . "
where orders_id = '" . (int)$ordersID . "'");
$old_status = $db->Execute($sql);
if ($new_status < $old_status->fields['orders_status'] && (substr($txn_type,0,8) == 'cleared-' || $txn_type=='echeck-cleared' || $txn_type == 'express-checkout-cleared')) {
$new_status = $old_status->fields['orders_status'];
}//mc12345678 End Override new_status
This way items that fit the status of any of the following:'Refunded', 'Reversed', 'Denied', or 'Failed' will be handled/downgraded as applicable. The additional code as compared to the previous is provided in red.
Re: Order status changes after batch capture on PayPal website
This is just a quick note to mention that after upgrading to 1.5.5d, I have the same problem again. I remembered dealing with this before, so I pulled up this old post and am applying the same fix again. Here's hoping all goes well as before!