From 07668697cf13b4687eab878b13446b4771ec9c4e Mon Sep 17 00:00:00 2001 From: Bill Erickson <berick@esilibrary.com> Date: Thu, 22 Sep 2011 10:27:11 -0400 Subject: [PATCH] TPac: credit card payment bug fixes / cleanup * Repaired bug with paying multiple transactions * Replaced JS-based back/cancel navigation with a's * Added some debug logging Signed-off-by: Bill Erickson <berick@esilibrary.com> --- .../src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm | 6 ++++-- Open-ILS/src/templates/opac/myopac/main_pay.tt2 | 12 ++++++++++-- Open-ILS/src/templates/opac/myopac/main_payment_form.tt2 | 13 ++++++------- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm index fbcc8e7749..726db95e4d 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm @@ -942,8 +942,10 @@ sub load_myopac_pay { my $self = shift; my $r; - $r = $self->prepare_fines(undef, undef, [$self->cgi->param('xact'), $self->cgi->param('xact_misc')]) and - return $r; + my @payment_xacts = ($self->cgi->param('xact'), $self->cgi->param('xact_misc')); + $logger->info("tpac paying fines for xacts @payment_xacts"); + + $r = $self->prepare_fines(undef, undef, \@payment_xacts) and return $r; # balance_owed is computed specifically from the fines we're trying # to pay in this case. diff --git a/Open-ILS/src/templates/opac/myopac/main_pay.tt2 b/Open-ILS/src/templates/opac/myopac/main_pay.tt2 index 86ee7e8934..7c3468210f 100644 --- a/Open-ILS/src/templates/opac/myopac/main_pay.tt2 +++ b/Open-ILS/src/templates/opac/myopac/main_pay.tt2 @@ -13,8 +13,16 @@ [% ctx.payment_response.payload.error_message %] </div> <p> - <a href="[% ctx.opac_root %]/myopac/main" - onclick="history.go(-1); return false;">[% l('Go back') %]</a> + [% + url_args = {xact => [], xact_misc => []}; + FOR k IN ['xact', 'xact_misc']; + FOR val IN CGI.param(k); + url_args.$k.push(val); + END; + END; + retry_url = mkurl(ctx.opac_root _ '/myopac/main_payment_form', url_args, 1); + %] + <a href="[% retry_url %]">[% l('Go back') %]</a> [% l('to try again or to cancel this payment attempt.') %] </p> [% ELSE %] diff --git a/Open-ILS/src/templates/opac/myopac/main_payment_form.tt2 b/Open-ILS/src/templates/opac/myopac/main_payment_form.tt2 index c54f4e02e3..cb4d4a177b 100644 --- a/Open-ILS/src/templates/opac/myopac/main_payment_form.tt2 +++ b/Open-ILS/src/templates/opac/myopac/main_payment_form.tt2 @@ -18,12 +18,12 @@ <p><big>[% l("Are you sure you are ready to charge [_1] to your credit card?", money(ctx.fines.balance_owed)) %]</big></p> <form action="[% ctx.opac_root %]/myopac/main_pay" method="POST"> [% FOR k IN CGI.Vars; - NEXT UNLESS k %] - <input type="hidden" name="[% k | html %]" value="[% CGI.param(k) | html %]" /> - [% END %] + NEXT UNLESS k; + FOR val IN CGI.param(k) %] + <input type="hidden" name="[% k | html %]" value="[% val | html %]" /> + [% END; END %] <input type="submit" value="[% l('Submit Payment') %]" /> - <input type="reset" value="[% l('Cancel') %]" - onclick="history.go(-1);" /> + <a href="[% mkurl(ctx.opac_root _ '/myopac/main', {}, 1) %]">[% l('Cancel') %]</a> [% ELSE %] <form method="POST"> <input type="hidden" name="last_chance" value="1" /> @@ -173,8 +173,7 @@ <tr> <td colspan='2' align="center"> <input type="submit" value="[% l('Next') %]" /> - <input type="reset" value="[% l('Cancel') %]" - onclick="history.go(-1);" /> + <a href="[% mkurl(ctx.opac_root _ '/myopac/main', {}, 1) %]">[% l('Cancel') %]</a> </td> </tr> [% INCLUDE "opac/parts/myopac/main_refund_policy.tt2" %] -- 2.11.0