File Coverage

blib/lib/WebService/MinFraud/Model/Insights.pm
Criterion Covered Total %
statement 43 43 100.0
branch n/a
condition n/a
subroutine 15 15 100.0
pod n/a
total 58 58 100.0


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