Questions about Payment Form extension

Not receiving admin notification

More
10 years 11 months ago #31728 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Re: Not receiving admin notification
Hi Omar

To be honest, I don't have any clue about this. So maybe for now :

1. We will wait until the issue happens for the next registrant.

2. If this happens, please contact me immediately so that we can check the IPN history.

Will that be Ok ?

Tuan

Please Log in or Create an account to join the conversation.

More
10 years 10 months ago - 10 years 10 months ago #33220 by orware
Replied by orware on topic Re: Not receiving admin notification
Hi Tuan,

I have an update for you.

I finally asked the people that use the software if we could go ahead and buy it again so we could have access to the newest version for Joomla 1.5.

On Monday I performed the upgrade and did a bit of comparison with the PayPal plugin (it seemed like it had a few differences that might improve the situation) but then today (Thursday) the person that uses the software mentioned she hadn't received 2 out of the last 3 confirmation emails she should have received.

So I started doing some digging and figured out a few things.

One, the PayPal plugin refers to a ipn_logs.txt file which didn't exist so I created it manually and gave it the proper permissions.

A few minutes later someone had registered and the log was updated and the main thing I noticed was that it had timed out:
Code:
IPN Response from Paypal Server: HTTP/1.0 408 Request Time-out Server: AkamaiGHost Mime-Version: 1.0 Date: Thu, 11 Jul 2013 18:45:22 GMT Content-Type: text/html Content-Length: 218 Expires: Thu, 11 Jul 2013 18:45:22 GMT <HTML><HEAD> <TITLE>Request Timeout</TITLE> </HEAD><BODY> <H1>Request Timeout</H1> The server timed out while waiting for the browser's request.<P> Reference&#32;&#35;2&#46;9d9b1160&#46;1373568322&#46;0 </BODY></HTML>

So it would appear that sometimes the code returns the correct response and sometimes it just hangs and times out like in the example above (which would explain why sometimes we'll get the confirmations and sometimes we won't).

I did some research and came across this StackOverflow article:
stackoverflow.com/questions/8314064/payp...-with-feof-and-fgets

Which mentioned using stream_get_contents instead of the feof/fgets way currently being used.

That sort of worked, but the code on the above page needed a slight modification (the response from PayPal is longer than 1024 bytes so I needed to take out that parameter so the full response would get returned).

The other thing I changed was the use of the eregi function to JString::strpos instead.

After making these changes the timeouts seem to have gone away and the validation is successful and the confirmation emails get sent out.

Here's the modified _validate method:
Code:
function _validate() { $errNum=""; $errStr=""; $urlParsed = parse_url($this->_url); $host = $urlParsed['host']; $path = $urlParsed['path']; $postString = ''; $response = ''; foreach ($_POST as $key=>$value) { $this->_data[$key] = $value; $postString .= $key.'='.urlencode(stripslashes($value)).'&'; } $postString .='cmd=_notify-validate'; $fp = fsockopen($host , '80', $errNum, $errStr, 30); if(!$fp) { return false; } else { fputs($fp, "POST $path HTTP/1.1\r\n"); fputs($fp, "Host: $host\r\n"); fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n"); fputs($fp, "Content-length: ".strlen($postString)."\r\n"); fputs($fp, "Connection: close\r\n\r\n"); fputs($fp, $postString . "\r\n\r\n"); // Gets the entire response: $response = stream_get_contents($fp, -1); //while(!feof($fp)) { //$response .= fgets($fp, 1024); //} fclose($fp); } $this->ipn_response = $response ; $this->log_ipn_results(true); if ($this->_mode) { if ((JString::strpos($response, 'VERIFIED') !== false) && ($this->_data['payment_status'] == 'Completed')) return true; else return false; } else { return true ; //Always return true on testing to avoid bug from Paypal /*if ($this->_data['payment_status'] == 'Completed') return true ; else return false ; */ } }

I'll keep on monitoring to make sure it's a true fix, but it did seem to have an immediate effect so I'm hoping this will resolve the issue for us.
Last edit: 10 years 10 months ago by orware.

Please Log in or Create an account to join the conversation.

More
10 years 10 months ago #33240 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Re: Not receiving admin notification
Thanks orware! Please keep us updated with the result. Hope it will actually solve the issue you are having !

Tuan

Please Log in or Create an account to join the conversation.

More
10 years 9 months ago #33665 by orware
Replied by orware on topic Re: Not receiving admin notification
Hi Tuan,

We did run into the issue again even after my last fix...it seems like the Time-out issue with PayPal happens periodically for a variety of reasons that maybe I cannot control.

I went ahead and added on a bit more code on my end to detect if the response contains the time-out header, and if it does it will try a 2nd and 3rd time before failing...I'm hoping if it's a periodic issue then quickly trying a 2nd or 3rd time will help out so I'll keep my fingers crossed that this reduces the # of times we experience the issue.

Please Log in or Create an account to join the conversation.

More
10 years 9 months ago #33666 by orware
Replied by orware on topic Re: Not receiving admin notification
Hi Tuan,

Our user also noticed that when she adds in students manually now via the Backend that nobody gets sent a notification email (either the person she's manually registering for or the Admin Notification Email).

Is this by design or is this potentially a bug? She remembers it working with the previous version (when I implemented my PayPal fixes above I had just updated to the newest Joomla 1.5 version of yours).

If you have any quick suggestions I'd appreciate it!

Please Log in or Create an account to join the conversation.

More
10 years 9 months ago #33805 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Re: Not receiving admin notification
Hi

I am currently too busy preparing for new release of Events Booking. So if it is possible, please submit a support ticket and I will check the settings for you on Wednesday or lately Thursday ? Will that be Ok for you ?

Regards,

Tuan

Please Log in or Create an account to join the conversation.

More
10 years 6 months ago #37450 by jorman
Replied by jorman on topic Re: Not receiving admin notification
has anyone fixed this issue? I am having the same problem.

Please Log in or Create an account to join the conversation.

More
10 years 6 months ago #37550 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Re: Not receiving admin notification
Hi jorman

Issue like that my causes by Paypal IPN doesn't work on your Paypal account. Could you please login to your Paypal account, access to History -> IPN History to see whether there are any IPN message ? If there are, what are the status of the messages?

Please check it and get back to me so that we can check it further !

Regards,

Tuan

Please Log in or Create an account to join the conversation.

More
10 years 6 months ago #37559 by orware
Replied by orware on topic Re: Not receiving admin notification
Hi Tuan,

I'm not sure which issue in particular jorman is facing, but the fixes I implemented into the PayPal integration (essentially providing multiple retries in the case of an initial failure) seem to be working well for us for the registrations occurring via the frontend and there haven't been anymore issues there after those changes were made.

However we are still having the issue with the manual registrations in the backend not sending any notifications out whatsoever (to the user or to the administrator) and that is something I will probably need to fix myself since I haven't heard an update on that issue recently.

Please Log in or Create an account to join the conversation.

More
10 years 6 months ago #37588 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Re: Not receiving admin notification
@rware: At the moment, when you add registrants manually from back-end, the system doesn't send email. If you want to have this feature, you will need to customize the code yourself !

You mentioned about "but the fixes I implemented into the PayPal integration (essentially providing multiple retries in the case of an initial failure)", could you please share the code ?

Tuan

Please Log in or Create an account to join the conversation.

Moderators: Tuan Pham Ngoc