Skip Menu |

This queue is for tickets about the Business-PayPal-IPN CPAN distribution.

Report information
The Basics
Id: 57944
Status: open
Priority: 0/
Queue: Business-PayPal-IPN

People
Owner: Nobody in particular
Requestors: martin [...] ossware.se
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: (no value)
Fixed in: (no value)



Subject: Verification fails - incorrect parameters order
PayPal seems to (I haven't used older versions, so I cannot confirm this as a change) have changed the IPN verification process so that the query string sent back to paypal is sensitive to the order in which parameters are passed. PayPal API docs mentions this too. However, Business::PayPal::IPN reconstructs the query from a hash table, which messes up the order. I'm attaching two patches to fix this. This might not bet the best solution though, so maybe someone who is more familiar with the code should have a look at it.
Subject: Business-PayPal-IPN_param-order.patch
--- IPN.pm.orig 2010-05-25 19:23:50.654105401 +0200 +++ IPN.pm 2010-05-25 19:22:44.214106024 +0200 @@ -98,10 +98,15 @@ my $ua = $self->user_agent(); # Adding a new field according to PayPal IPN manual - $self->{_PAYPAL_VARS}->{cmd} = "_notify-validate"; + #$self->{_PAYPAL_VARS}->{cmd} = "_notify-validate"; + my $validation = "cmd=_notify-validate&".$cgi->_body->{data}; # making a POST request to the server with all the variables - my $responce = $ua->post( $GTW, $self->{_PAYPAL_VARS} ); + #my $responce = $ua->post( $GTW, $self->{_PAYPAL_VARS} ); + my $req = HTTP::Request->new(POST => $GTW); + $req->content_type('application/x-www-form-urlencoded'); + $req->content($validation); + my $responce = $ua->request($req); # caching the response object in case anyone needs it $self->{response} = $responce;
Subject: HTTP-Body_raw-data.patch
--- UrlEncoded.pm.orig 2010-05-25 19:11:31.039104622 +0200 +++ UrlEncoded.pm 2010-05-25 19:11:54.974104737 +0200 @@ -41,7 +41,10 @@ # I tested parsing this using APR::Request, but perl is faster # Pure-Perl 2560/s # APR::Request 2305/s - + + # I want access to the raw data! + $self->{data} = $self->{buffer}; + # Note: s/// appears faster than tr/// $self->{buffer} =~ s/\+/ /g;
Hello Martin, I was out of CPAN for a while. I decided to attend some bug requests lately. Recently I noticed that in the docs. Although the PayPal-IPN impelemntation I just finished for my web site was working just fine. So I'm puzzled. Can you confirm that the problem was indeed in the order of parameters? Did these two patches fixed your issue? Thank you.