ticket 1443 add account type and bank state for echeck processing
[freeside.git] / FS / FS / cust_main.pm
index d437db6..e834d59 100644 (file)
@@ -2,7 +2,7 @@ package FS::cust_main;
 
 use strict;
 use vars qw( @ISA @EXPORT_OK $DEBUG $me $conf @encrypted_fields
-             $import $skip_fuzzyfiles $ignore_expired_card );
+             $import $skip_fuzzyfiles $ignore_expired_card @paytypes);
 use vars qw( $realtime_bop_decline_quiet ); #ugh
 use Safe;
 use Carp;
@@ -70,6 +70,7 @@ $skip_fuzzyfiles = 0;
 $ignore_expired_card = 0;
 
 @encrypted_fields = ('payinfo', 'paycvv');
+@paytypes = ('Personal checking', 'Personal savings', 'Business checking', 'Business savings');
 
 #ask FS::UID to run this stuff for us later
 #$FS::UID::callback{'FS::cust_main'} = sub { 
@@ -1219,6 +1220,9 @@ sub check {
     || $self->ut_country('country')
     || $self->ut_anything('comments')
     || $self->ut_numbern('referral_custnum')
+    || $self->ut_textn('stateid')
+    || $self->ut_textn('stateid_state')
+    || $self->ut_textn('invoice_terms')
   ;
   #barf.  need message catalogs.  i18n.  etc.
   $error .= "Please select an advertising source."
@@ -1333,6 +1337,7 @@ sub check {
   $error =    $self->ut_numbern('paystart_month')
            || $self->ut_numbern('paystart_year')
            || $self->ut_numbern('payissue')
+           || $self->ut_textn('paytype')
   ;
   return $error if $error;
 
@@ -2771,15 +2776,7 @@ sub realtime_bop {
     unless ( $transaction->error_message ) {
 
       my $t_response;
-      #this should be normalized :/
-      #
-      # bad, ad-hoc B:OP:PayflowPro "transaction_response" BS
-      if ( $transaction->can('param')
-           && $transaction->param('transaction_response') ) {
-        $t_response = $transaction->param('transaction_response')
-
-      # slightly better, ad-hoc B:OP:TransactionCentral without "param"
-      } elsif ( $transaction->can('response_page') ) {
+      if ( $transaction->can('response_page') ) {
         $t_response = {
                         'page'    => ( $transaction->can('response_page')
                                          ? $transaction->response_page
@@ -4141,6 +4138,22 @@ sub fuzzy_search {
 
 }
 
+=item masked FIELD
+
+Returns a masked version of the named field
+
+=cut
+
+sub masked {
+my ($self,$field) = @_;
+
+# Show last four
+
+'x'x(length($self->getfield($field))-4).
+  substr($self->getfield($field), (length($self->getfield($field))-4));
+
+}
+
 =back
 
 =head1 SUBROUTINES