Simplify/FraudCheck.pm untested

filter: Statementstmt 0.0% 0 / 34 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 9 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 47 CC 1 SCAR 6.9
CC
1
Cov
0%
create
2.0
list
2.0
find
2.0
CRAP 2.0
1 package Net::Simplify::FraudCheck;
2  
3 =head1 NAME
4  
5 Net::Simplify::FraudCheck - A Simplify Commerce FraudCheck object
6  
7 =head1 SYNOPSIS
8  
9 use Net::Simplify;
10  
11  
12 $Net::Simplify::public_key = 'YOUR PUBLIC KEY';
13 $Net::Simplify::private_key = 'YOUR PRIVATE KEY';
14  
15 # Create a new FraudCheck.
16 my $fraud_check = Net::Simplify::FraudCheck->create{ {...});
17  
18 # Retrieve a FraudCheck given its ID.
19 my $fraud_check = Net::Simplify::FraudCheck->find('a7e41');
20  
21 # Update existing FraudCheck.
22 my $fraud_check = Net::Simplify::FraudCheck->find('a7e41');
23 $fraud_check->{PROPERTY} = "NEW VALUE";
24 $fraud_check->update();
25  
26 # Retrieve a list of objects
27 my $fraud_checks = Net::Simplify::FraudCheck->list({max => 10});
28 foreach my $v ($fraud_checks->list) {
29 # ...
30 }
31  
32 =head1 DESCRIPTION
33  
34 =head2 METHODS
35  
36 =head3 create(%params, $auth)
37  
38 Creates a C<Net::Simplify::FraudCheck> object. The parameters are:
39  
40 =over 4
41  
42 =item C<%params>
43  
44 Hash map containing initial values for the object. Valid keys are:
45  
46 =over 4
47  
48 =item amount
49  
50 Amount of the transaction to be checked for fraud (in the smallest unit of your currency). Example: 100 = $1.00. This field is required if using “full” or “advanced” mode.
51  
52  
53  
54 =item card.addressCity
55  
56 City of the cardholder. [max length: 50, min length: 2]
57  
58 =item card.addressCountry
59  
60 Country code (ISO-3166-1-alpha-2 code) of residence of the cardholder. [max length: 2, min length: 2]
61  
62 =item card.addressLine1
63  
64 Address of the cardholder. [max length: 255]
65  
66 =item card.addressLine2
67  
68 Address of the cardholder if needed. [max length: 255]
69  
70 =item card.addressState
71  
72 State of residence of the cardholder. State abbreviations should be used. [max length: 255]
73  
74 =item card.addressZip
75  
76 Postal code of the cardholder. The postal code size is between 5 and 9 characters in length and only contains numbers or letters. [max length: 32]
77  
78 =item card.cvc
79  
80 CVC security code of the card. This is the code on the back of the card. Example: 123
81  
82 =item card.expMonth
83  
84 Expiration month of the card. Format is MM. Example: January = 01 [min value: 1, max value: 12]
85  
86 =item card.expYear
87  
88 Expiration year of the card. Format is YY. Example: 2013 = 13 [min value: 0, max value: 99]
89  
90 =item card.name
91  
92 Name as it appears on the card. [max length: 50, min length: 2]
93  
94 =item card.number
95  
96 Card number as it appears on the card. [max length: 19, min length: 13]
97  
98 =item currency
99  
100 Currency code (ISO-4217) for the transaction to be checked for fraud. This field is required if using “full” or “advanced” mode.
101  
102 =item description
103  
104 - Description of the fraud check. [max length: 255]
105  
106 =item ipAddress
107  
108 IP Address of the customer for which the fraud check is to be done. [max length: 45]
109  
110 =item mode
111  
112 Fraud check mode. “simple” only does an AVS and CVC check; “advanced” does a complete fraud check, running the input against the set up rules. [valid values: simple, advanced, full, SIMPLE, ADVANCED, FULL] (B<required>)
113  
114 =item sessionId
115  
116 Session ID used during data collection. [max length: 255]
117  
118 =item token
119  
120 Card token representing card details for the card to be checked. [max length: 255]
121  
122  
123 =back
124  
125 =item C<$auth>
126  
127 Authentication object for accessing the API. If no value is passed the global keys
128 C<$Net::Simplify::public_key> and C<$Net::Simplify::private_key> are used.
129  
130 =back
131  
132  
133  
134  
135 =head3 list(%criteria, $auth)
136  
137 Retrieve a list of C<Net::Simplify::FraudCheck> objects. The parameters are:
138  
139 =over 4
140  
141 =item C<%criteria>
142  
143 Hash map representing the criteria to limit the results of the list operation. Valid keys are:
144  
145 =over 4
146  
147 =item C<filter>
148  
149 Filters to apply to the list.
150  
151  
152  
153 =item C<max>
154  
155 Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20]
156  
157  
158  
159 =item C<offset>
160  
161 Used in paging of the list. This is the start offset of the page. [min value: 0, default: 0]
162  
163  
164  
165 =item C<sorting>
166  
167 Allows for ascending or descending sorting of the list.
168 The value maps properties to the sort direction (either C<asc> for ascending or C<desc> for descending). Sortable properties are:
169  
170 =over 4
171  
172 =item C<amount>
173  
174 =item C<dateCreated>
175  
176 =item C<fraudResult>
177  
178  
179 =back
180  
181  
182  
183  
184 =back
185  
186 =back
187  
188  
189  
190 =head3 find($id, $auth)
191  
192 Retrieve a C<Net::Simplify::FraudCheck> object from the API. Parameters are:
193  
194 =over 4
195  
196 =item C<$id>
197  
198 Identifier of the object to retrieve.
199  
200 =item C<$auth>
201  
202 Authentication object for accessing the API. If no value is passed the global keys
203 C<$Net::Simplify::public_key> and C<$Net::Simplify::private_key> are used.
204  
205 =back
206  
207  
208  
209  
210 =head3 update()
211  
212 Update C<Net::Simplify::FraudCheck> object.
213 The properties that can be updated are:
214  
215 =over 4
216  
217  
218  
219 =item C<integratorAuthCode>
220  
221 Authorization code for the transaction. [max length: 255]
222  
223 =item C<integratorAvsAddressResponse>
224  
225 AVS address response. [max length: 255]
226  
227 =item C<integratorAvsZipResponse>
228  
229 AVS zip response. [max length: 255]
230  
231 =item C<integratorCvcResponse>
232  
233 CVC response. [max length: 255]
234  
235 =item C<integratorDeclineReason>
236  
237 Reason for the decline if applicable. [max length: 255]
238  
239 =item C<integratorTransactionRef>
240  
241 Reference id for the transaction. [max length: 255] (B<required>)
242  
243 =item C<integratorTransactionStatus>
244  
245 Status of the transaction, valid values are "APPROVED", "DECLINED", "SETTLED", "REFUNDED" or "VOIDED".
246  
247 Authentication is done using the same credentials used when the AccessToken was created.
248  
249 =back
250  
251  
252  
253  
254 =head1 SEE ALSO
255  
256 L<Net::Simplify>,
257 L<Net::Simplify::Domain>,
258 L<Net::Simplify::DomainList>,
259 L<Net::Simplify::Authentication>,
260 L<Net::Simplify::ApiException>,
261 L<http://www.simplify.com>
262  
263 =head1 VERSION
264  
265 1.6.0
266  
267 =head1 LICENSE
268  
269 Copyright (c) 2013 - 2022 MasterCard International Incorporated
270 All rights reserved.
271  
272 Redistribution and use in source and binary forms, with or without modification, are
273 permitted provided that the following conditions are met:
274  
275 Redistributions of source code must retain the above copyright notice, this list of
276 conditions and the following disclaimer.
277 Redistributions in binary form must reproduce the above copyright notice, this list of
278 conditions and the following disclaimer in the documentation and/or other materials
279 provided with the distribution.
280 Neither the name of the MasterCard International Incorporated nor the names of its
281 contributors may be used to endorse or promote products derived from this software
282 without specific prior written permission.
283 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
284 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
285 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
286 SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
287 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
288 TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
289 OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
290 IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
291 IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
292 SUCH DAMAGE.
293  
294 =head1 SEE ALSO
295  
296 =cut
297  
298 use 5.006;
299 use strict;
300 use warnings FATAL => 'all';
301  
302 use Net::Simplify::Domain;
303 use Net::Simplify::DomainList;
304  
305 our @ISA = qw(Net::Simplify::Domain);
306  
307 sub create {
308  
309 my ($class, $params, $auth) = @_;
310
311 $auth = Net::Simplify::SimplifyApi->get_authentication($auth);
312 my $result = Net::Simplify::SimplifyApi->send_api_request("fraudCheck", 'create', $params, $auth);
313  
314 $class->SUPER::new($result, $auth);
315 }
316  
317 sub list {
318 my ($class, $criteria, $auth) = @_;
319
320 $auth = Net::Simplify::SimplifyApi->get_authentication($auth);
321 my $result = Net::Simplify::SimplifyApi->send_api_request("fraudCheck", 'list', $criteria, $auth);
322  
323 Net::Simplify::DomainList->new($result, $class, $auth);
324 }
325  
326 sub find {
327 my ($class, $id, $auth) = @_;
328  
329 $auth = Net::Simplify::SimplifyApi->get_authentication($auth);
330 my $result = Net::Simplify::SimplifyApi->send_api_request("fraudCheck", 'find', { id => $id }, $auth);
331  
332 $class->SUPER::new($result, $auth);
333 }
334  
335 sub update {
336  
337 my ($self) = @_;
338  
339 my $auth = Net::Simplify::SimplifyApi->get_authentication($self->{_authentication});
340 my $params = { %$self };
341 delete $params->{_authentication};
342  
343 $self->merge(Net::Simplify::SimplifyApi->send_api_request("fraudCheck", 'update', $params, $auth));
344 }
345  
346  
347 1;