X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_pay.pm;h=e1e6df2a266a5d4912a48a3ab102ebb5e6aa7035;hb=5f92e7e7cb4a87f4e1b823a4684497cbda498b23;hp=583a724106ff33aa3dee2ead6f595ce85c9c3cbc;hpb=a4b8ce8cd1d309de00c64f38049a8dda38798046;p=freeside.git diff --git a/FS/FS/cust_pay.pm b/FS/FS/cust_pay.pm index 583a72410..e1e6df2a2 100644 --- a/FS/FS/cust_pay.pm +++ b/FS/FS/cust_pay.pm @@ -17,6 +17,7 @@ use FS::cust_bill; use FS::cust_bill_pay; use FS::cust_pay_refund; use FS::cust_main; +use FS::cust_pkg; use FS::cust_pay_void; @ISA = qw( FS::payinfo_transaction_Mixin FS::cust_main_Mixin FS::Record ); @@ -62,28 +63,54 @@ currently supported: =over 4 -=item paynum - primary key (assigned automatically for new payments) +=item paynum -=item custnum - customer (see L) +primary key (assigned automatically for new payments) -=item _date - specified as a UNIX timestamp; see L. Also see +=item custnum + +customer (see L) + +=item _date + +specified as a UNIX timestamp; see L. Also see L and L for conversion functions. -=item paid - Amount of this payment +=item paid + +Amount of this payment + +=item otaker + +order taker (assigned automatically, see L) + +=item payby + +Payment Type (See L for valid payby values) -=item otaker - order taker (assigned automatically, see L) +=item payinfo -=item payby - Payment Type (See L for valid payby values) +Payment Information (See L for data format) -=item payinfo - Payment Information (See L for data format) +=item paymask -=item paymask - Masked payinfo (See L for how this works) +Masked payinfo (See L for how this works) -=item paybatch - text field for tracking card processing or other batch grouping +=item paybatch -=item payunique - Optional unique identifer to prevent duplicate transactions. +text field for tracking card processing or other batch grouping -=item closed - books closed flag, empty or `Y' +=item payunique + +Optional unique identifer to prevent duplicate transactions. + +=item closed + +books closed flag, empty or `Y' + +=item pkgnum + +Desired pkgnum when using experimental package balances. =back @@ -216,22 +243,27 @@ sub insert { my $payby = $self->payby; my $payinfo = $self->payinfo; $payby =~ s/^BILL$/Check/ if $payinfo; - $payinfo = $self->paymask if $payby eq 'CARD' || $payby eq 'CHEK'; + if ( $payby eq 'CARD' || $payby eq 'CHEK' ) { + $payinfo = $self->paymask + } else { + $payinfo = $self->decrypt($payinfo); + } $payby =~ s/^CHEK$/Electronic check/; $error = send_email( - 'from' => $conf->config('invoice_from', $self->cust_main->agentnum), + 'from' => $conf->config('invoice_from', $cust_main->agentnum), #invoice_from??? well as good as any 'to' => \@invoicing_list, 'subject' => 'Payment receipt', 'body' => [ $receipt_template->fill_in( HASH => { - 'date' => time2str("%a %B %o, %Y", $self->_date), - 'name' => $cust_main->name, - 'paynum' => $self->paynum, - 'paid' => sprintf("%.2f", $self->paid), - 'payby' => ucfirst(lc($payby)), - 'payinfo' => $payinfo, - 'balance' => $cust_main->balance, + 'date' => time2str("%a %B %o, %Y", $self->_date), + 'name' => $cust_main->name, + 'paynum' => $self->paynum, + 'paid' => sprintf("%.2f", $self->paid), + 'payby' => ucfirst(lc($payby)), + 'payinfo' => $payinfo, + 'balance' => $cust_main->balance, + 'company_name' => $conf->config('company_name'), } ) ], ); @@ -340,7 +372,8 @@ sub delete { return $error; } - if ( $conf->config('deletepayments') ne '' ) { + if ( $conf->exists('deletepayments') + && $conf->config('deletepayments') ne '' ) { my $cust_main = $self->cust_main; @@ -411,6 +444,7 @@ sub check { || $self->ut_textn('paybatch') || $self->ut_textn('payunique') || $self->ut_enum('closed', [ '', 'Y' ]) + || $self->ut_foreign_keyn('pkgnum', 'cust_pkg', 'pkgnum') || $self->payinfo_check() ; return $error if $error;