Bug 11622 [QA Followup] - Fix currency issue, add error template

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Kyle Hall 2015-09-24 08:06:16 -04:00
parent 69844bbd68
commit df05997d01
3 changed files with 55 additions and 3 deletions

View file

@ -0,0 +1,48 @@
[% INCLUDE 'doc-head-open.inc' %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo; Your payment
[% INCLUDE 'doc-head-close.inc' %]
[% BLOCK cssinclude %][% END %]
</head>
<body id="opac-account-pay-return" class="scrollto">
[% INCLUDE 'masthead.inc' %]
<div class="main">
<ul class="breadcrumb">
<li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
<li><a href="/cgi-bin/koha/opac-user.pl">[% borrower.firstname %] [% borrower.surname %]</a> <span class="divider">&rsaquo;</span></li>
<li><a href="#">Your payment</a></li>
</ul>
<div class="container-fluid">
<div class="row-fluid">
<div class="span2">
<div id="navigation">
[% INCLUDE 'navigation.inc' IsPatronPage=1 %]
</div>
</div>
<div class="span10">
<div id="useraccount" class="maincontent">
[% IF error %]
<div id="error" class="dialog alert">
<p><strong>Error:</strong> there was an problem processing your payment</p>
[% IF error == "PAYPAL_UNABLE_TO_CONNECT" %]
<p>Unable to connect to PayPal.</p>
<p>Please try again later.</p>
[% ELSIF error == "PAYPAL_ERROR_PROCESSING" %]
<p>Unable to verify payment.</p>
<p>Please contact the library to verify your payment.</p>
[% END %]
</div>
[% END %]
<a href="/cgi-bin/koha/opac-account.pl">Return to fine details</a>
</div> <!-- / #useraccount -->
</div> <!-- / .span10 -->
</div> <!-- / .row-fluid -->
</div> <!-- / .container-fluid -->
</div> <!-- / .main -->
[% INCLUDE 'opac-bottom.inc' %]
[% BLOCK jsinclude %][% END %]

View file

@ -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(

View file

@ -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,