X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=OnlinePayment.pm;h=f0b1a92e0dadc3d19bc874276aa950b47433a89b;hb=e1bf5c280a8581314d4832de6d1baf2181b389c6;hp=3f95cd112701eb4f38fd0415a5be5cd414a65758;hpb=7e7195b0842a1c547cc4260ad4c25d1018961d27;p=Business-OnlinePayment.git diff --git a/OnlinePayment.pm b/OnlinePayment.pm index 3f95cd1..f0b1a92 100644 --- a/OnlinePayment.pm +++ b/OnlinePayment.pm @@ -6,7 +6,7 @@ use Carp; require 5.005; -$VERSION = '3.00_04'; +$VERSION = '3.00_05'; $VERSION = eval $VERSION; # modperlstyle: convert the string into a number # Remember subclasses we have "wrapped" submit() with _pre_submit() @@ -83,15 +83,17 @@ sub _risk_detect { if ( $risk_transaction->fraud_score <= $self->maximum_fraud_score()) { return 1; } else { - $self->is_success(0); $self->error_message('Excessive risk from risk management'); } } else { $self->error_message('Error in risk detection stage: ' . $risk_transaction->error_message); - $self->is_success(0); } + $self->is_success(0); + return 0; } +my @Fraud_Class_Path = qw(Business::OnlinePayment Business::FraudDetect); + sub _pre_submit { my ($self) = @_; my $fraud_detection = $self->fraud_detect(); @@ -100,14 +102,13 @@ sub _pre_submit { return 1 unless $fraud_detection; # Search for an appropriate FD module - foreach my $subclass ( q(Business::OnlinePayment::) . $fraud_detection, - q(Business::FraudDetect::) . $fraud_detection) { - + foreach my $fraud_class ( @Fraud_Class_Path ) { + my $subclass = $fraud_class . "::" . $fraud_detection; if (!defined(&$subclass)) { - eval "use $subclass"; + eval "use $subclass ()"; if ($@) { - Carp::croak("serious problem loading fraud_detection module ($@)") unless - $@ =~ m/^Can\'t locate/; + Carp::croak("error loading fraud_detection module ($@)") + unless ( $@ =~ m/^Can\'t locate/ ); } else { my $risk_tx = bless ( { processor => $fraud_detection } , $subclass ); $risk_tx->build_subs(keys %fields); @@ -119,6 +120,9 @@ sub _pre_submit { } } } + Carp::croak("Unable to locate fraud_detection module $fraud_detection" + . " in \@INC under Fraud_Class_Path (\@Fraud_Class_Path" + . " contains: @Fraud_Class_Path) (\@INC contains: @INC)"); } sub content {