X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FClientAPI%2FMyAccount.pm;h=9e1a4adc4e4100c480caba1eb9d1dd29e58b4536;hb=c4257ec0783ad40d697c22590f804e7d8ce063cd;hp=4614af2f5cae7b6c5c0519401b29234706101e33;hpb=31f1e1bd302bd88d97d56b20dffad5c5f2388261;p=freeside.git diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm index 4614af2f5..9e1a4adc4 100644 --- a/FS/FS/ClientAPI/MyAccount.pm +++ b/FS/FS/ClientAPI/MyAccount.pm @@ -334,6 +334,7 @@ sub login { return { 'error' => '', 'session_id' => $session_id, + %$session, }; } @@ -600,6 +601,8 @@ sub customer_info_short { for (@cust_main_editable_fields) { $return{$_} = $cust_main->get($_); } + $return{$_} = $cust_main->masked($_) for qw/ss stateid/; + #maybe a little more expensive, but it should be cached by now for (@location_editable_fields) { $return{$_} = $cust_main->bill_location->get($_); @@ -722,6 +725,11 @@ sub edit_info { my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ) or return { 'error' => "unknown custnum $custnum" }; + my $conf = new FS::Conf; + if (($p->{payby} eq "CHEK" || $p->{payby} eq "DCHK") && $conf->exists('selfservice-ACH_info_readonly')) { + return { 'error' => "You do not have authority to add a bank account" }; + } + my $new = new FS::cust_main { $cust_main->hash }; $new->set( $_ => $p->{$_} ) @@ -756,8 +764,6 @@ sub edit_info { $payby = $1; } - my $conf = new FS::Conf; - if ( $payby =~ /^(CARD|DCRD)$/ ) { $new->paydate($p->{'year'}. '-'. $p->{'month'}. '-01'); @@ -932,6 +938,7 @@ sub payment_info { $return{paybatch} = $return{payunique}; #back compat $return{credit_card_surcharge_percentage} = $conf->config('credit-card-surcharge-percentage', $cust_main->agentnum); + $return{credit_card_surcharge_flatfee} = $conf->config('credit-card-surcharge-flatfee', $cust_main->agentnum); return { 'error' => '', %return, @@ -1009,8 +1016,15 @@ sub validate_payment { my $payinfo2 = $1; $payinfo = $payinfo1. '@'. $payinfo2; - $payinfo = $cust_main->payinfo - if $cust_main->paymask eq $payinfo; + my $achonfile = 0; + if ( $cust_main->paymask eq $payinfo ) { + $payinfo = $cust_main->payinfo; + $achonfile = 1; + } + + if ($conf->exists('selfservice-ACH_info_readonly') && !$achonfile) { + return { 'error' => "You are not allowed to change your payment information." }; + } } elsif ( $payby eq 'CARD' || $payby eq 'DCRD' ) { @@ -3744,4 +3758,3 @@ sub _custoragent_session_custnum { } 1; -