TPac: credit card payment bug fixes / cleanup
authorBill Erickson <berick@esilibrary.com>
Thu, 22 Sep 2011 14:27:11 +0000 (10:27 -0400)
committerBill Erickson <berick@esilibrary.com>
Thu, 22 Sep 2011 14:33:03 +0000 (10:33 -0400)
* 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>
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm
Open-ILS/src/templates/opac/myopac/main_pay.tt2
Open-ILS/src/templates/opac/myopac/main_payment_form.tt2

index fbcc8e7..726db95 100644 (file)
@@ -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.
index 86ee7e8..7c34682 100644 (file)
             [% 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 %]
index c54f4e0..cb4d4a1 100644 (file)
     <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" />
                 <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" %]