use FS::payby;
use FS::cust_pay;
use FS::cust_pay_pending;
+use FS::cust_bill_pay;
use FS::cust_refund;
use FS::banned_pay;
}
}
- $options->{payinfo} = $self->payinfo unless exists( $options->{payinfo} );
+ unless ( exists( $options->{'payinfo'} ) ) {
+ $options->{'payinfo'} = $self->payinfo;
+ $options->{'paymask'} = $self->paymask;
+ }
# Default invoice number if the customer has exactly one open invoice.
if( ! $options->{'invnum'} ) {
'_date' => '',
'payby' => $bop_method2payby{$options{method}},
'payinfo' => $options{payinfo},
+ 'paymask' => $options{paymask},
'paydate' => $paydate,
'recurring_billing' => $content{recurring_billing},
'pkgnum' => $options{'pkgnum'},
if ( $transaction->can('card_token') && $transaction->card_token ) {
- $self->card_token($transaction->card_token);
-
if ( $options{'payinfo'} eq $self->payinfo ) {
$self->payinfo($transaction->card_token);
my $error = $self->replace;
'_date' => '',
'payby' => $cust_pay_pending->payby,
'payinfo' => $options{'payinfo'},
+ 'paymask' => $options{'paymask'} || $cust_pay_pending->paymask,
'paydate' => $cust_pay_pending->paydate,
'pkgnum' => $cust_pay_pending->pkgnum,
'discount_term' => $options{'discount_term'},
warn " $_ => $options{$_}\n" foreach keys %options;
}
+ my %content = ();
+
###
# look up the original payment and optionally a gateway for that payment
###
or return "Unknown paynum $options{'paynum'}";
$amount ||= $cust_pay->paid;
+ my @cust_bill_pay = qsearch('cust_bill_pay', { paynum=>$cust_pay->paynum });
+ $content{'invoice_number'} = $cust_bill_pay[0]->invnum if @cust_bill_pay;
+
if ( $cust_pay->get('processor') ) {
($gatewaynum, $processor, $auth, $order_number) =
(
eval "use $namespace";
die $@ if $@;
- my %content = (
+ %content = (
+ %content,
'type' => $options{method},
'login' => $login,
'password' => $password,
$order_number = $refund->order_number if $refund->can('order_number');
+ # change this to just use $cust_pay->delete_cust_bill_pay?
while ( $cust_pay && $cust_pay->unapplied < $amount ) {
my @cust_bill_pay = $cust_pay->cust_bill_pay;
last unless @cust_bill_pay;