News:

Looking for documentation? Take a look on our wiki

Main Menu

Multipule Confirmation E-mails

Started by razzy, May 17, 2012, 08:11:44 AM

Previous topic - Next topic

razzy

I'm getting complaints from users receiving up-to 10 confirmation emails,

Has anyone else had this problem, if so does anyone know what is causing it?

razzy



This is the amount of confirmation orders each person gets.


Milbo

lol what? Sorry your image is not working. Never heard that before.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

razzy





Also when updating the order status this message also appears.

     Info: Attention, #__virtuemart_payment_plg_paypal has not any entry for the order
        Info: Attention, #__virtuemart_payment_plg_paypal has not any entry for the order
        Info: Attention, #__virtuemart_payment_plg_paypal has not any entry for the order

        vmError: Controller invoice: For the pdf invoice, you must install the tcpdf library at /home/lostrali/public_html/libraries/tcpdf
        vmError: Path wrong to store invoices, folder invoices does not exist invoices/
        JUser: :_load: Unable to load user with id: 28

razzy

More fuel to the fire, email from paypal saying... :(

Hello ---- ---------,

Please check your server that handles PayPal Instant Payment Notifications (IPN). Instant Payment Notifications sent to the following URL(s) are failing:

http://-------.com/index.php?option=com_virtuemart&view=pluginresponse&task=pluginnotification&tmpl=component

If you do not recognize this URL, you may be using a service provider that is using IPN on your behalf. Please contact your service provider with the above information. If this problem continues, IPNs may be disabled for your account.

Thank you for your prompt attention to this issue.


Thanks,

PayPal

conurus

#6
I found that PayPal requires the use of SSL for IPN validation. VM2 does support that, but the option to turn it on is hidden and not configurable in the UI.

To reiterate the basics, PayPal comes to the IPN URL of your web site to notify you about a confirmed payment. VM2 is supposed to use HTTP POST to respond using the cmd _validate-notify, and PayPal will reply your HTTP POST with either the keyword 'VALIDATE' or 'INVALID'. However, when plain unencrypted HTTP POST is used, PayPal respond with an empty reply and also keeps on resending the IPN as if nothing has happened.

To work around, in the virtuemart_paymentmethods database table, under the "payment_params" column, find and set secure_post="1".

I have a complete fix for this by adding the "secure_post" option in the PayPal plugin UI which allows you to turn it on or off, but then I have second thoughts - if "off" never works correctly why bother? We may as well eliminate that configuration option in the PayPal plugin code and have it always use SSL.

EDIT: I think we need a second fix: When everything works correctly paypal.log would contain an entry "Notification: emptyCart" and since mine doesn't, it blew up before that point in the code. I have to comment out this line in "updateStatusForOneOrder"

$this->notifyCustomer( $data->virtuemart_order_id , $inputOrder );

Then, "Notification: emptyCart" shows up in paypal.log. Obviously, that turns off all notification mails. I will continue to investigate what causes such abnormal termination within notifyCustomer but for now PayPal won't send me IPN's continuously.

conurus

#7
I further narrowed it down and if I comment out the email in the "orders" model then PayPal IPN completes successfully, but I am confounded as I know my email system is configured correctly as the "Ask a question about this product" feature works.

I guess it has something to do with ob_start() in sendVmMail, shopfunctionsf.php. The workflow is, PayPal notifies the IPN URL of VM2, VM2 POST a validation cmd, PayPal responded "VERIFIED", and VM2 is trying to send notification emails to the vendor and the customer. But the problem is, the original first step (PayPal requests a VM2 URL to actuate IPN) has not yet finished while all this is happening! PayPal requires the original first call to return with a HTTP 200 for it to consider the IPN successfully completed so that no resends would be required.

ob_start() would have somehow created a context for rendering the emails and subsequently "popped" by an ob_end_clean(). This is how it is supposed to all work out and I have that functioning on a different server but not on my production server. Could have something to do with PHP version??

conurus

#8
razzy, what is your PHP version? (From Site menu, "System Infomation")

For me, a server @5.2.6 (apache2handler) doesn't work, but another @5.3.10 (cgi-fcgi) works fine.

Inserting a flush() call before every updateStatusForOneOrder in function plgVmOnPaymentNotification() in plugins\vmpayment\paypal\paypal.php (AIO package) stopped the repeating PayPal IPNs. See below. However for me I get no notification emails at all. After all, maybe we are experiencing different issues.

I also think the handles in _processIPN in the same file needs to be cleaned up. The end of that function should look like this

$ret_val = ''; // added/changed clean up code
if (!$fps) {
    $this->sendEmailToVendorAndAdmins("error with paypal", JText::sprintf('VMPAYMENT_PAYPAL_ERROR_POSTING_IPN', $errstr, $errno));
    $ret_val = JText::sprintf('VMPAYMENT_PAYPAL_ERROR_POSTING_IPN', $errstr, $errno); // send email // added/changed clean up code
} else {
    fputs($fps, $header . $post_msg);
    while (!feof($fps)) {
$res = fgets($fps, 1024);

if (strcmp($res, 'VERIFIED') == 0) {
    break; // added/changed clean up code
} elseif (strcmp($res, 'INVALID') == 0) {
    $this->sendEmailToVendorAndAdmins("error with paypal IPN NOTIFICATION", JText::_('VMPAYMENT_PAYPAL_ERROR_IPN_VALIDATION') . $res);
    $ret_val = JText::_('VMPAYMENT_PAYPAL_ERROR_IPN_VALIDATION') . $res; // added/changed clean up code
    break;
}
    }
}

fclose($fps);
return $ret_val; // added/changed clean up code

ksfbjoern

Hello,

same Problem here with multiple confirmation emails with paypal. Virtuemart 2.0.18. PHP-Version 5.3.10 (cgi-fcgi).

Is there any solution for this problem.

Thanks a lot. Greets.

EverybOdY

I'm having the same problem. Did you solve it?