RT# 79902 - fixed so change payment information link will still work when upgraded...
[freeside.git] / FS / FS / ClientAPI / MyAccount.pm
index d6d7564..d4fa159 100644 (file)
@@ -623,6 +623,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($_)
@@ -874,12 +876,18 @@ sub payment_info {
   $return{$_} = $cust_main->bill_location->get($_) 
     for qw(address1 address2 city state zip);
 
+  $p->{'payment_payby'} = $payment_info->{paybys} if !$p->{'payment_payby'};
+
   # look for stored cust_payby info
   #   only if we've been given a clear payment_payby (to avoid payname conflicts)
-  if ($p->{'payment_payby'} =~ /^(CARD|CHEK)$/) {
-    my @search_payby = ($p->{'payment_payby'} eq 'CARD') ? ('CARD','DCRD') : ('CHEK','DCHK');
+  if ($p->{'payment_payby'} =~ /^(CARD|CHEK)$/ || (ref($p->{'payment_payby'}))) {
+    my @search_payby = ();
+    if ($p->{'payment_payby'} eq 'CARD') { @search_payby = ('CARD','DCRD'); }
+    elsif ($p->{'payment_payby'} eq 'CHEK') { @search_payby = ('CHEK','DCHK'); }
+    elsif (ref($p->{'payment_payby'}) eq 'ARRAY') { @search_payby = @{$payment_info->{paybys}}; }
     my ($cust_payby) = $cust_main->cust_payby(@search_payby);
     if ($cust_payby) {
+      $return{payby} = $cust_payby->payby;
       $return{payname} = $cust_payby->payname
                          || ( $cust_main->first. ' '. $cust_main->get('last') );
       $return{custpaybynum} = $cust_payby->custpaybynum;
@@ -3893,4 +3901,3 @@ sub _custoragent_session_custnum {
 }
 
 1;
-