X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_payby.pm;h=030aed6f278ae5e310437c596583df03ce231b4b;hb=22bd37d2213235a66015538fe573175cf30b6624;hp=79a1468581a84d29b76627abe3c0bb4c287025f2;hpb=461cf66878e2d63d0360184aeeebcbc0e45acfb9;p=freeside.git diff --git a/FS/FS/cust_payby.pm b/FS/FS/cust_payby.pm index 79a146858..030aed6f2 100644 --- a/FS/FS/cust_payby.pm +++ b/FS/FS/cust_payby.pm @@ -19,6 +19,7 @@ sub nohistory_fields { ('payinfo', 'paycvv'); } our $ignore_expired_card = 0; our $ignore_banned_card = 0; our $ignore_invalid_card = 0; +our $ignore_cardtype = 0; our $conf; install_callback FS::UID sub { @@ -496,6 +497,10 @@ sub check { sub check_payinfo_cardtype { my $self = shift; + return '' if $ignore_cardtype; + + return '' unless $self->payby =~ /^(CARD|CHEK)$/; + my $payinfo = $self->payinfo; $payinfo =~ s/\D//g; @@ -558,6 +563,39 @@ sub paydate_mon_year { } +=item label + +Returns a one line text label for this payment type. + +=cut + +my %weight = ( + 1 => 'Primary', + 2 => 'Secondary', + 3 => 'Tertiary', + 4 => 'Fourth', + 5 => 'Fifth', + 6 => 'Sixth', + 7 => 'Seventh', +); + +sub label { + my $self = shift; + + my $name = $self->payby =~ /^(CARD|DCRD)$/ + && cardtype($self->paymask) || FS::payby->shortname($self->payby); + + ( $self->payby =~ /^(CARD|CHEK)$/ ? $weight{$self->weight}. ' automatic ' + : 'Manual ' + ). + "$name: ". $self->paymask. + ( $self->payby =~ /^(CARD|DCRD)$/ + ? ' Exp '. join('/', $self->paydate_mon_year) + : '' + ); + +} + =item realtime_bop =cut