File Coverage

blib/lib/WebService/MinFraud/Model/Factors.pm
Criterion Covered Total %
statement 46 46 100.0
branch n/a
condition n/a
subroutine 16 16 100.0
pod n/a
total 62 62 100.0


line stmt bran cond sub pod time code
1             package WebService::MinFraud::Model::Factors;
2              
3 2     2   112007 use Moo;
  2         8776  
  2         9  
4 2     2   1781 use namespace::autoclean;
  2         9441  
  2         8  
5              
6             our $VERSION = '1.010000';
7              
8 2     2   600 use Types::Standard qw( HashRef InstanceOf );
  2         61904  
  2         20  
9 2     2   2093 use WebService::MinFraud::Record::BillingAddress;
  2         7  
  2         87  
10 2     2   783 use WebService::MinFraud::Record::Country;
  2         8  
  2         65  
11 2     2   868 use WebService::MinFraud::Record::CreditCard;
  2         6  
  2         58  
12 2     2   817 use WebService::MinFraud::Record::Device;
  2         6  
  2         69  
13 2     2   804 use WebService::MinFraud::Record::Disposition;
  2         5  
  2         58  
14 2     2   754 use WebService::MinFraud::Record::Email;
  2         7  
  2         59  
15 2     2   826 use WebService::MinFraud::Record::IPAddress;
  2         7  
  2         78  
16 2     2   15 use WebService::MinFraud::Record::Issuer;
  2         5  
  2         38  
17 2     2   10 use WebService::MinFraud::Record::Location;
  2         4  
  2         36  
18 2     2   923 use WebService::MinFraud::Record::ShippingAddress;
  2         7  
  2         63  
19 2     2   839 use WebService::MinFraud::Record::Subscores;
  2         7  
  2         66  
20 2     2   932 use WebService::MinFraud::Record::Warning;
  2         7  
  2         192  
21              
22             with 'WebService::MinFraud::Role::Model',
23             'WebService::MinFraud::Role::HasLocales',
24             'WebService::MinFraud::Role::HasCommonAttributes';
25              
26             ## no critic (ProhibitUnusedPrivateSubroutines)
27 32     32   1962 sub _has { has(@_) }
28             ## use critic
29              
30             __PACKAGE__->_define_model_attributes(
31             billing_address => 'BillingAddress',
32             credit_card => 'CreditCard',
33             device => 'Device',
34             disposition => 'Disposition',
35             email => 'Email',
36             ip_address => 'IPAddress',
37             shipping_address => 'ShippingAddress',
38             subscores => 'Subscores',
39             );
40              
41             1;
42              
43             # ABSTRACT: Model class for minFraud Factors
44              
45             __END__
46              
47             =pod
48              
49             =encoding UTF-8
50              
51             =head1 NAME
52              
53             WebService::MinFraud::Model::Factors - Model class for minFraud Factors
54              
55             =head1 VERSION
56              
57             version 1.010000
58              
59             =head1 SYNOPSIS
60              
61             use 5.010;
62              
63             use WebService::MinFraud::Client;
64              
65             my $client = WebService::MinFraud::Client->new(
66             account_id => 42,
67             license_key => 'abcdef123456',
68             );
69              
70             my $request = { device => { ip_address => '24.24.24.24' } };
71             my $factors = $client->factors($request);
72              
73             my $shipping_address = $factors->shipping_address;
74             say $shipping_address->is_high_risk;
75              
76             my $ip_address = $factors->ip_address;
77             my $postal = $ip_address->postal;
78             say $postal->code;
79              
80             say $factors->device->id;
81              
82             =head1 DESCRIPTION
83              
84             This class provides a model for the data returned by the minFraud Factors web
85             service.
86              
87             The Factors model class includes more data than the Score model class. See
88             the L<API
89             documentation|https://dev.maxmind.com/minfraud/>
90             for more details.
91              
92             =head1 METHODS
93              
94             This model class provides the following methods:
95              
96             =head2 billing_address
97              
98             Returns a L<WebService::MinFraud::Record::BillingAddress> object representing
99             billing data for the transaction.
100              
101             =head2 credit_card
102              
103             Returns a L<WebService::MinFraud::Record::CreditCard> object representing
104             credit card data for the transaction.
105              
106             =head2 device
107              
108             Returns a L<WebService::MinFraud::Record::Device> object representing the
109             device that MaxMind believes is associated with the IP address passed in the
110             request.
111              
112             =head2 disposition
113              
114             Returns a L<WebService::MinFraud::Record::Disposition> object representing the
115             disposition set for the transaction using custom rules.
116              
117             =head2 funds_remaining
118              
119             Returns the I<approximate> US dollar value of the funds remaining on your
120             account. The fund calculation is near realtime so it may not be exact.
121              
122             =head2 id
123              
124             Returns a UUID that identifies the minFraud request. Please use this UUID in
125             bug reports or support requests to MaxMind so that we can easily identify a
126             particular request.
127              
128             =head2 ip_address
129              
130             Returns a L<WebService::MinFraud::Record::IPAddress> object representing IP
131             address data for the transaction. This object has the following methods:
132              
133             =over 4
134              
135             =item * C<< city >>
136              
137             =item * C<< continent >>
138              
139             =item * C<< country >>
140              
141             =item * C<< most_specific_subdivision >>
142              
143             =item * C<< postal >>
144              
145             =item * C<< registered_country >>
146              
147             =item * C<< represented_country >>
148              
149             =item * C<< risk >>
150              
151             =item * C<< subdivisions >>
152              
153             =item * C<< traits >>
154              
155             =back
156              
157             For details, please refer to L<WebService::MinFraud::Record::IPAddress/METHODS>.
158              
159             =head2 risk_score
160              
161             Returns the risk score which is a number between 0.01 and 99. A higher score
162             indicates a higher risk of fraud.
163              
164             =head2 queries_remaining
165              
166             Returns the I<approximate> number of queries remaining for this service before
167             your account runs out of funds. The query counts are near realtime so they may
168             not be exact.
169              
170             =head2 shipping_address
171              
172             Returns a L<WebService::MinFraud::Record::ShippingAddress> object representing
173             shipping data for the transaction.
174              
175             =head2 subscores
176              
177             Returns a L<WebService::MinFraud::Record::Subscores> object containing
178             subscores used in calculating the overall risk score.
179              
180             =head2 warnings
181              
182             Returns an ArrayRef of L<WebService::MinFraud::Record::Warning> objects. It is
183             B<highly recommended that you check this array> for issues when integrating the
184             web service.
185              
186             =head1 PREDICATE METHODS
187              
188             The following predicate methods are available, which return true if the related
189             data was present in the response body, false if otherwise:
190              
191             =head2 has_funds_remaining
192              
193             =head2 has_id
194              
195             =head2 has_queries_remaining
196              
197             =head2 has_risk_score
198              
199             =head2 has_warnings
200              
201             =head1 SUPPORT
202              
203             Bugs may be submitted through L<https://github.com/maxmind/minfraud-api-perl/issues>.
204              
205             =head1 AUTHOR
206              
207             Mateu Hunter <mhunter@maxmind.com>
208              
209             =head1 COPYRIGHT AND LICENSE
210              
211             This software is copyright (c) 2015 - 2020 by MaxMind, Inc.
212              
213             This is free software; you can redistribute it and/or modify it under
214             the same terms as the Perl 5 programming language system itself.
215              
216             =cut