package FS::cust_pay;
use strict;
-use vars qw( @ISA $conf $unsuspendauto );
+use vars qw( @ISA $conf $unsuspendauto $ignore_noapply );
use Date::Format;
use Business::CreditCard;
use Text::Template;
@ISA = qw( FS::Record );
+$ignore_noapply = 0;
+
#ask FS::UID to run this stuff for us later
FS::UID->install_callback( sub {
$conf = new FS::Conf;
};
$error = $cust_bill_pay->insert;
if ( $error ) {
- $dbh->rollback if $oldAutoCommit;
- return "error inserting $cust_bill_pay: $error";
+ if ( $ignore_noapply ) {
+ warn "warning: error inserting $cust_bill_pay: $error ".
+ "(ignore_noapply flag set; inserting cust_pay record anyway)\n";
+ } else {
+ $dbh->rollback if $oldAutoCommit;
+ return "error inserting $cust_bill_pay: $error";
+ }
}
}
#my $cust_main = $self->cust_main;
if ( $conf->exists('payment_receipt_email')
- && grep { $_ ne 'POST' } $cust_main->invoicing_list
+ && grep { $_ !~ /^(POST|FAX)$/ } $cust_main->invoicing_list
) {
my $receipt_template = new Text::Template (
return '';
};
- my @invoicing_list = grep { $_ ne 'POST' } $cust_main->invoicing_list;
+ my @invoicing_list = grep { $_ !~ /^(POST|FAX)$/ } $cust_main->invoicing_list;
my $payby = $self->payby;
my $payinfo = $self->payinfo;
$payby =~ s/^BILL$/Check/ if $payinfo;
- $payinfo = $self->payinfo_masked if $payby eq 'CARD';
+ $payinfo = $self->payinfo_masked if $payby eq 'CARD' || $payby eq 'CHEK';
+ $payby =~ s/^CHEK$/Electronic check/;
my $error = send_email(
'from' => $conf->config('invoice_from'), #??? well as good as any
$self->_date(time) unless $self->_date;
- $self->payby =~ /^(CARD|CHEK|LECB|BILL|COMP)$/ or return "Illegal payby";
+ $self->payby =~ /^(CARD|CHEK|LECB|BILL|COMP|PREP)$/ or return "Illegal payby";
$self->payby($1);
#false laziness with cust_refund::check
sub payinfo_masked {
my $self = shift;
- my $payinfo = $self->payinfo;
- 'x'x(length($payinfo)-4). substr($payinfo,(length($payinfo)-4));
+ #some false laziness w/cust_main::paymask
+ if ( $self->payby eq 'CARD' ) {
+ my $payinfo = $self->payinfo;
+ 'x'x(length($payinfo)-4). substr($payinfo,(length($payinfo)-4));
+ } elsif ( $self->payby eq 'CHEK' ) {
+ my( $account, $aba ) = split('@', $self->payinfo );
+ 'x'x(length($account)-2). substr($account,(length($account)-2)). "@". $aba;
+ } else {
+ $self->payinfo;
+ }
}
=back