From 710d78078e77d1375d4e0670e4c1a86f0131215e Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 29 Oct 2014 17:08:39 -0400 Subject: [PATCH] KMAIN-582 : BiblioCommons E-Commerce Receipt Screen Cross-port: 5edb7ab --- .../var/templates_kcls/opac/parts/base_fines.tt2 | 2 +- .../src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm | 4 ++ .../lib/OpenILS/WWW/EGCatLoader/Account.pm | 57 ++++++++++++++++++++++ 3 files changed, 62 insertions(+), 1 deletion(-) diff --git a/KCLS/openils/var/templates_kcls/opac/parts/base_fines.tt2 b/KCLS/openils/var/templates_kcls/opac/parts/base_fines.tt2 index 2aed579617..99b2565e02 100644 --- a/KCLS/openils/var/templates_kcls/opac/parts/base_fines.tt2 +++ b/KCLS/openils/var/templates_kcls/opac/parts/base_fines.tt2 @@ -9,7 +9,7 @@ [% END %] - [% l('Catalog - [_1]', ctx.page_title) %] + [% l('BiblioCommons E-Commerce - KCLS') %] [% INCLUDE 'opac/parts/goog_analytics.tt2' %] diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm index 8812e1a620..e93d94ca05 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm @@ -214,11 +214,15 @@ sub load { return $self->load_myopac_payment_form if $path =~ m|opac/myopac/biblio_main_payment_form|; return $self->load_myopac_payments if $path =~ m|opac/myopac/biblio_main_payments|; return $self->load_myopac_main if $path =~ m|opac/myopac/biblio_main_fines|; + return $self->biblio_load_myopac_pay_init if $path =~ m|opac/myopac/biblio_main_pay_init|; + return $self->load_myopac_pay if $path =~ m|opac/myopac/biblio_main_pay|; return $self->load_myopac_pay_init if $path =~ m|opac/myopac/main_pay_init|; return $self->load_myopac_pay if $path =~ m|opac/myopac/main_pay|; return $self->load_myopac_main if $path =~ m|opac/myopac/main|; return $self->load_myopac_receipt_email if $path =~ m|opac/myopac/receipt_email|; + return $self->load_myopac_receipt_email if $path =~ m|opac/myopac/biblio_receipt_email|; return $self->load_myopac_receipt_print if $path =~ m|opac/myopac/receipt_print|; + return $self->load_myopac_receipt_print if $path =~ m|opac/myopac/biblio_receipt_print|; return $self->load_myopac_update_email if $path =~ m|opac/myopac/update_email|; return $self->load_myopac_update_password if $path =~ m|opac/myopac/update_password|; return $self->load_myopac_update_username if $path =~ m|opac/myopac/update_username|; diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm index beb5b655ea..7280675b3b 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm @@ -1895,6 +1895,63 @@ sub load_myopac_pay_init { return Apache2::Const::OK; } +# 1. caches the form parameters +# 2. loads the credit card payment "Processing..." page +sub biblio_load_myopac_pay_init { + my $self = shift; + my $cache = OpenSRF::Utils::Cache->new('global'); + + my @payment_xacts = ($self->cgi->param('xact'), $self->cgi->param('xact_misc')); + + if (!@payment_xacts) { + # for consistency with load_myopac_payment_form() and + # to preserve backwards compatibility, if no xacts are + # selected, assume all (applicable) transactions are wanted. + my $stat = $self->prepare_fines(undef, undef, [$self->cgi->param('xact'), $self->cgi->param('xact_misc')]); + return $stat if $stat; + @payment_xacts = + map { $_->{xact}->id } ( + @{$self->ctx->{fines}->{circulation}}, + @{$self->ctx->{fines}->{grocery}} + ); + } + + return $self->generic_redirect unless @payment_xacts; + + my $cc_args = {"where_process" => 1}; + + $cc_args->{$_} = $self->cgi->param($_) for (qw/ + number cvv2 expire_year expire_month billing_first + billing_last billing_address billing_city billing_state + billing_zip + /); + + my $cache_args = { + cc_args => $cc_args, + user => $self->ctx->{user}->id, + xacts => \@payment_xacts + }; + + # generate a temporary cache token and cache the form data + my $token = md5_hex($$ . time() . rand()); + $cache->put_cache($token, $cache_args, 30); + + $logger->info("tpac caching payment info with token $token and xacts [@payment_xacts]"); + + # after we render the processing page, we quickly redirect to submit + # the actual payment. The refresh url contains the payment token. + # It also contains the list of xact IDs, which allows us to clear the + # cache at the earliest possible time while leaving a trace of which + # transactions we were processing, so the UI can bring the user back + # to the payment form w/ the same xacts if the payment fails. + + my $refresh = "1; url=biblio_main_pay/$token?xact=" . pop(@payment_xacts); + $refresh .= ";xact=$_" for @payment_xacts; + $self->ctx->{refresh} = $refresh; + + return Apache2::Const::OK; +} + # retrieve the cached CC payment info and send off for processing sub load_myopac_pay { my $self = shift; -- 2.11.0