use FS::Misc qw(send_email);
use FS::cust_bill;
use FS::cust_bill_pay;
+use FS::cust_pay_refund;
use FS::cust_main;
@ISA = qw( FS::Record );
;
}
+=item cust_pay_refund
+
+Returns all applications of refunds (see L<FS::cust_pay_refund>) to this
+payment.
+
+=cut
+
+sub cust_pay_refund {
+ my $self = shift;
+ sort { $a->_date <=> $b->_date }
+ qsearch( 'cust_pay_refund', { 'paynum' => $self->paynum } )
+ ;
+}
+
+
=item unapplied
Returns the amount of this payment that is still unapplied; which is
-paid minus all payment applications (see L<FS::cust_bill_pay>).
+paid minus all payment applications (see L<FS::cust_bill_pay>) and refund
+applications (see L<FS::cust_pay_refund>).
=cut
my $self = shift;
my $amount = $self->paid;
$amount -= $_->amount foreach ( $self->cust_bill_pay );
+ $amount -= $_->amount foreach ( $self->cust_pay_refund );
sprintf("%.2f", $amount );
}
qsearchs( 'cust_main', { 'custnum' => $self->custnum } );
}
+=item payinfo_masked
-=back
+Returns a "masked" payinfo field with all but the last four characters replaced
+by 'x'es. Useful for displaying credit cards.
+
+=cut
-=head1 VERSION
+sub payinfo_masked {
+ my $self = shift;
+ my $payinfo = $self->payinfo;
+ 'x'x(length($payinfo)-4). substr($payinfo,(length($payinfo)-4));
+}
-$Id: cust_pay.pm,v 1.26 2003-09-10 10:54:46 ivan Exp $
+=back
=head1 BUGS
-Delete and replace methods.
+Delete and replace methods. payinfo_masked false laziness with cust_main.pm
+and cust_refund.pm
=head1 SEE ALSO