PINES - Stripe Payment Fix
authorTerran McCanna <tmccanna@georgialibraries.org>
Tue, 19 Jan 2021 20:34:24 +0000 (15:34 -0500)
committerChris Sharp <csharp@georgialibraries.org>
Mon, 8 Nov 2021 14:57:02 +0000 (09:57 -0500)
Proposed fix to make the Stripe payment form display

Signed-off-by: Terran McCanna <tmccanna@georgialibraries.org>
Open-ILS/src/templates-bootstrap/opac/myopac/main_payment_form.tt2

index a774bb7..954fe7c 100755 (executable)
 [% ELSE %]
 <div class="container">
 <hr>
-<div id="pay_fines_now">
-    [% IF last_chance %]
-      [% PROCESS "opac/myopac/last_chance_form.tt2"; %]
-    [% ELSE %]
-        [% IF ctx.cc_configuration_error %]
-            [% PROCESS "opac/myopac/payment_form_error.tt2"; %]
-        [% ELSE %]
-            [% IF ctx.use_stripe %]
-                [% PROCESS "opac/myopac/stripe_payment_form.tt2"; %]
-            [% ELSE %]
-                [% PROCESS "opac/myopac/generic_payment_form.tt2"; %]
-            [% END %]
+<div id="pay_fines_now"[% IF !ctx.use_stripe %] class="hide_me"[% END %]>
+     [% IF last_chance %]
+    <h3>[% l("Confirm Payment") %]</h3>
+
+    <form action="[% ctx.opac_root %]/myopac/main_pay_init" method="post">
+        [% FOR k IN CGI.Vars;
+            NEXT UNLESS k;
+            FOR val IN CGI.param(k) %]
+        <input type="hidden" name="[% k | html %]" value="[% val | html %]" />
+        [% END; END %]
+
+        <button type="submit" class="btn btn-confirm"><i class="fas fa-check"></i> [% l('Confirm') %]</button>
+        <a href="[% mkurl(ctx.opac_root _ '/myopac/main#selected_fines', {}, 1) %]" class="btn btn-deny"><i class="fas fa-ban"></i> [% l('Cancel') %]</a>
+    <p class="my-2"><big>[% l("Are you sure you are ready to charge ") %]
+         <strong> [% l("[_1] ", money(ctx.fines.balance_owed))%]</strong>
+        [% l("to your credit card?") %]</big></p>
+     <table title="[% l('List of Transactions') %]" id="acct_fines_confirm_header"
+        class="table my-2">
+   <thead>
+      <tr>
+        <th>[% l('Charge/Fee') %]</th>
+        <th class="text-right"><span>[% l('Amount') %]</th>
+     </tr>
+   </thead>
+   <tbody>
+      [%
+       FOR f IN ctx.fines.circulation;
+         NEXT IF CGI.param('xact').size &&
+            !CGI.param('xact').grep(f.xact.id).size;
+         attrs = {marc_xml => f.marc_xml};
+         IF f.marc_xml;
+             PROCESS get_marc_attrs args=attrs;
+         ELSIF f.xact.reservation;
+              attrs.title = f.xact.reservation.target_resource_type.name;
+         END %]
+         <tr>
+            <td>[% attrs.title | html %]</td>
+            <td class="text-right">[% money(f.xact.balance_owed) %]</td>
+         </tr>
+          [%
+          END;
+          FOR f IN ctx.fines.grocery;
+              NEXT IF CGI.param('xact_misc').size &&
+                  !CGI.param('xact_misc').grep(f.xact.id).size %]
+              <tr>
+                 <td>[% f.xact.last_billing_type | html %]</td>
+                 <td class="text-right">[% money(f.xact.balance_owed) %]</td>
+            </tr>
+        [% END %]
+     </tbody>
+   </table>
+
+       [% ELSE %]
+
+    <form method="post" id="payment_form" action='#payment'
+    [% IF ctx.use_stripe %]
+    onsubmit="return stripe_onsubmit();"
+    [% END %]
+    >
+        <input type="hidden" name="last_chance" value="1" />
+        [% FOR xact IN CGI.param('xact') %]
+        <input type="hidden" name="xact" value="[% xact | html %]" />
+        [% END %]
+        [% FOR xact IN CGI.param('xact_misc') %]
+        <input type="hidden" name="xact_misc" value="[% xact | html %]" />
         [% END %]
     [% END %]
 </div></div>