]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/templates/opac/myopac/main_payment_form.tt2
54d079297e986f82adf46432d8e863259cac15e9
[working/Evergreen.git] / Open-ILS / src / templates / opac / myopac / main_payment_form.tt2
1 [%  PROCESS "opac/parts/header.tt2";
2     PROCESS "opac/parts/misc_util.tt2";
3     WRAPPER "opac/parts/myopac/main_base.tt2";
4     myopac_page = "main";
5     myopac_main_page = "payment_form";
6
7     last_chance = CGI.param("last_chance");
8
9     IF myopac_main_page == "payment_form" AND
10         ctx.get_org_setting(ctx.user.home_ou.id, 'credit.processor.stripe.enabled') AND ctx.get_org_setting(ctx.user.home_ou.id, 'credit.processor.default') == 'Stripe';
11         ctx.use_stripe = 1;
12     END %]
13 <h3 class="sr-only">[% l('Pay Charges') %]</h3>
14 [% IF ctx.fines.balance_owed <= 0 %]
15 <div>
16     [% l("You either have no fines to pay or you have selected fines whose " _
17         "total is non-positive.  We cannot process non-positive amounts.") %]
18 </div>
19 [% ELSE %]
20 [% IF ctx.use_stripe %]
21 <noscript>
22     [% l("Your browser does not have Javascript enabled, and we cannot " _
23         "process credit card payments without it.  Please change your " _
24         "browser settings and try again.") %]
25 </noscript>
26 [% END %]
27 <div id="pay_fines_now"[% IF ctx.use_stripe %] class="hide_me"[% END %]>
28     [% IF last_chance %]
29     <p><big>[% l("Are you sure you are ready to charge [_1] to your credit card?", money(ctx.fines.balance_owed)) %]</big></p>
30     <form action="[% ctx.opac_root %]/myopac/main_pay_init" method="post">
31         [% FOR k IN CGI.Vars;
32             NEXT UNLESS k;
33             FOR val IN CGI.param(k) %]
34         <input type="hidden" name="[% k | html %]" value="[% val | html %]" />
35         [% END; END %]
36         <input type="submit" value="[% l('Submit Payment') %]" />
37         <a href="[% mkurl(ctx.opac_root _ '/myopac/main', {}, 1) %]">[% l('Cancel') %]</a>
38     [% ELSE %]
39     <form method="post" id="payment_form"
40     [% IF ctx.use_stripe %]
41     onsubmit="return stripe_onsubmit();"
42     [% END %]
43     >
44         <input type="hidden" name="last_chance" value="1" />
45         [% FOR xact IN CGI.param('xact') %]
46         <input type="hidden" name="xact" value="[% xact | html %]" />
47         [% END %]
48         [% FOR xact IN CGI.param('xact_misc') %]
49         <input type="hidden" name="xact_misc" value="[% xact | html %]" />
50         [% END %]
51         [% IF ctx.use_stripe %]
52         <input type="hidden" name="stripe_token" id="stripe_token" />
53         [% END %]
54
55         <table title="[% l('Billing Information') %]">
56             <tbody>
57                 <tr>
58                     <td colspan='2'><strong>[% l('Billing Information') %]</strong></td>
59                     <td rowspan='13' valign='top'>
60                         <p>[% l('Selected fines you are paying for:') %]</p>
61                         <table title="[% l('List of Transactions') %]"
62                             class="table_no_border_space table_no_cell_pad myopac_payments_table">
63                             <thead>
64                                 <tr>
65                                     <th>[% l('Name') %]</th>
66                                     <th>[% l('Amount') %]</th>
67                                 </tr>
68                             </thead>
69                             <tbody>
70                             [%
71                             FOR f IN ctx.fines.circulation;
72                                 NEXT IF CGI.param('xact').size &&
73                                     !CGI.param('xact').grep(f.xact.id).size;
74                                 attrs = {marc_xml => f.marc_xml};
75                                 IF f.marc_xml;
76                                     PROCESS get_marc_attrs args=attrs;
77                                 ELSIF f.xact.reservation;
78                                     attrs.title = f.xact.reservation.target_resource_type.name;
79                                 END %]
80                                 <tr>
81                                     <td>[% attrs.title | html %]</td>
82                                     <td class="text-right">[% money(f.xact.balance_owed) %]</td>
83                                 </tr>
84                             [%
85                             END;
86                             FOR f IN ctx.fines.grocery;
87                                 NEXT IF CGI.param('xact_misc').size &&
88                                     !CGI.param('xact_misc').grep(f.xact.id).size %]
89                                 <tr>
90                                     <td>[% f.xact.last_billing_type | html %]</td>
91                                     <td class="text-right">[% money(f.xact.balance_owed) %]</td>
92                                 </tr>
93                             [% END %]
94                             </tbody>
95                         </table>
96                         <br />
97                         <div>
98                             [% l('Total amount to pay:') %]
99                             <strong>[% money(ctx.fines.balance_owed) %]</strong>
100                         </div>
101                         <br />
102                         [% | l('<strong>', '</strong>') %]Click [_1]Cancel[_2] to go back and (un)select other fines.[% END %]
103                     </td>
104                 </tr>
105                 <tr>
106                     <td><label for="payment-first-name">[% l('First Name') %]</label></td>
107                     <td><input type="text"  name="billing_first" id="payment-first-name" 
108                         value="[% ctx.user.first_given_name | html %]" /></td>
109                 </tr>
110                 <tr>
111                     <td><label for="payment-last-name">[% l('Last Name') %]</label></td>
112                     <td><input type="text" name="billing_last" id="payment-last-name" 
113                         value="[% ctx.user.family_name | html %]" /></td>
114                 </tr>
115                 <tr>
116                     <td><label for="payment-email-addr">[% l('Email Address') %]</label></td>
117                     <td>
118                         <input id="payment-email-addr" type="text" disabled="disabled" 
119                             readonly="readonly" value="[% ctx.user.email | html %]" />
120                         <a title="[% l('Update Email Address') %]"
121                             href="[% ctx.opac_root %]/myopac/update_email?return_to_referer=1">[% l("Update") %]</a>
122                     </td>
123                 </tr>
124                 <tr>
125                     <td><label for="payment-billing-address">[% l('Street Address') %]</label></td>
126                     <td><input type="text" name="billing_address" id="payment-billing-address" 
127                         value="[% ctx.user.billing_address.street1 _ ctx.user.billing_address.street2 | html %]" /></td>
128                 </tr>
129                 <tr>
130                     <td><label for="payment-billing-city">[% l('City' )%]</label></td>
131                     <td><input type="text" name="billing_city" id="payment-billing-city" 
132                         value="[% ctx.user.billing_address.city | html %]" /></td>
133                 </tr>
134                 <tr>
135                     <td><label for="payment-billing-state">[% l('State or Province') %]</label></td>
136                     <td><input type="text" name="billing_state" id="payment-billing-state"
137                         value="[% ctx.user.billing_address.state | html %]" /></td>
138                 </tr>
139                 <tr>
140                     <td><label for="paymenet-billing-zip">[% l('ZIP or Postal Code') %]</label></td>
141                     <td><input type="text" name="billing_zip" id="paymenet-billing-zip"
142                         value="[% ctx.user.billing_address.post_code | html %]" /></td>
143                 </tr>
144                 <tr>
145                   <td colspan='2'><strong>[% l('Credit Card Information') %]</strong></td>
146                 </tr>
147                 <tr>
148                     <td><label for="payment-credit-card">[% l('Credit Card #') %]</label></td>
149                     <td><input type="text" maxlength="16" id="payment-credit-card"
150                     [% IF ctx.use_stripe %]
151                     data-stripe="number"
152                     [% ELSE %]
153                     name="number"
154                     [% END %]
155                     /></td>
156                 </tr>
157                 <tr>
158                     <td><label for="payment-security-code">[% l('Security Code') %]</label></td>
159                     <td>
160                         <input type="text" size="4" maxlength="5" id="payment-security-code"
161                         [% IF ctx.use_stripe %]
162                         data-stripe="cvc"
163                         [% ELSE %]
164                         name="cvv2"
165                         [% END %]
166                         /></td>
167                 </tr>
168                 <tr>
169                     <td><label for="payment-expire-month">[% l('Expiration Month') %]</label></td>
170                     <td>
171                         <select id="payment-expire-month"
172                         [% IF ctx.use_stripe %]
173                         data-stripe="exp_month"
174                         [% ELSE %]
175                         name="expire_month"
176                         [% END %]
177                         >
178                             <option value="01">[% l("January") %]</option>
179                             <option value="02">[% l("February") %]</option>
180                             <option value="03">[% l("March") %]</option>
181                             <option value="04">[% l("April") %]</option>
182                             <option value="05">[% l("May") %]</option>
183                             <option value="06">[% l("June") %]</option>
184                             <option value="07">[% l("July") %]</option>
185                             <option value="08">[% l("August") %]</option>
186                             <option value="09">[% l("September") %]</option>
187                             <option value="10">[% l("October") %]</option>
188                             <option value="11">[% l("November") %]</option>
189                             <option value="12">[% l("December") %]</option>
190                         </select>
191                     </td>
192                 </tr>
193                 <tr>
194                     <td><label for="payment-expire-year">[% l('Expiration Year') %]</label></td>
195                     <td>
196                         <select id="payment-expire-year"
197                         [%- IF ctx.use_stripe %]
198                         data-stripe="exp_year"
199                         [% ELSE %]
200                         name="expire_year"
201                         [% END -%]
202                         >
203                         [% year = date.format(date.now, '%Y');
204                         y = year;
205                         WHILE y < year + 10; # show ten years starting now %]
206                             <option value="[% y %]">[% y %]</option>
207                         [% y = y + 1; END %]
208                         </select>
209                     </td>
210                 </tr>
211                 <tr>
212                     <td colspan='2' align="center">
213                         <input type="submit" id="payment_submit" value="[% l('Next') %]" />
214                         <a href="[% mkurl(ctx.opac_root _ '/myopac/main', {}, 1) %]">[% l('Cancel') %]</a>
215                     </td>
216                 </tr>
217                 [% INCLUDE "opac/parts/myopac/main_refund_policy.tt2" %]
218             </tbody>
219         </table>
220     [% END %]
221     </form>
222 </div>
223 [% END %]
224 [% END %]