Lines 24-30
use Modern::Perl;
Link Here
|
24 |
use CGI; |
24 |
use CGI; |
25 |
use HTTP::Request::Common; |
25 |
use HTTP::Request::Common; |
26 |
use LWP::UserAgent; |
26 |
use LWP::UserAgent; |
27 |
use URL::Encode qw(url_encode url_params_mixed); |
|
|
28 |
use URI; |
27 |
use URI; |
29 |
|
28 |
|
30 |
use C4::Auth; |
29 |
use C4::Auth; |
Lines 64-71
my $error = 0;
Link Here
|
64 |
if ( $payment_method eq 'paypal' ) { |
63 |
if ( $payment_method eq 'paypal' ) { |
65 |
my $ua = LWP::UserAgent->new; |
64 |
my $ua = LWP::UserAgent->new; |
66 |
|
65 |
|
67 |
my $amount = url_encode($amount_to_pay); |
|
|
68 |
|
69 |
my $url = |
66 |
my $url = |
70 |
C4::Context->preference('PayPalSandboxMode') |
67 |
C4::Context->preference('PayPalSandboxMode') |
71 |
? 'https://api-3t.sandbox.paypal.com/nvp' |
68 |
? 'https://api-3t.sandbox.paypal.com/nvp' |
Lines 74-80
if ( $payment_method eq 'paypal' ) {
Link Here
|
74 |
my $opac_base_url = C4::Context->preference('OPACBaseURL'); |
71 |
my $opac_base_url = C4::Context->preference('OPACBaseURL'); |
75 |
|
72 |
|
76 |
my $return_url = URI->new( $opac_base_url . "/cgi-bin/koha/opac-account-pay-paypal-return.pl" ); |
73 |
my $return_url = URI->new( $opac_base_url . "/cgi-bin/koha/opac-account-pay-paypal-return.pl" ); |
77 |
$return_url->query_form( { amount => $amount, accountlines => \@accountlines } ); |
74 |
$return_url->query_form( { amount => $amount_to_pay, accountlines => \@accountlines } ); |
78 |
|
75 |
|
79 |
my $cancel_url = URI->new( $opac_base_url . "/cgi-bin/koha/opac-account.pl" ); |
76 |
my $cancel_url = URI->new( $opac_base_url . "/cgi-bin/koha/opac-account.pl" ); |
80 |
|
77 |
|
Lines 104-113
if ( $payment_method eq 'paypal' ) {
Link Here
|
104 |
my $response = $ua->request( POST $url, $nvp_params ); |
101 |
my $response = $ua->request( POST $url, $nvp_params ); |
105 |
|
102 |
|
106 |
if ( $response->is_success ) { |
103 |
if ( $response->is_success ) { |
107 |
my $params = url_params_mixed( $response->decoded_content ); |
|
|
108 |
|
104 |
|
109 |
if ( $params->{ACK} eq "Success" ) { |
105 |
my $urlencoded = $response->content; |
110 |
my $token = $params->{TOKEN}; |
106 |
my %params = URI->new( "?$urlencoded" )->query_form; |
|
|
107 |
|
108 |
if ( $params{ACK} eq "Success" ) { |
109 |
my $token = $params{TOKEN}; |
111 |
|
110 |
|
112 |
my $redirect_url = |
111 |
my $redirect_url = |
113 |
C4::Context->preference('PayPalSandboxMode') |
112 |
C4::Context->preference('PayPalSandboxMode') |
114 |
- |
|
|