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 );
=over 4
-=item paynum - primary key (assigned automatically for new payments)
+=item paynum
-=item custnum - customer (see L<FS::cust_main>)
+primary key (assigned automatically for new payments)
-=item _date - specified as a UNIX timestamp; see L<perlfunc/"time">. Also see
+=item custnum
+
+customer (see L<FS::cust_main>)
+
+=item _date
+
+specified as a UNIX timestamp; see L<perlfunc/"time">. Also see
L<Time::Local> and L<Date::Parse> for conversion functions.
-=item paid - Amount of this payment
+=item paid
+
+Amount of this payment
+
+=item otaker
+
+order taker (assigned automatically, see L<FS::UID>)
+
+=item payby
+
+Payment Type (See L<FS::payinfo_Mixin> for valid payby values)
-=item otaker - order taker (assigned automatically, see L<FS::UID>)
+=item payinfo
-=item payby - Payment Type (See L<FS::payinfo_Mixin> for valid payby values)
+Payment Information (See L<FS::payinfo_Mixin> for data format)
-=item payinfo - Payment Information (See L<FS::payinfo_Mixin> for data format)
+=item paymask
-=item paymask - Masked payinfo (See L<FS::payinfo_Mixin> for how this works)
+Masked payinfo (See L<FS::payinfo_Mixin> 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
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'),
} ) ],
);
return $error;
}
- if ( $conf->config('deletepayments') ne '' ) {
+ if ( $conf->exists('deletepayments')
+ && $conf->config('deletepayments') ne '' ) {
my $cust_main = $self->cust_main;
|| $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;