#first try void if applicable
if ( $cust_pay && $cust_pay->paid == $amount ) { #and check dates?
+ warn "FS::cust_main::realtime_bop: attempting void\n" if $DEBUG;
my $void = new Business::OnlinePayment( $processor, @bop_options );
$void->content( 'action' => 'void', %content );
$void->submit();
warn $e;
return $e;
}
+ warn "FS::cust_main::realtime_bop: void successful\n" if $DEBUG;
return '';
}
}
+ warn "FS::cust_main::realtime_bop: void unsuccessful, trying refund\n"
+ if $DEBUG;
+
#massage data
my $address = $self->address1;
$address .= ", ". $self->address2 if $self->address2;
$payname = "$payfirst $paylast";
}
- if ( $method eq 'CC' ) {
-
- $content{card_number} = $self->payinfo;
- $self->paydate =~ /^\d{2}(\d{2})[\/\-](\d+)[\/\-]\d+$/;
- $content{expiration} = "$2/$1";
-
- #$content{cvv2} = $self->paycvv
- # if defined $self->dbdef_table->column('paycvv')
- # && length($self->paycvv);
+ if ( $method eq 'CC' ) {
- #$content{recurring_billing} = 'YES'
- # if qsearch('cust_pay', { 'custnum' => $self->custnum,
- # 'payby' => 'CARD',
- # 'payinfo' => $self->payinfo, } );
+ if ( $cust_pay ) {
+ $content{card_number} = $cust_pay->payinfo;
+ #$self->paydate =~ /^\d{2}(\d{2})[\/\-](\d+)[\/\-]\d+$/;
+ #$content{expiration} = "$2/$1";
+ } else {
+ $content{card_number} = $self->payinfo;
+ $self->paydate =~ /^\d{2}(\d{2})[\/\-](\d+)[\/\-]\d+$/;
+ $content{expiration} = "$2/$1";
+ }
} elsif ( $method eq 'ECHECK' ) {
( $content{account_number}, $content{routing_code} ) =
#then try refund
my $refund = new Business::OnlinePayment( $processor, @bop_options );
- $refund->content(
+ my %sub_content = $refund->content(
'action' => 'credit',
'customer_id' => $self->custnum,
'last_name' => $paylast,
'country' => $self->country,
%content, #after
);
+ warn join('', map { " $_ => $sub_content{$_}\n" } keys %sub_content )
+ if $DEBUG > 1;
$refund->submit();
return "$processor error: ". $refund->error_message