MaxMind/CreditCardFraudDetection.pm

filter: Statementstmt 73.3% 22 / 30 Branchbran 0.0% 0 / 8 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 83.3% 5 / 6 Podpod 0.0% 0 / 1 totaltotal 58.3% 28 / 48 CC 6 SCAR 26.6
CC
6
Cov
58%
filter_field
30.0
_init
2.0
BEGIN
1.0
CRAP 14.4
« MaxMind/HTTPBase.pm ↑ Summary MaxMind.pm »
1 package Business::MaxMind::CreditCardFraudDetection;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 ▶use Digest::MD5;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use LWP::UserAgent;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use base 'Business::MaxMind::HTTPBase';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 our $VERSION = '1.60';
10  
11 # input fields
12 my @allowed_fields
13 1 = 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 2 ▶sub _init {
Subroutine _init: called CC=2 SCAR=7.0
20 2 my $self = shift;
21 2 $self->{url} = 'app/ccv2r';
22 2 $self->{check_field} = 'countryMatch';
23 2 ▶ $self->{timeout} ||= 10
Condition50%1/2
$self->{"timeout"} ||= 10
l!l
02
MC/DC0%0/1
$self->{"timeout"} ||= 10
$self->{"timeout"}
Truth table50%1/2
A
A= $self->{"timeout"}
Aresult
11
00
24 ; # provide a default value of 10 seconds for timeout if not set by user
25 2 %{ $self->{allowed_fields} } = map { $_ => 1 } @allowed_fields;
26 }
27  
28 0 ▶sub filter_field {
Subroutine filter_field: not called CC=5 SCAR=34.0
Pod undocumented
29 0 my ( $self, $name, $value ) = @_;
30  
31 0 ▶ if ( $name eq 'emailMD5' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($name eq "emailMD5") 0 0 0
32 0 ▶ if ( $value =~ m!\@! ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($value =~ /\@/) 0 0 0
33 0 return Digest::MD5::md5_hex( lc($value) );
34 }
35 }
36  
37 0 ▶ if ( $name =~ m!(username|password)MD5$! ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($name =~ /(username|password)MD5$/) 0 0 0
38 0 ▶ if ( length($value) != 32 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $value != 32) 0 0 0
39 0 return Digest::MD5::md5_hex( lc($value) );
40 }
41 }
42  
43 0 return $value;
44 }
45  
46 1 1;
47  
48 # ABSTRACT: Access MaxMind minFraud services
49  
50 __END__
« MaxMind/HTTPBase.pm ↑ Summary MaxMind.pm »