X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fcust_payby.pm;h=ec4eb7a5920eb8908dfeea845ddcd7be2a325dd5;hp=030aed6f278ae5e310437c596583df03ce231b4b;hb=f8b1ee4818c40fa7cbc7dd060efb24df87c1669c;hpb=d860f85d2a4823a040996f9b1055e2d4054b864e diff --git a/FS/FS/cust_payby.pm b/FS/FS/cust_payby.pm index 030aed6f2..ec4eb7a59 100644 --- a/FS/FS/cust_payby.pm +++ b/FS/FS/cust_payby.pm @@ -237,6 +237,11 @@ sub replace { { 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'; @@ -489,7 +494,11 @@ sub check { } - ### + if ( ! $self->custpaybynum + && $conf->exists('business-onlinepayment-verification') ) { + $error = $self->verify; + return $error if $error; + } $self->SUPER::check; } @@ -617,6 +626,30 @@ sub realtime_bop { } +=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