$paydate =~ /^\d{2}(\d{2})[\/\-](\d+)[\/\-]\d+$/;
$content{expiration} = "$2/$1";
- my $paycvv = exists($options{'paycvv'})
- ? $options{'paycvv'}
- : $self->paycvv;
- $content{cvv2} = $paycvv
- if length($paycvv);
+ $content{cvv2} = $options{'paycvv'}
+ if length($options{'paycvv'});
my $paystart_month = exists($options{'paystart_month'})
? $options{'paystart_month'}
###
# compare to FS::cust_main::save_cust_payby - check both to make sure working correctly
- if ( length($self->paycvv)
+ if ( length($options{'paycvv'})
&& ! grep { $_ eq cardtype($options{payinfo}) } $conf->config('cvv-save')
) {
- my $error = $self->remove_cvv;
+ my $error = $self->remove_cvv_from_cust_payby($options{payinfo});
if ( $error ) {
warn "WARNING: error removing cvv: $error\n";
}
$paydate =~ /^\d{2}(\d{2})[\/\-](\d+)[\/\-]\d+$/;
$content{expiration} = "$2/$1";
- my $paycvv = exists($options{'paycvv'})
- ? $options{'paycvv'}
- : $self->paycvv;
- $content{cvv2} = $paycvv
- if length($paycvv);
+ $content{cvv2} = $options{'paycvv'}
+ if length($options{'paycvv'});
my $paystart_month = exists($options{'paystart_month'})
? $options{'paystart_month'}
}
}
+ my $log = FS::Log->new('FS::cust_main::Billing_Realtime::realtime_verify_bop');
+
if ( $transaction->is_success() ) {
$cust_pay_pending->status('authorized');
my $e = "Authorization successful but reversal failed, custnum #".
$self->custnum. ': '. $reverse->result_code.
": ". $reverse->error_message;
+ $log->warning($e);
warn $e;
return $e;
# Neither address nor postal code matches N N N N
if (my $avscode = uc($transaction->avs_code)) {
+
# map codes to accept/warn/reject
my $avs = {
'American Express card' => {
my $cardtype = cardtype($content{card_number});
if ($avs->{$cardtype}) {
my $avsact = $avs->{$cardtype}->{$avscode};
+ my $warning = '';
if ($avsact eq 'r') {
return "AVS code verification failed, cardtype $cardtype, code $avscode";
} elsif ($avsact eq 'w') {
- warn "AVS code verification did not occur, cardtype $cardtype, code $avscode";
+ $warning = "AVS did not occur, cardtype $cardtype, code $avscode";
} elsif (!$avsact) {
- warn "AVS code verification did not occur, unknown avscode, cardtype $cardtype, code $avscode";
+ $warning = "AVS code unknown, cardtype $cardtype, code $avscode";
} # else $avsact eq 'a'
+ if ($warning) {
+ $log->warning($warning);
+ warn $warning;
+ }
} # else $cardtype avs handling not implemented
} # else !$transaction->avs_code
$self->payinfo($transaction->card_token);
my $error = $self->replace;
if ( $error ) {
- warn "WARNING: error storing token: $error, but proceeding anyway\n";
+ my $warning = "WARNING: error storing token: $error, but proceeding anyway\n";
+ $log->warning($warning);
+ warn $warning;
}
}