PayPal Donation Extension

Error 200 IPN Account Business - PayPal Donation Extension

Re: Error 200 IPN Account Business

by salvocortesiano » Sat Apr 21, 2018 1:11 am

Skouat wrote:You need to enable the IPN features to have access to all features linked to IPN

In the overview try to redetect cURL and fsockopen
IPN features depend on this settings

--- Edit ---
With the 1.0.3 of PPDE, all IPN features have been moved on a dedicated module.
Thanks Skouat, I see the settings IPN Module now :) I'll let you know if it works after you've tested it!

Regards
Salvo

UPDATE:

Code: Select all

[21-Apr-2018 01:15:12 0] DEBUG INVALID:
--------------------------------------------------------------------------------
[04/21/2018 1:15 AM] - https://www.sandbox.paypal.com/cgi-bin/webscr ( curl )
--------------------------------------------------------------------------------
HTTP/1.1 200 OK
Date: Sat, 21 Apr 2018 01:15:11 GMT
Server: Apache
X-Frame-Options: SAMEORIGIN
Set-Cookie: c9MWDuvPtT9GIMyPc3jwol1VSlO=kJwruzEEn1dQcLdyU3rdjuy_JkPn7I9j55O3kx87GAn2kpdk0D35mRRHgp-k5XALzZFR5mRvvKS18EegrIStMjsv7JzjnxXY97MNwp3cYipHMjC-zAiRLxiV5-b2amihRPNrbNXS9VmNBUdM43rq0zuij0M87B5bfye73r76YGQgiyF-iL8uFt5kTE8dzhwENcLHb5H5zQ8eIlYKDborvpZVePUKsWokd8ukGKCiICan2VOGrAxF1OhzvoUvdQtJn1W2OyGtQ1siqxkxeQT05qJwp5IxfR6tKQ2dhIEoQMcMO9jD4rqqVVQ30fVVurcr9psSiB-GKunpw0znQ_Lvyc2gz6htP6DgZ5jnGKBmeloma-lf8TKrj5B4uX_unGJRqDcNdsE_NWqSs9aDz2LZ0OjZ2dbWye--4IrZAVR4SLFRJaUcxgyiWsyRn3u; domain=.paypal.com; path=/; Secure; HttpOnly
Set-Cookie: cookie_check=yes; expires=Tue, 18-Apr-2028 01:15:12 GMT; domain=.paypal.com; path=/; Secure; HttpOnly
Set-Cookie: navcmd=_notify-validate; domain=.paypal.com; path=/; Secure; HttpOnly
Set-Cookie: navlns=0.0; expires=Mon, 20-Apr-2020 01:15:12 GMT; domain=.paypal.com; path=/; Secure; HttpOnly
Set-Cookie: Apache=10.72.108.11.1524273311787770; path=/; expires=Mon, 13-Apr-48 01:15:11 GMT
Vary: Accept-Encoding,User-Agent
Connection: close
HTTP_X_PP_AZ_LOCATOR: sandbox.slc
Paypal-Debug-Id: de4b01d8bd026
Set-Cookie: X-PP-SILOVER=name%3DSANDBOX3.WEB.1%26silo_version%3D1880%26app%3Dappdispatcher%26TIME%3D2677070426%26HTTP_X_PP_AZ_LOCATOR%3Dsandbox.slc; Expires=Sat, 21 Apr 2018 01:45:12 GMT; domain=.paypal.com; path=/; Secure; HttpOnly
Set-Cookie: X-PP-SILOVER=; Expires=Thu, 01 Jan 1970 00:00:01 GMT
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8
Strict-Transport-Security: max-age=63072000

INVALID 200
--------------------------------------------------------------------------------
business                 [email protected]
confirmed                
exchange_rate            
first_name               Buyer EUR
item_name                
item_number              uid_2_1524273252
last_name                PPDE
mc_currency              EUR
mc_gross                 5.00
mc_fee                   0.42
parent_txn_id            
payer_email              [email protected]
payer_id                 PGMVWXHW6VWAC
payer_status             verified
payment_date             18:15:03 Apr 20, 2018 PDT
payment_status           Completed
payment_type             instant
receiver_id              DDCHMGBYH72UC
receiver_email           [email protected]
residence_country        FR
settle_amount            0
settle_currency          
test_ipn                 1
txn_id                   6X55833639180342R
txn_type                 web_accept
transaction_subject      
payment_gross            
protection_eligibility   Eligible
verify_sign              AQgFvt-2oLAOasu23SppiSrqRSKwAzwO-FXzPgsb2kGBOfAvRJlMgoq5
tax                      0.00
quantity                 0
payment_fee              
custom                   
charset                  windows-1252
notify_version           3.9
ipn_track_id             4fc895b51bfe


 
FILE: [ROOT]/ext/skouat/ppde/controller/ipn_listener.php
LINE: 680
CALL: skouat\ppde\controller\ipn_listener->log_error()
FILE: [ROOT]/ext/skouat/ppde/controller/ipn_listener.php
LINE: 352
CALL: skouat\ppde\controller\ipn_listener->check_response()
FILE: [ROOT]/ext/skouat/ppde/controller/ipn_listener.php
LINE: 181
CALL: skouat\ppde\controller\ipn_listener->validate_transaction()
FILE: (not given by php)
LINE: (not given by php)
CALL: skouat\ppde\controller\ipn_listener->handle()
FILE: [ROOT]/vendor/symfony/http-kernel/HttpKernel.php
LINE: 144
CALL: call_user_func_array()
FILE: [ROOT]/vendor/symfony/http-kernel/HttpKernel.php
LINE: 64
CALL: Symfony\Component\HttpKernel\HttpKernel->handleRaw()
FILE: [ROOT]/app.php
LINE: 33
CALL: Symfony\Component\HttpKernel\HttpKernel->handle()
Line 680 =

Code: Select all

$this->log_error("DEBUG INVALID:\n" . $this->get_text_report(), $this->use_log_error, true);
Line 352 =

Code: Select all

return $this->check_response();
Line 181 =

Code: Select all

$this->validate_transaction();
SandBox test error!!! I will wait for a user to make a donation and let you know how it!

Regards
Salvo
The best way to predict the future is to invent it!
Image
User avatar
salvocortesiano
Registered User
Posts: 286
Joined: Mon Mar 22, 2010 1:49 pm
Location: Florence (Italy)
Name: Salvo Cortesiano

Re: Error 200 IPN Account Business

by Skouat » Sat Apr 21, 2018 7:40 am

If Sandbox is not working this is not a good point.
I'ill check on my side

Cheers
Skouat
Code Contributor
Posts: 1059
Joined: Mon Mar 10, 2008 5:30 pm
Location: France

Re: Error 200 IPN Account Business

by Skouat » Sat Apr 21, 2018 9:07 am

It works as expected on my demo board (phpBB 3.1.10)

Please, can you give me the version of cURL and SSL your board use, by going in the Overview module?
Skouat
Code Contributor
Posts: 1059
Joined: Mon Mar 10, 2008 5:30 pm
Location: France

Re: Error 200 IPN Account Business

by salvocortesiano » Sat Apr 21, 2018 4:16 pm

Skouat wrote:It works as expected on my demo board (phpBB 3.1.10)

Please, can you give me the version of cURL and SSL your board use, by going in the Overview module?
Hi Skouat,
cURL version: 7.59.0
SSL version: OpenSSL/1.0.2o
Fsockopen: Detected
PayPal Donation version: 1.0.3

Overview:
Image

Thanks and Regards
Salvo
The best way to predict the future is to invent it!
Image
User avatar
salvocortesiano
Registered User
Posts: 286
Joined: Mon Mar 22, 2010 1:49 pm
Location: Florence (Italy)
Name: Salvo Cortesiano

Re: Error 200 IPN Account Business

by salvocortesiano » Sun Apr 22, 2018 11:41 am

Hi Skouat,
below an adaptation of the script of the following MOD: https://www.phpbb.com/customise/db/mod/ ... ation_mod/

Code: Select all

if (!$config['paypal_enable'])
		{
		        // log for manual investigation
			scrivi_log("PAYPAL DISABLED!!!");
		    exit;
		}

        // read the post from PayPal system and add 'cmd'
        $req = 'cmd=_notify-validate';
        
        $key = $request->variable_names(\phpbb\request\request_interface::POST);
        
        foreach ($key as $key => $value)
		{
            $value = urlencode(stripslashes($value));
           	$req .= "&$key=$value";
        }
        
        //post back to PayPal system to validate
		$header  ="POST /cgi-bin/webscr HTTP/1.1\r\n";
		$header .="Content-Type: application/x-www-form-urlencoded\r\n";
		$header .="Content-Length: " . strlen($req) . "\r\n";
		$header .="Host: www.paypal.com\r\n"; 
		$header .="Connection: close\r\n\r\n";

        $fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30);

        // log for manual investigation
        scrivi_log("CONNECT TO ssl://www.paypal.com");

        // assign posted variables to local variables
        $username = $request->variable('item_number', 'default_value', true, \phpbb\request\request_interface::POST);
        $amount = $request->variable('mc_gross', 'default_value', true, \phpbb\request\request_interface::POST);
        $currency = $request->variable('mc_currency', 'default_value', true, \phpbb\request\request_interface::POST);
        
        // assign oter posted variables to local variables
        $item_name = $request->variable('item_name', 'default_value', true, \phpbb\request\request_interface::POST) . "\r\n";
        $payment_status = $request->variable('payment_status', 'default_value', true, \phpbb\request\request_interface::POST) . "\r\n";
        $txn_id = $request->variable('txn_id', 'default_value', true, \phpbb\request\request_interface::POST) . "\r\n";
        $receiver_email = $request->variable('receiver_email', 'default_value', true, \phpbb\request\request_interface::POST) . "\r\n";
        $payer_email = $request->variable('payer_email', 'default_value', true, \phpbb\request\request_interface::POST) . "\r\n";
        $custom = $request->variable('custom', 'default_value', true, \phpbb\request\request_interface::POST) . "\r\n";
        $payer_status = $request->variable('payer_status', 'default_value', true, \phpbb\request\request_interface::POST) . "\r\n";
       
        // log for manual investigation
        scrivi_log($username . ' ' . $amount . ' ' . $currency . ' ' . $item_name . ' ' . $payment_status . ' ' . $txn_id . ' ' . $receiver_email . ' ' . $payer_email . ' ' . $custom . ' ' . $payer_status);
        
         if (!$fp)
		{
            // HTTP ERROR
            // log for manual investigation
            scrivi_log("HTTP ERROR!!!");
        }
		else
		{
            fputs ($fp, $header . $req);
            while (!feof($fp))
			{
                $res = fgets ($fp, 1024);
                
                // log for manual investigation
                scrivi_log($res);
                
                if (strcmp ($res, "VERIFIED") == 0)
                
				{
					// log for manual investigation
					scrivi_log("RESPONCE VERIFIED!!");
					
                    if ($payment_status == 'Completed' && !empty($username)
						&& $amount >= $config['paypal_minimum'])
					{
					    //donation_received($username, $amount, $currency, 'PayPal');
					    // log for manual investigation
					    scrivi_log("ADDING DONATOR TO DEFAULT GROUP AND SEND EMAIL NOTIFICATION!");
					}	
                }
                else if (strcmp ($res, "INVALID") == 0)
				{
                    // log for manual investigation
                    scrivi_log("RESPONCE INVALID!!");
                }
            }
            fclose ($fp);
I tested the script on my live board, and the script adapted for the phbb3 3.1.10 works fine, but testing it with SandBox returns the INVALID responce!

Code: Select all

CONNECT TO ssl://www.paypal.com

 $username = AK-1234
 $amount = 12.34
 $currency = USD
 $item_name = something
 $payment_status = Completed
 $txn_id = 731848034
 $receiver_email = [email protected]
 $payer_email = [email protected]
 $custom = Salvo Cortesiano
 $payer_status = verified


HTTP/1.1 200 OK
Server: Apache
X-Frame-Options: SAMEORIGIN
HTTP_X_PP_AZ_LOCATOR: dcg13.slc
Paypal-Debug-Id: 574ca9b81ab3e
Cache-Control: max-age=0, no-cache, no-store, must-revalidate
Pragma: no-cache
Content-Type: text/html; charset=UTF-8
DC: phx-origin-www-1.paypal.com
X-EdgeConnect-MidMile-RTT: 105
X-EdgeConnect-Origin-MEX-Latency: 454
Date: Sun, 22 Apr 2018 11:27:36 GMT
Content-Length: 7
Connection: close
Set-Cookie: cwrClyrK4LoCV1fydGbAxiNL6iG=lxMf36czUN4azT1ElOy_qw-qbkyfObHArjQdtmD2Tc87OHU25TJAa9VNO7wuAsycpKA6RmKKUu2mlMGWvIjNZIMKe4cTbAvxS0dhzeXu49U_Ur31PEs_2vJadcj7kM5Kk-YfNLf9h8Hwhf36DPBJLo30vKlHM9t1ZNWdQQ8g1GUMT_P4mumK25bG2hNnKSAvmeU5hJ9gOaTGQ0RYZPlgKlszmFwcTApsWm6OKi3lU3Qy-W3TczBdzHLw5EV6LCe-dJptqKpkMeLEgvcDWxwh8iNJnCmG1agT3ztsL1xDaJtlXxFuWZRnf0MduNGnDimiDX_2Uz6R-2EY8tWMDWYnMF8QKa5C0KxCZp46zHbmkSsR_M9AUr0vawFLTRqdzEI7SAzy2vBNwY_Dh8jjiDYXt7PQAEJPgpiVm_ezR2LLgVTlqT0580NakPG_sdy; domain=.paypal.com; path=/; Secure; HttpOnly
Set-Cookie: cookie_check=yes; expires=Wed, 19-Apr-2028 11:27:36 GMT; domain=.paypal.com; path=/; Secure; HttpOnly
Set-Cookie: navcmd=_notify-validate; domain=.paypal.com; path=/; Secure; HttpOnly
Set-Cookie: navlns=0.0; expires=Tue, 21-Apr-2020 11:27:36 GMT; domain=.paypal.com; path=/; Secure; HttpOnly
Set-Cookie: X-PP-SILOVER=name%3DLIVE3.WEB.1%26silo_version%3D880%26app%3Dappdispatcher%26TIME%3D2826034266%26HTTP_X_PP_AZ_LOCATOR%3Ddcg13.slc; Expires=Sun, 22 Apr 2018 11:57:36 GMT; domain=.paypal.com; path=/; Secure; HttpOnly
Set-Cookie: X-PP-SILOVER=; Expires=Thu, 01 Jan 1970 00:00:01 GMT
Set-Cookie: AKDC=phx-origin-www-1.paypal.com; expires=Sun, 22-Apr-2018 11:57:36 GMT; path=/; secure
Set-Cookie: akavpau_ppsd=1524397056~id=848e10c6c4d803727daa675ef6585d13; Domain=www.paypal.com; Path=/; Secure; HttpOnly
Strict-Transport-Security: max-age=63072000

$responce = INVALID
I don't understand why and I don't know how to have a complete log to trace the error!!
Best Regards

Salvo
The best way to predict the future is to invent it!
Image
User avatar
salvocortesiano
Registered User
Posts: 286
Joined: Mon Mar 22, 2010 1:49 pm
Location: Florence (Italy)
Name: Salvo Cortesiano

Re: Error 200 IPN Account Business

by Skouat » Sun Apr 22, 2018 6:46 pm

Hi,

If you take a look on the following topic dynserver encounters some issue with my extension.
After some tests we discover that issue was not my extension, but the board itself.


Maybe we can try to tests the same things, by installing a fresh phpBB 3.1.10 with only my extension.
If it works, that will be a good start of investigation.

Please, let me know if you can made this test.

thanks.
Skouat
Code Contributor
Posts: 1059
Joined: Mon Mar 10, 2008 5:30 pm
Location: France

Re: Error 200 IPN Account Business

by salvocortesiano » Mon Apr 23, 2018 7:59 pm

Hi Skouat,
today it seems to work, look at the log of a regularly archived donation. The log file did not give errors this time :)

Image

but I have not received notification from this extension, only notification email from paypal. The reception of notifications to the admin and the user are enabled on the option. But this is not important :D
I have not uninstalled any extensions I have only changed the language encoding settings on paypal and "Allow Non-Western-European Languages" to UTF-8 :) Language Encoding. I hope the extension will continue to work!
Thanks for your support and if you send me your paypal address I provide a donation ;)

Regards
Salvo
The best way to predict the future is to invent it!
Image
User avatar
salvocortesiano
Registered User
Posts: 286
Joined: Mon Mar 22, 2010 1:49 pm
Location: Florence (Italy)
Name: Salvo Cortesiano

Re: Error 200 IPN Account Business

by Skouat » Mon Apr 23, 2018 10:37 pm

Glad to know that is working now.
salvocortesiano wrote: I have not uninstalled any extensions I have only changed the language encoding settings on paypal and "Allow Non-Western-European Languages" to UTF-8 Language Encoding. I hope the extension will continue to work!
Thanks for your feedback and the link. I'll add it on the FAQ. It will be useful for others.
On my demo board this is set to "Non-Western-European Languages" and "windows-1252".
You use a Latin language like me. So I don't understand why it doesn't work on your board.

Cheers ;)
Skouat
Code Contributor
Posts: 1059
Joined: Mon Mar 10, 2008 5:30 pm
Location: France

Re: Error 200 IPN Account Business

by salvocortesiano » Tue Apr 24, 2018 5:11 am

Hi Skouat,
Skouat wrote:You use a Latin language like me. So I don't understand why it doesn't work on your board.
Maybe because my boarad is different? :lol:
Anyway for your precious support and advice of the extension in attached the complete translation in Italian :D
Trust me, my Italian is better than my English ;)
Best Regards

Salvo
ppde_it_language.zip
(11.99 KiB) Downloaded 41 times
The best way to predict the future is to invent it!
Image
User avatar
salvocortesiano
Registered User
Posts: 286
Joined: Mon Mar 22, 2010 1:49 pm
Location: Florence (Italy)
Name: Salvo Cortesiano

Re: Error 200 IPN Account Business

by Skouat » Tue Apr 24, 2018 6:32 am

I'll check if your translation is better than your english :twisted: :mrgreen:

Thanks ;)
Skouat
Code Contributor
Posts: 1059
Joined: Mon Mar 10, 2008 5:30 pm
Location: France

Re: Error 200 IPN Account Business

by salvocortesiano » Tue Apr 24, 2018 8:17 am

Skouat wrote:I'll check if your translation is better than your english :twisted: :mrgreen:

Thanks ;)
:lol: :lol: :lol: :lol:
The best way to predict the future is to invent it!
Image
User avatar
salvocortesiano
Registered User
Posts: 286
Joined: Mon Mar 22, 2010 1:49 pm
Location: Florence (Italy)
Name: Salvo Cortesiano

Re: Error 200 IPN Account Business

by salvocortesiano » Thu Apr 26, 2018 3:38 am

Hi Skouat,
the extension work fine now with that modification on the UTF-8 language encoding (PayPal Language Settings) :D
Users are moved to the donor group = ok
The transaction log is regularly registered in the ACP = ok
But unfortunately, no e-mail sent to the user who donated and the Administrator :( I tried to work on the code of the "ipn-listener.php" file but without success! Can you give me some suggestions? User preferences are set to send and receive private and email messages!

Thanks & Best Regards

Salvo
The best way to predict the future is to invent it!
Image
User avatar
salvocortesiano
Registered User
Posts: 286
Joined: Mon Mar 22, 2010 1:49 pm
Location: Florence (Italy)
Name: Salvo Cortesiano

Re: Error 200 IPN Account Business

by Skouat » Thu Apr 26, 2018 6:47 am

Hi Salvo,

As you can see in the ipn listener controller at line 990 - 994 the notification method is called if a transaction is not a IPN Test.

You can try to add the following code in ipn_listener.php
Find // Send admin notification
Add before

Code: Select all

$this->log_error('Get notification_data content', true, false, E_USER_NOTICE, $notification_data);
Find $this->notification->add_notifications('skouat.ppde.notification.type.donor_donation_received', $notification_data);
Add after

Code: Select all

$this->log_error('End of nofification method', true);
Do not forgotten to enable the logging Feature ;)
Skouat
Code Contributor
Posts: 1059
Joined: Mon Mar 10, 2008 5:30 pm
Location: France

Re: Error 200 IPN Account Business

by salvocortesiano » Thu Apr 26, 2018 8:23 am

yeah Skouat, I find it and apply the small change. I'm waiting now for a donation ;) and I'll let you know!
Certainly the logging is enabled :)

Thanks

Salvo

Code: Select all

$this->log_error('Get notification_data content', true, false, E_USER_NOTICE, $notification_data);

// Send admin notification
$this->notification->add_notifications('skouat.ppde.notification.type.admin_donation_received', $notification_data);
// Send donor notification
$this->notification->add_notifications('skouat.ppde.notification.type.donor_donation_received', $notification_data);
		
$this->log_error('End of nofification method', true);
The best way to predict the future is to invent it!
Image
User avatar
salvocortesiano
Registered User
Posts: 286
Joined: Mon Mar 22, 2010 1:49 pm
Location: Florence (Italy)
Name: Salvo Cortesiano

Re: Error 200 IPN Account Business

by salvocortesiano » Mon Apr 30, 2018 4:31 am

Hi Skouat,
yesterday a donation was made:
Image

The log: ppde_tx_1525003556.txt

Code: Select all

[29-Apr-2018 12:05:57 0] End of nofification method
The log file contained only this line!!! :o
Bst Regards

Salvo
The best way to predict the future is to invent it!
Image
User avatar
salvocortesiano
Registered User
Posts: 286
Joined: Mon Mar 22, 2010 1:49 pm
Location: Florence (Italy)
Name: Salvo Cortesiano