File Coverage

blib/lib/Business/MaxMind/CreditCardFraudDetection.pm
Criterion Covered Total %
statement 19 27 70.3
branch 0 8 0.0
condition 1 2 50.0
subroutine 5 6 83.3
pod 0 1 0.0
total 25 44 56.8


line stmt bran cond sub pod time code
1             package Business::MaxMind::CreditCardFraudDetection;
2              
3 1     1   16399 use strict;
  1         2  
  1         31  
4              
5 1     1   4 use Digest::MD5;
  1         1  
  1         36  
6 1     1   603 use LWP::UserAgent;
  1         62130  
  1         30  
7 1     1   8 use base 'Business::MaxMind::HTTPBase';
  1         1  
  1         432  
8              
9             our $VERSION = '1.57';
10              
11             # input fields
12             my @allowed_fields
13             = qw/i city region postal country domain bin binName binPhone
14             custPhone emailMD5 usernameMD5 passwordMD5 shipAddr shipCity
15             shipRegion shipPostal shipCountry txnID sessionID user_agent
16             accept_language order_amount order_currency shopID avs_result
17             cvv_result txn_type license_key requested_type forwardedIP/;
18              
19             sub _init {
20 2     2   4 my $self = shift;
21 2         4 $self->{url} = 'app/ccv2r';
22 2         4 $self->{check_field} = 'countryMatch';
23 2   50     13 $self->{timeout} ||= 10
24             ; # provide a default value of 10 seconds for timeout if not set by user
25 2         5 %{ $self->{allowed_fields} } = map { $_ => 1 } @allowed_fields;
  2         44  
  62         74  
26             }
27              
28             sub filter_field {
29 0     0 0   my ( $self, $name, $value ) = @_;
30              
31 0 0         if ( $name eq 'emailMD5' ) {
32 0 0         if ( $value =~ m!\@! ) {
33 0           return Digest::MD5::md5_hex( lc($value) );
34             }
35             }
36              
37 0 0         if ( $name =~ m!(username|password)MD5$! ) {
38 0 0         if ( length($value) != 32 ) {
39 0           return Digest::MD5::md5_hex( lc($value) );
40             }
41             }
42              
43 0           return $value;
44             }
45              
46             1;
47              
48             # ABSTRACT: Access MaxMind minFraud services
49              
50             __END__