}
+sub verify_payby {
+ my $p = shift;
+
+ my($context, $session, $custnum) = _custoragent_session_custnum($p);
+ return { 'error' => $session } if $context eq 'error';
+
+ my $cust_payby = qsearchs('cust_payby', {
+ 'custnum' => $custnum,
+ 'custpaybynum' => $p->{'custpaybynum'},
+ })
+ or return { 'error' => 'unknown custpaybynum '. $p->{'custpaybynum'} };
+
+ return { 'error' => $cust_payby->verify };
+
+}
+
sub delete_payby {
my $p = shift;
{
my $error = $self->check_payinfo_cardtype;
return $error if $error;
+
+ if ( $conf->exists('business-onlinepayment-verification') ) {
+ $error = $self->verify;
+ return $error if $error;
+ }
}
local $SIG{HUP} = 'IGNORE';
}
- ###
+ if ( ! $self->custpaybynum
+ && $conf->exists('business-onlinepayment-verification') ) {
+ $error = $self->verify;
+ return $error if $error;
+ }
$self->SUPER::check;
}
}
+=item verify
+
+=cut
+
+sub verify {
+ my $self = shift;
+ return '' unless $self->payby =~ /^(CARD|DCRD)$/;
+
+ my %opt = ();
+
+ $opt{$_} = $self->$_() for qw( payinfo payname paydate );
+
+ if ( $self->locationnum ) {
+ my $cust_location = $self->cust_location;
+ $opt{$_} = $cust_location->$_() for qw( address1 address2 city state zip );
+ }
+
+ $self->cust_main->realtime_verify_bop({
+ 'method' => FS::payby->payby2bop( $self->payby ),
+ %opt,
+ });
+
+}
+
=item paytypes
Returns a list of valid values for the paytype field (bank account type for