From 3760e951387604caecdab151752883216bf3ffe3 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Thu, 24 Sep 2015 08:06:16 -0400 Subject: [PATCH] Bug 11622 [QA Followup] - Fix currency issue, add error template Signed-off-by: Jonathan Druart --- .../bootstrap/en/modules/opac-account-pay-error.tt | 48 ++++++++++++++++++++ opac/opac-account-pay-paypal-return.pl | 8 +++- opac/opac-account-pay.pl | 2 +- 3 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-account-pay-error.tt diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-account-pay-error.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-account-pay-error.tt new file mode 100644 index 0000000..2c306bc --- /dev/null +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-account-pay-error.tt @@ -0,0 +1,48 @@ +[% INCLUDE 'doc-head-open.inc' %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog › Your payment +[% INCLUDE 'doc-head-close.inc' %] +[% BLOCK cssinclude %][% END %] + + + +[% INCLUDE 'masthead.inc' %] + +
+ + +
+
+
+ +
+
+
+ [% IF error %] +
+

Error: there was an problem processing your payment

+ + [% IF error == "PAYPAL_UNABLE_TO_CONNECT" %] +

Unable to connect to PayPal.

+

Please try again later.

+ [% ELSIF error == "PAYPAL_ERROR_PROCESSING" %] +

Unable to verify payment.

+

Please contact the library to verify your payment.

+ [% END %] +
+ [% END %] + + Return to fine details +
+
+
+
+
+ +[% INCLUDE 'opac-bottom.inc' %] + +[% BLOCK jsinclude %][% END %] diff --git a/opac/opac-account-pay-paypal-return.pl b/opac/opac-account-pay-paypal-return.pl index d2be6d3..4279263 100755 --- a/opac/opac-account-pay-paypal-return.pl +++ b/opac/opac-account-pay-paypal-return.pl @@ -30,6 +30,7 @@ use C4::Auth; use C4::Output; use C4::Accounts; use C4::Members; +use C4::Budgets qw(GetCurrency); use Koha::Database; my $cgi = new CGI; @@ -49,6 +50,8 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( } ); +my $active_currency = GetCurrency(); + my $token = $cgi->param('token'); my $payer_id = $cgi->param('PayerID'); my $amount = $cgi->param('amount'); @@ -75,11 +78,12 @@ my $nvp_params = { 'PAYERID' => $payer_id, 'TOKEN' => $token, 'PAYMENTREQUEST_0_AMT' => $amount, + 'PAYMENTREQUEST_0_CURRENCYCODE' => $active_currency->{currency}, }; my $response = $ua->request( POST $url, $nvp_params ); -my $error; +my $error = q{}; if ( $response->is_success ) { my $params = url_params_mixed( $response->decoded_content ); @@ -98,7 +102,7 @@ if ( $response->is_success ) { } else { - $error => "PAYPAL_UNABLE_TO_CONNECT"; + $error = "PAYPAL_UNABLE_TO_CONNECT"; } $template->param( diff --git a/opac/opac-account-pay.pl b/opac/opac-account-pay.pl index 4fdd28e..e8664e4 100755 --- a/opac/opac-account-pay.pl +++ b/opac/opac-account-pay.pl @@ -42,7 +42,7 @@ unless ( C4::Context->preference('EnablePayPalOpacPayments') ) { my ( $template, $borrowernumber, $cookie ) = get_template_and_user( { - template_name => "opac-account-pay-return.tt", + template_name => "opac-account-pay-error.tt", query => $cgi, type => "opac", authnotrequired => 0, -- 1.7.2.5