[freeside-commits] branch FREESIDE_4_BRANCH updated. 5ace53e54be228bdcbaaeaf5527a7ea3abf4951b
Christopher Burger
burgerc at 420.am
Tue Oct 10 07:25:38 PDT 2017
The branch, FREESIDE_4_BRANCH has been updated
via 5ace53e54be228bdcbaaeaf5527a7ea3abf4951b (commit)
via 29bc79d88b83ff3680a3f8d6464fbebc1f92942a (commit)
via 7b9a8725bb57e3561ecff5615e29993c991f7471 (commit)
via ddc96f96d3e8cf5239bbedad2c2067e80eaa02f2 (commit)
via 576f6400095474dc9d2ba5fb4c01f90af16cd037 (commit)
from 07d77552b9307a2274a6872c7a85156354025c9b (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 5ace53e54be228bdcbaaeaf5527a7ea3abf4951b
Author: Christopher Burger <burgerc at freeside.biz>
Date: Tue Oct 10 10:04:07 2017 -0400
RT# 77193 - fixed error updating ACH payby thru selfservice, not saving changed account or aba number on V4. Now works
diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm
index e28aa18..ce887ef 100644
--- a/FS/FS/ClientAPI/MyAccount.pm
+++ b/FS/FS/ClientAPI/MyAccount.pm
@@ -1707,6 +1707,16 @@ sub update_payby {
my($context, $session, $custnum) = _custoragent_session_custnum($p);
return { 'error' => $session } if $context eq 'error';
+ if ($p->{'payby'} eq 'CHEK') {
+ $p->{'payinfo1'} =~ /^([\dx]+)$/
+ or return { 'error' => "illegal account number ". $p->{'payinfo1'} };
+ my $payinfo1 = $1;
+ $p->{'payinfo2'} =~ /^([\dx\.]+)$/ # . turned on by echeck-country CA ?
+ or return { 'error' => "illegal ABA/routing number ". $p->{'payinfo2'} };
+ my $payinfo2 = $1;
+ $p->{'payinfo'} = $payinfo1. '@'. $payinfo2;
+ }
+
my $cust_payby = qsearchs('cust_payby', {
'custnum' => $custnum,
'custpaybynum' => $p->{'custpaybynum'},
commit 29bc79d88b83ff3680a3f8d6464fbebc1f92942a
Author: Christopher Burger <burgerc at freeside.biz>
Date: Mon Oct 9 14:36:07 2017 -0400
RT# 77193 - fixed error when inserting new ach payby thru selfservice on V4. Now works
diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm
index 30ab96b..e28aa18 100644
--- a/FS/FS/ClientAPI/MyAccount.pm
+++ b/FS/FS/ClientAPI/MyAccount.pm
@@ -1675,14 +1675,15 @@ sub insert_payby {
#XXX payinfo1 + payinfo2 for CHEK?
#or take the opportunity to use separate, more well- named fields?
- # my $payinfo;
- # $p->{'payinfo1'} =~ /^([\dx]+)$/
- # or return { 'error' => "illegal account number ". $p->{'payinfo1'} };
- # my $payinfo1 = $1;
- # $p->{'payinfo2'} =~ /^([\dx\.]+)$/ # . turned on by echeck-country CA ?
- # or return { 'error' => "illegal ABA/routing number ". $p->{'payinfo2'} };
- # my $payinfo2 = $1;
- # $payinfo = $payinfo1. '@'. $payinfo2;
+ if ($p->{'payby'} eq 'CHEK') {
+ $p->{'payinfo1'} =~ /^([\dx]+)$/
+ or return { 'error' => "illegal account number ". $p->{'payinfo1'} };
+ my $payinfo1 = $1;
+ $p->{'payinfo2'} =~ /^([\dx\.]+)$/ # . turned on by echeck-country CA ?
+ or return { 'error' => "illegal ABA/routing number ". $p->{'payinfo2'} };
+ my $payinfo2 = $1;
+ $p->{'payinfo'} = $payinfo1. '@'. $payinfo2;
+ }
my $cust_payby = new FS::cust_payby {
'custnum' => $custnum,
diff --git a/FS/FS/cust_payby.pm b/FS/FS/cust_payby.pm
index fd90597..704741f 100644
--- a/FS/FS/cust_payby.pm
+++ b/FS/FS/cust_payby.pm
@@ -159,8 +159,9 @@ sub insert {
local $FS::UID::AutoCommit = 0;
my $dbh = dbh;
- my $error = $self->check_payinfo_cardtype
- || $self->SUPER::insert;
+ my $error = $self->check_payinfo_cardtype if $self->payby =~/^(CARD|DCRD)$/;
+ $self->SUPER::insert unless $error;
+
if ( $error ) {
$dbh->rollback if $oldAutoCommit;
return $error;
diff --git a/fs_selfservice/FS-SelfService/cgi/selfservice.cgi b/fs_selfservice/FS-SelfService/cgi/selfservice.cgi
index f194746..6cf264c 100755
--- a/fs_selfservice/FS-SelfService/cgi/selfservice.cgi
+++ b/fs_selfservice/FS-SelfService/cgi/selfservice.cgi
@@ -337,6 +337,32 @@ sub _process_change_payby {
}
}
+sub _process_insert_payby {
+ my ($erroraction, @fields) = @_;
+
+ my $results = '';
+
+ $results ||= insert_payby (
+ 'session_id' => $session_id,
+ map { ($_ => $cgi->param($_)) } grep { defined($cgi->param($_)) } @fields,
+ );
+
+ ## check error
+
+
+ if ( $results->{'error'} ) {
+ no strict 'refs';
+ $action = $erroraction;
+ return {
+ $cgi->Vars,
+ %{&$action()},
+ 'error' => '<FONT COLOR="#FF0000">'. $results->{'error'}. '</FONT>',
+ };
+ } else {
+ return $results;
+ }
+}
+
sub process_change_bill {
_process_change_info( 'change_bill',
qw( first last company address1 address2 city state
@@ -389,20 +415,20 @@ sub process_change_creditcard_pay {
address1 address2 city county state zip country auto paytype
paystate ss stateid stateid_state invoicing_list
);
-
- _process_change_payby( 'change_creditcard_pay', @list );
+ if ($cgi->param( 'custpaybynum' )) { _process_change_payby( 'change_creditcard_pay', @list ); }
+ else { _process_insert_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');
+ #$cgi->param('paydate', '2039-12-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 );
+ if ($cgi->param( 'custpaybynum' )) { _process_change_payby( 'change_check_pay', @list ); }
+ else { _process_insert_payby( 'change_check_pay', @list ); }
}
sub view_invoice {
commit 7b9a8725bb57e3561ecff5615e29993c991f7471
Author: Christopher Burger <burgerc at freeside.biz>
Date: Fri Oct 6 10:36:54 2017 -0400
RT# 77193 - Added files to alter creditcard or check information via selfservice
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 0000000..7dd2583
--- /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!<FONT SIZE="+1" COLOR="#ff0000">Error: $error</FONT><BR><BR>!;
+ } ''; %>
+
+<FORM NAME="OneTrueForm" METHOD="POST" ACTION="<%=$selfurl%>" onSubmit="document.OneTrueForm.process.disabled=true">
+
+ <TABLE BGCOLOR="#cccccc">
+ <INPUT TYPE="hidden" NAME="payby" VALUE="CHEK">
+ <%= include('check') %>
+ <TR><TD COLSPAN=3>
+ <INPUT TYPE="checkbox" NAME="auto" VALUE="1">Charge future payments to this card automatically
+ </TD></TR>
+ </TABLE>
+
+ <INPUT TYPE="hidden" NAME="action" VALUE="process_change_check_pay">
+ <INPUT TYPE="hidden" NAME="custpaybynum" VALUE="<%=$custpaybynum%>">
+ <BR>
+ <!-- onClick="this.disabled=true"> -->
+ <INPUT TYPE="submit" NAME="process" VALUE="Save payment information">
+
+<%= include('footer') %>
\ No newline at end of file
diff --git a/fs_selfservice/FS-SelfService/cgi/change_creditcard_pay.html b/fs_selfservice/FS-SelfService/cgi/change_creditcard_pay.html
new file mode 100644
index 0000000..cce5559
--- /dev/null
+++ b/fs_selfservice/FS-SelfService/cgi/change_creditcard_pay.html
@@ -0,0 +1,23 @@
+<%= include('header', 'Change credit card payment information') %>
+
+<%= if ( $error ) {
+ $OUT .= qq!<FONT SIZE="+1" COLOR="#ff0000">Error: $error</FONT><BR><BR>!;
+ } ''; %>
+
+<FORM NAME="OneTrueForm" METHOD="POST" ACTION="<%=$selfurl%>" onSubmit="document.OneTrueForm.process.disabled=true">
+
+ <TABLE BGCOLOR="#cccccc">
+ <INPUT TYPE="hidden" NAME="payby" VALUE="CARD">
+ <%= include('card') %>
+ <TR><TD COLSPAN=3>
+ <INPUT TYPE="checkbox" NAME="auto" VALUE="1">Charge future payments to this card automatically
+ </TD></TR>
+ </TABLE>
+
+ <INPUT TYPE="hidden" NAME="action" VALUE="process_change_creditcard_pay">
+ <INPUT TYPE="hidden" NAME="custpaybynum" VALUE="<%=$custpaybynum%>">
+ <BR>
+ <!-- onClick="this.disabled=true"> -->
+ <INPUT TYPE="submit" NAME="process" VALUE="Save payment information">
+
+<%= include('footer') %>
\ No newline at end of file
diff --git a/fs_selfservice/FS-SelfService/cgi/process_change_check_pay.html b/fs_selfservice/FS-SelfService/cgi/process_change_check_pay.html
new file mode 100644
index 0000000..a1ad60c
--- /dev/null
+++ b/fs_selfservice/FS-SelfService/cgi/process_change_check_pay.html
@@ -0,0 +1,3 @@
+<%= include('header', 'ACH information updated successfully' ) %>
+<FONT SIZE=4>Ach information updated successfully.</FONT>
+<%= include('footer') %>
\ No newline at end of file
diff --git a/fs_selfservice/FS-SelfService/cgi/process_change_creditcard_pay.html b/fs_selfservice/FS-SelfService/cgi/process_change_creditcard_pay.html
new file mode 100644
index 0000000..c95e09a
--- /dev/null
+++ b/fs_selfservice/FS-SelfService/cgi/process_change_creditcard_pay.html
@@ -0,0 +1,3 @@
+<%= include('header', 'Information updated successfully' ) %>
+<FONT SIZE=4>Information updated successfully.</FONT>
+<%= include('footer') %>
\ No newline at end of file
commit ddc96f96d3e8cf5239bbedad2c2067e80eaa02f2
Author: Christopher Burger <burgerc at freeside.biz>
Date: Tue Oct 3 11:15:51 2017 -0400
RT# 77193 - updated selfservice change payment accounts to work with version 4
diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm
index a10a452..30ab96b 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 6af5e5e..1bc35e3 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 cd9e32c..f194746 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' => '<FONT COLOR="#FF0000">'. $results->{'error'}. '</FONT>',
+ };
+ } 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";
commit 576f6400095474dc9d2ba5fb4c01f90af16cd037
Author: Christopher Burger <burgerc at freeside.biz>
Date: Wed Sep 13 13:40:29 2017 -0400
RT# 77193 - Fixed default layer not displaying
diff --git a/fs_selfservice/FS-SelfService/cgi/change_pay.html b/fs_selfservice/FS-SelfService/cgi/change_pay.html
index e38ba76..f90f6d9 100644
--- a/fs_selfservice/FS-SelfService/cgi/change_pay.html
+++ b/fs_selfservice/FS-SelfService/cgi/change_pay.html
@@ -60,8 +60,8 @@
delete $options{'DCRD'} unless $payby eq 'DCRD' || ! exists $options{'CARD'};
delete $options{'DCHK'} unless $payby eq 'DCHK' || ! exists $options{'CHEK'};
- ## setting payby to default to layer if only one. should we always display first layer?
- if (keys %options == 1) { @p = keys %options; $payby = $p[0]; }
+ ## set default layer to first payby.
+ @p = keys %options; $payby = $p[0];
HTML::Widgets::SelectLayers->new(
options => \%options,
-----------------------------------------------------------------------
Summary of changes:
FS/FS/ClientAPI/MyAccount.pm | 28 +++--
FS/FS/cust_payby.pm | 5 +-
.../FS-SelfService/cgi/change_check_pay.html | 23 ++++
.../FS-SelfService/cgi/change_creditcard_pay.html | 23 ++++
fs_selfservice/FS-SelfService/cgi/change_pay.html | 4 +-
.../FS-SelfService/cgi/myaccount_menu.html | 7 +-
.../cgi/process_change_check_pay.html | 3 +
...pay.html => process_change_creditcard_pay.html} | 2 +-
fs_selfservice/FS-SelfService/cgi/selfservice.cgi | 113 +++++++++++++++++---
9 files changed, 180 insertions(+), 28 deletions(-)
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
copy fs_selfservice/FS-SelfService/cgi/{process_change_pay.html => process_change_creditcard_pay.html} (82%)
More information about the freeside-commits
mailing list