From 08f404e75577339a05689e8a117884990554f90f Mon Sep 17 00:00:00 2001 From: Jason Boyer Date: Tue, 8 Dec 2020 15:52:13 -0500 Subject: [PATCH] LP1895679: Add Stripe v3 support to Bootstrap OPAC Update the Bootstrap OPAC to use Stripe v3, added to the TPAC in LP 1774892. Signed-off-by: Jason Boyer Signed-off-by: Garry Collum Signed-off-by: Galen Charlton --- .../src/templates-bootstrap/opac/css/style.css.tt2 | 11 + .../opac/myopac/generic_payment_form.tt2 | 138 +++++++++++++ .../opac/myopac/last_chance_form.tt2 | 49 +++++ .../opac/myopac/main_payment_form.tt2 | 226 +-------------------- .../opac/myopac/stripe_payment_form.tt2 | 99 +++++++++ .../src/templates-bootstrap/opac/parts/stripe.tt2 | 30 +-- 6 files changed, 306 insertions(+), 247 deletions(-) create mode 100644 Open-ILS/src/templates-bootstrap/opac/myopac/generic_payment_form.tt2 create mode 100644 Open-ILS/src/templates-bootstrap/opac/myopac/last_chance_form.tt2 create mode 100644 Open-ILS/src/templates-bootstrap/opac/myopac/stripe_payment_form.tt2 diff --git a/Open-ILS/src/templates-bootstrap/opac/css/style.css.tt2 b/Open-ILS/src/templates-bootstrap/opac/css/style.css.tt2 index 575d468627..77c6bc2e1b 100755 --- a/Open-ILS/src/templates-bootstrap/opac/css/style.css.tt2 +++ b/Open-ILS/src/templates-bootstrap/opac/css/style.css.tt2 @@ -1732,6 +1732,17 @@ div.result_table_utils_cont { text-align:center; } +/* Stripe's payment form */ +#payment_form +{ + background-color: [% css_colors.accent_ultralight %]; + width: 75%; +} +#card-element +{ + padding: 10px; +} + /* text to state what is seen on cc statement */ .cc_disclaimer { diff --git a/Open-ILS/src/templates-bootstrap/opac/myopac/generic_payment_form.tt2 b/Open-ILS/src/templates-bootstrap/opac/myopac/generic_payment_form.tt2 new file mode 100644 index 0000000000..4e68118563 --- /dev/null +++ b/Open-ILS/src/templates-bootstrap/opac/myopac/generic_payment_form.tt2 @@ -0,0 +1,138 @@ +
+ + [% FOR xact IN CGI.param('xact') %] + + [% END %] + [% FOR xact IN CGI.param('xact_misc') %] + + [% END %] + [% IF ctx.use_stripe %] + + [% END %] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [% USE zip=String(ctx.user.billing_address.post_code) %] + + + +
[% l('Billing Information') %]
+ + + [% l("Update") %] +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
[% l('Credit Card Information') %]
+ +
+ +
+ +
+
+ [% l('Total amount:') %] + [% money(ctx.fines.balance_owed) %]
+ + + [% l('Cancel') %] +
+
+
+ [% INCLUDE "opac/parts/myopac/main_refund_policy.tt2" %] +
+ diff --git a/Open-ILS/src/templates-bootstrap/opac/myopac/last_chance_form.tt2 b/Open-ILS/src/templates-bootstrap/opac/myopac/last_chance_form.tt2 new file mode 100644 index 0000000000..91a84d5175 --- /dev/null +++ b/Open-ILS/src/templates-bootstrap/opac/myopac/last_chance_form.tt2 @@ -0,0 +1,49 @@ +

[% l("Confirm Payment") %]

+ +
+ [% FOR k IN CGI.Vars; + NEXT UNLESS k; + FOR val IN CGI.param(k) %] + + [% END; END %] + + + [% l('Cancel') %] +

[% l("Are you sure you are ready to charge ") %] + [% l("[_1] ", money(ctx.fines.balance_owed))%] + [% l("to your credit card?") %]

+ + + + + + + + + [% + 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 %] + + + + + [% + END; + FOR f IN ctx.fines.grocery; + NEXT IF CGI.param('xact_misc').size && + !CGI.param('xact_misc').grep(f.xact.id).size %] + + + + + [% END %] + +
[% l('Charge/Fee') %][% l('Amount') %]
[% attrs.title | html %][% money(f.xact.balance_owed) %]
[% f.xact.last_billing_type | html %][% money(f.xact.balance_owed) %]
diff --git a/Open-ILS/src/templates-bootstrap/opac/myopac/main_payment_form.tt2 b/Open-ILS/src/templates-bootstrap/opac/myopac/main_payment_form.tt2 index ea17013313..afb05baebe 100755 --- a/Open-ILS/src/templates-bootstrap/opac/myopac/main_payment_form.tt2 +++ b/Open-ILS/src/templates-bootstrap/opac/myopac/main_payment_form.tt2 @@ -18,230 +18,18 @@ [% l("The minimum amount you can pay is \$0.01.") %] [% ELSE %] -[% IF ctx.use_stripe %] - -[% END %]

-
- [% IF last_chance %] -

[% l("Confirm Payment") %]

- - - [% FOR k IN CGI.Vars; - NEXT UNLESS k; - FOR val IN CGI.param(k) %] - - [% END; END %] - - - [% l('Cancel') %] -

[% l("Are you sure you are ready to charge ") %] - [% l("[_1] ", money(ctx.fines.balance_owed))%] - [% l("to your credit card?") %]

- - - - - - - - - [% - 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 %] - - - - - [% - END; - FOR f IN ctx.fines.grocery; - NEXT IF CGI.param('xact_misc').size && - !CGI.param('xact_misc').grep(f.xact.id).size %] - - - - - [% END %] - -
[% l('Charge/Fee') %][% l('Amount') %]
[% attrs.title | html %][% money(f.xact.balance_owed) %]
[% f.xact.last_billing_type | html %][% money(f.xact.balance_owed) %]
- - [% ELSE %] - - - - [% FOR xact IN CGI.param('xact') %] - - [% END %] - [% FOR xact IN CGI.param('xact_misc') %] - - [% END %] +
+ [% IF last_chance %] + [% PROCESS "opac/myopac/last_chance_form.tt2"; %] + [% ELSE %] [% IF ctx.use_stripe %] - + [% PROCESS "opac/myopac/stripe_payment_form.tt2"; %] + [% ELSE %] + [% PROCESS "opac/myopac/generic_payment_form.tt2"; %] [% END %] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [% USE zip=String(ctx.user.billing_address.post_code) %] - - - -
[% l('Billing Information') %]
- - - [% l("Update") %] -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[% l('Credit Card Information') %]
- -
- -
- -
-
- [% l('Total amount:') %] - [% money(ctx.fines.balance_owed) %]
- - - [% l('Cancel') %] -
-
-
- [% INCLUDE "opac/parts/myopac/main_refund_policy.tt2" %] - [% END %] -
[% END %] diff --git a/Open-ILS/src/templates-bootstrap/opac/myopac/stripe_payment_form.tt2 b/Open-ILS/src/templates-bootstrap/opac/myopac/stripe_payment_form.tt2 new file mode 100644 index 0000000000..de1a947d96 --- /dev/null +++ b/Open-ILS/src/templates-bootstrap/opac/myopac/stripe_payment_form.tt2 @@ -0,0 +1,99 @@ + + +
+ + [% FOR xact IN CGI.param('xact') %] + + [% END %] + [% FOR xact IN CGI.param('xact_misc') %] + + [% END %] +
+ +
+ +
+ + + +
+
+ + [% l('Cancel') %] +
+ + [% INCLUDE "opac/parts/myopac/main_refund_policy.tt2" %] + +
diff --git a/Open-ILS/src/templates-bootstrap/opac/parts/stripe.tt2 b/Open-ILS/src/templates-bootstrap/opac/parts/stripe.tt2 index ea4ca04a61..29fea86025 100755 --- a/Open-ILS/src/templates-bootstrap/opac/parts/stripe.tt2 +++ b/Open-ILS/src/templates-bootstrap/opac/parts/stripe.tt2 @@ -1,35 +1,9 @@ [%- PROCESS "opac/parts/header.tt2" %] [% IF ctx.use_stripe %] - + [%- END %] -- 2.11.0