From 8f1188e8550992bf3d9078e7a6042420eaf92bd5 Mon Sep 17 00:00:00 2001
From: Christopher Burger
Date: Tue, 3 Oct 2017 11:15:51 -0400
Subject: RT# 77193 - updated selfservice change payment accounts to work with
version 4
---
FS/FS/ClientAPI/MyAccount.pm | 1 +
.../FS-SelfService/cgi/myaccount_menu.html | 7 +-
fs_selfservice/FS-SelfService/cgi/selfservice.cgi | 87 +++++++++++++++++++---
3 files changed, 80 insertions(+), 15 deletions(-)
diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm
index a10a45285..30ab96b49 100644
--- a/FS/FS/ClientAPI/MyAccount.pm
+++ b/FS/FS/ClientAPI/MyAccount.pm
@@ -882,6 +882,7 @@ sub payment_info {
if ($cust_payby) {
$return{payname} = $cust_payby->payname
|| ( $cust_main->first. ' '. $cust_main->get('last') );
+ $return{custpaybynum} = $cust_payby->custpaybynum;
if ( $cust_payby->payby =~ /^(CARD|DCRD)$/ ) {
$return{card_type} = cardtype($cust_payby->payinfo);
diff --git a/fs_selfservice/FS-SelfService/cgi/myaccount_menu.html b/fs_selfservice/FS-SelfService/cgi/myaccount_menu.html
index 6af5e5ec0..1bc35e34c 100644
--- a/fs_selfservice/FS-SelfService/cgi/myaccount_menu.html
+++ b/fs_selfservice/FS-SelfService/cgi/myaccount_menu.html
@@ -93,9 +93,10 @@ push @menu,
unless ( $access_pkgnum ) {
push @menu,
- { title=>'Change billing address', url=>'change_bill', indent=>2 },
- { title=>'Change service address', url=>'change_ship', indent=>2 },
- { title=>'Change payment information', url=>'change_pay', indent=>2 },
+ { title=>'Change billing address', url=>'change_bill', indent=>2 },
+ { title=>'Change service address', url=>'change_ship', indent=>2 },
+ { title=>'Change credit card information', url=>'change_creditcard_pay', indent=>2 },
+ { title=>'Change check information', url=>'change_check_pay', indent=>2 },
;
}
diff --git a/fs_selfservice/FS-SelfService/cgi/selfservice.cgi b/fs_selfservice/FS-SelfService/cgi/selfservice.cgi
index cd9e32c78..f194746c5 100755
--- a/fs_selfservice/FS-SelfService/cgi/selfservice.cgi
+++ b/fs_selfservice/FS-SelfService/cgi/selfservice.cgi
@@ -12,8 +12,8 @@ use Date::Format;
use Date::Parse 'str2time';
use Number::Format 1.50;
use FS::SelfService qw(
- access_info login_info login customer_info edit_info invoice
- payment_info process_payment realtime_collect process_prepay
+ access_info login_info login customer_info edit_info insert_payby update_payby
+ invoice payment_info process_payment realtime_collect process_prepay
list_pkgs order_pkg signup_info order_recharge
part_svc_info provision_acct provision_external provision_phone provision_forward
unprovision_svc change_pkg suspend_pkg domainselector
@@ -59,6 +59,10 @@ my @actions = ( qw(
change_bill
change_ship
change_pay
+ change_creditcard_pay
+ change_check_pay
+ process_change_creditcard_pay
+ process_change_check_pay
process_change_bill
process_change_ship
process_change_pay
@@ -261,19 +265,30 @@ sub myaccount {
customer_info( 'session_id' => $session_id );
}
-sub change_bill { my $payment_info =
- payment_info( 'session_id' => $session_id );
- return $payment_info if ( $payment_info->{'error'} );
- my $customer_info =
- customer_info( 'session_id' => $session_id );
- return {
- %$payment_info,
- %$customer_info,
- };
- }
+sub change_bill {
+ my $payby = shift;
+ my $payment_info;
+ if ($payby) {
+ $payment_info = payment_info( 'session_id' => $session_id, 'payment_payby' => $payby, );
+ }
+ else {
+ $payment_info = payment_info( 'session_id' => $session_id, );
+ }
+
+ return $payment_info if ( $payment_info->{'error'} );
+ my $customer_info =
+ customer_info( 'session_id' => $session_id );
+ return {
+ %$payment_info,
+ %$customer_info,
+ };
+}
sub change_ship { change_bill(@_); }
sub change_pay { change_bill(@_); }
+sub change_creditcard_pay { change_bill('CARD'); }
+sub change_check_pay { change_bill('CHEK'); }
+
sub _process_change_info {
my ($erroraction, @fields) = @_;
@@ -298,6 +313,30 @@ sub _process_change_info {
}
}
+sub _process_change_payby {
+ my ($erroraction, @fields) = @_;
+
+ my $results = '';
+
+ $results ||= update_payby (
+ 'session_id' => $session_id,
+ map { ($_ => $cgi->param($_)) } grep { defined($cgi->param($_)) } @fields,
+ );
+
+
+ if ( $results->{'error'} ) {
+ no strict 'refs';
+ $action = $erroraction;
+ return {
+ $cgi->Vars,
+ %{&$action()},
+ 'error' => ''. $results->{'error'}. '',
+ };
+ } else {
+ return $results;
+ }
+}
+
sub process_change_bill {
_process_change_info( 'change_bill',
qw( first last company address1 address2 city state
@@ -342,6 +381,30 @@ sub process_change_pay {
_process_change_info( 'change_pay', @list );
}
+sub process_change_creditcard_pay {
+ my $payby = $cgi->param( 'payby' );
+ $cgi->param('paydate', $cgi->param('year') . '-' . $cgi->param('month') . '-01');
+ my @list =
+ qw( payby payinfo payinfo1 payinfo2 paydate payname custpaybynum
+ address1 address2 city county state zip country auto paytype
+ paystate ss stateid stateid_state invoicing_list
+ );
+
+ _process_change_payby( 'change_creditcard_pay', @list );
+}
+
+sub process_change_check_pay {
+ my $payby = $cgi->param( 'payby' );
+ $cgi->param('paydate', $cgi->param('year') . '-' . $cgi->param('month') . '-01');
+ my @list =
+ qw( payby payinfo payinfo1 payinfo2 paydate payname custpaybynum
+ address1 address2 city county state zip country auto paytype
+ paystate ss stateid stateid_state invoicing_list
+ );
+
+ _process_change_payby( 'change_check_pay', @list );
+}
+
sub view_invoice {
$cgi->param('invnum') =~ /^(\d+)$/ or die "illegal invnum";
--
cgit v1.2.1
From 7e2a4d3ae0e73311ebb4fe01869544c6047f59c8 Mon Sep 17 00:00:00 2001
From: Christopher Burger
Date: Wed, 4 Oct 2017 11:37:20 -0400
Subject: RT# 76968 - added header logo and css to map page, fixed address look
up error, added leaflet to license
---
httemplate/docs/license.html | 4 ++++
httemplate/misc/confirm-censustract.html | 2 +-
httemplate/misc/openmap.html | 17 +++++++++--------
3 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/httemplate/docs/license.html b/httemplate/docs/license.html
index 4ab596db2..e47398283 100644
--- a/httemplate/docs/license.html
+++ b/httemplate/docs/license.html
@@ -146,6 +146,10 @@ under the terms of the MIT license.
Contains the form validation jQuery plugin jQuery Validation by Jörn Zaefferer,
licensed under the terms of MIT License.
+
+Contains the leaflet JavaScript library Leaflet JS by Vladimir Agafonkin,
+licensed under the terms of MIT License.
+
diff --git a/httemplate/misc/confirm-censustract.html b/httemplate/misc/confirm-censustract.html
index b491d4954..0f115e5d7 100644
--- a/httemplate/misc/confirm-censustract.html
+++ b/httemplate/misc/confirm-censustract.html
@@ -16,7 +16,7 @@ Confirm census tract
<% $location{address1} |h %> <% $location{address2} |h %>
<% $location{city} |h %>, <% $location{state} |h %> <% $location{zip} |h %>
-% my $querystring = "census_year=$year&address=$location{address1}, $location{address2}, $location{city}, $location{state}, $location{zip}";
+% my $querystring = "census_year=$year&address=$location{address1}, $location{address2}, $location{city}, $location{state}";
Map service module location
% $querystring = "census_year=$year&pre=$pre&zip_code=" . $cache->get('zip');
diff --git a/httemplate/misc/openmap.html b/httemplate/misc/openmap.html
index 6ccc72491..73f107142 100644
--- a/httemplate/misc/openmap.html
+++ b/httemplate/misc/openmap.html
@@ -1,11 +1,7 @@
-
-
- Find Census Tract Map
-
-
-
-
- Please select your location on the map
+<& /elements/header-logo.html, { title => 'Find Census Tract Map', head => $head, } &>
+
+Please select your location on the map
+
@@ -79,6 +75,11 @@ local $SIG{__DIE__}; #disable Mason error trap
my $DEBUG = 0;
+my $head = '
+
+
+';
+
my $census_year = $cgi->param('census_year');
my $pre = $cgi->param('pre');
my $zip_code = $cgi->param('zip_code');
--
cgit v1.2.1
From 0d62051d0e0ed3bd2e26e1a619dcb6190b653ab8 Mon Sep 17 00:00:00 2001
From: Christopher Burger
Date: Thu, 5 Oct 2017 10:17:36 -0400
Subject: RT# 76968 - Added logo only header file
---
httemplate/elements/header-logo.html | 114 +++++++++++++++++++++++++++++++++++
1 file changed, 114 insertions(+)
create mode 100644 httemplate/elements/header-logo.html
diff --git a/httemplate/elements/header-logo.html b/httemplate/elements/header-logo.html
new file mode 100644
index 000000000..f272c56f6
--- /dev/null
+++ b/httemplate/elements/header-logo.html
@@ -0,0 +1,114 @@
+<%doc>
+
+Example:
+
+ <& /elements/header-logo.html',
+ {
+ 'title' => 'Title',
+ 'menubar' => \@menubar,
+ 'etc' => '', #included in tag, for things like onLoad=
+ 'head' => '', #included before closing tag
+ 'nobr' => 0, #1 for no
after the title
+ 'no_jquery' => #for use from RT, which loads its own
+ }
+ &>
+
+%doc>
+
+%#
+%# above is what RT declares, should we switch now? hopefully no glitches result
+%# or just fuck it, XHTML died anyway, HTML 5 or bust?
+
+
+
+ <% encode_entities($title) || $title_noescape |n %>
+
+
+
+
+
+
+
+% if ( $mobile ) {
+
+% }
+
+% unless ( $nocss ) {
+
+
+% }
+
+% unless ( $no_jquery ) {
+
+
+
+
+% if ( $FS::CurrentUser::CurrentUser->option('printtofit') ) {
+
+% }
+% }
+ <% include('init_overlib.html') |n %>
+ <% include('rs_init_object.html') |n %>
+
+ <% $head |n %>
+
+%# announce our base path, and the Mason comp path of this page
+
+
+
+ STYLE="margin-top:0; margin-bottom:0; margin-left:0px; margin-right:0px">
+
+
+<%init>
+
+my( $title, $title_noescape, $menubar, $etc, $head ) = ( '', '', '', '', '' );
+my( $nobr, $nocss, $no_jquery ) = ( 0, 0, 0 );
+
+my $mobile;
+
+my $opt = shift;
+$title = $opt->{title};
+$title_noescape = $opt->{title_noescape};
+$menubar = $opt->{menubar};
+$etc = $opt->{etc};
+$head = $opt->{head};
+$nobr = $opt->{nobr};
+$nocss = $opt->{nocss};
+$mobile = $opt->{mobile};
+$no_jquery = $opt->{no_jquery};
+
+my $conf = new FS::Conf;
+
+my $curuser = $FS::CurrentUser::CurrentUser;
+
+my $menu_position = $curuser->option('menu_position')
+ || 'top'; #new default for 1.9
+
+if ( !defined($mobile) ) {
+ $mobile = $curuser->option('mobile_menu',1) && FS::UI::Web::is_mobile();
+}
+if ( $cgi->param('mobile') =~ /^(\d)$/ ) { # allow client to override
+ $mobile = $1;
+}
+
+my($company_name, $company_url);
+my @agentnums = $curuser->agentnums;
+if ( scalar(@agentnums) == 1 ) {
+ $company_name = $conf->config('company_name', $agentnums[0] );
+ $company_url = $conf->config('company_url', $agentnums[0] );
+} else {
+ $company_name = $conf->config('company_name');
+ $company_url = $conf->config('company_url');
+}
+
+%init>
\ No newline at end of file
--
cgit v1.2.1
From b9c2b7cc73ad6455613268ae9e884ca0d34a127d Mon Sep 17 00:00:00 2001
From: Christopher Burger
Date: Fri, 6 Oct 2017 10:36:54 -0400
Subject: RT# 77193 - Added files to alter creditcard or check information via
selfservice
---
.../FS-SelfService/cgi/change_check_pay.html | 23 ++++++++++++++++++++++
.../FS-SelfService/cgi/change_creditcard_pay.html | 23 ++++++++++++++++++++++
.../cgi/process_change_check_pay.html | 3 +++
.../cgi/process_change_creditcard_pay.html | 3 +++
4 files changed, 52 insertions(+)
create mode 100644 fs_selfservice/FS-SelfService/cgi/change_check_pay.html
create mode 100644 fs_selfservice/FS-SelfService/cgi/change_creditcard_pay.html
create mode 100644 fs_selfservice/FS-SelfService/cgi/process_change_check_pay.html
create mode 100644 fs_selfservice/FS-SelfService/cgi/process_change_creditcard_pay.html
diff --git a/fs_selfservice/FS-SelfService/cgi/change_check_pay.html b/fs_selfservice/FS-SelfService/cgi/change_check_pay.html
new file mode 100644
index 000000000..7dd2583c4
--- /dev/null
+++ b/fs_selfservice/FS-SelfService/cgi/change_check_pay.html
@@ -0,0 +1,23 @@
+<%= include('header', 'Change ach payment information') %>
+
+<%= if ( $error ) {
+ $OUT .= qq!Error: $error
!;
+ } ''; %>
+
+ |