From ba8a759b3efd14d5c96fdb998af364c9881c8a4f Mon Sep 17 00:00:00 2001 From: Jason Etheridge Date: Fri, 10 Jul 2020 12:08:30 -0400 Subject: [PATCH] LP1774892 stripe elements This commit breaks some code out into separate files for easier understanding. The Stripe form was then tweaked and repositioned to work with specific selected transactions, invoke the last chance screen, and show the refund policy. Signed-off-by: Jason Etheridge Signed-off-by: John Amundson Signed-off-by: Dawn Dale Signed-off-by: Jason Stephenson Signed-off-by: Galen Charlton --- .../templates/opac/myopac/generic_payment_form.tt2 | 128 ++++++++++++++++ .../src/templates/opac/myopac/last_chance_form.tt2 | 55 +++++++ .../templates/opac/myopac/main_payment_form.tt2 | 163 +-------------------- .../templates/opac/myopac/stripe_payment_form.tt2 | 102 +++++++++++++ 4 files changed, 293 insertions(+), 155 deletions(-) create mode 100644 Open-ILS/src/templates/opac/myopac/generic_payment_form.tt2 create mode 100644 Open-ILS/src/templates/opac/myopac/last_chance_form.tt2 create mode 100644 Open-ILS/src/templates/opac/myopac/stripe_payment_form.tt2 diff --git a/Open-ILS/src/templates/opac/myopac/generic_payment_form.tt2 b/Open-ILS/src/templates/opac/myopac/generic_payment_form.tt2 new file mode 100644 index 0000000000..4a67062539 --- /dev/null +++ b/Open-ILS/src/templates/opac/myopac/generic_payment_form.tt2 @@ -0,0 +1,128 @@ +
+ + [% FOR xact IN CGI.param('xact') %] + + [% END %] + [% FOR xact IN CGI.param('xact_misc') %] + + [% 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/opac/myopac/last_chance_form.tt2 b/Open-ILS/src/templates/opac/myopac/last_chance_form.tt2 new file mode 100644 index 0000000000..150ffb682b --- /dev/null +++ b/Open-ILS/src/templates/opac/myopac/last_chance_form.tt2 @@ -0,0 +1,55 @@ +

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

+
+ [% FOR k IN CGI.Vars; + NEXT UNLESS k; + FOR val IN CGI.param(k) %] + + [% END; END %] + + + [% l('Cancel') %] + + + + + + + + + + [% + 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) %]
+ +

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

+ + [% l('Cancel') %] 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 a653cdcd05..d3a13a28b9 100644 --- a/Open-ILS/src/templates/opac/myopac/main_payment_form.tt2 +++ b/Open-ILS/src/templates/opac/myopac/main_payment_form.tt2 @@ -18,159 +18,9 @@ [% l("The minimum amount you can pay is \$0.01.") %] [% ELSE %] -[% IF ctx.use_stripe %] - - - -
- -
- -
- - - -
- - -
-[% ELSE %]
[% IF last_chance %] - -

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

-
- [% FOR k IN CGI.Vars; - NEXT UNLESS k; - FOR val IN CGI.param(k) %] - - [% END; END %] - - - [% l('Cancel') %] - - - - - - - - - - [% - 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) %]
- -

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

- - [% l('Cancel') %] + [% PROCESS "opac/myopac/last_chance_form.tt2"; %] [% ELSE %] @@ -353,9 +203,12 @@ function build_stripe_form() { [% INCLUDE "opac/parts/myopac/main_refund_policy.tt2" %] + [% IF ctx.use_stripe %] + [% PROCESS "opac/myopac/stripe_payment_form.tt2"; %] + [% ELSE %] + [% PROCESS "opac/myopac/generic_payment_form.tt2"; %] + [% END %] [% END %] -
-[% END %] -[% END %] -[% END %] +[% END %] +[% END %] diff --git a/Open-ILS/src/templates/opac/myopac/stripe_payment_form.tt2 b/Open-ILS/src/templates/opac/myopac/stripe_payment_form.tt2 new file mode 100644 index 0000000000..b282e9c1de --- /dev/null +++ b/Open-ILS/src/templates/opac/myopac/stripe_payment_form.tt2 @@ -0,0 +1,102 @@ + + +
+ + [% 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" %]
-- 2.11.0