Simplify/Refund.pm untested

filter: Statementstmt 0.0% 0 / 28 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 39 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::Refund;
2  
3 =head1 NAME
4  
5 Net::Simplify::Refund - A Simplify Commerce Refund 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 Refund.
16 my $refund = Net::Simplify::Refund->create{ {...});
17  
18 # Retrieve a Refund given its ID.
19 my $refund = Net::Simplify::Refund->find('a7e41');
20  
21 # Retrieve a list of objects
22 my $refunds = Net::Simplify::Refund->list({max => 10});
23 foreach my $v ($refunds->list) {
24 # ...
25 }
26  
27 =head1 DESCRIPTION
28  
29 =head2 METHODS
30  
31 =head3 create(%params, $auth)
32  
33 Creates a C<Net::Simplify::Refund> object. The parameters are:
34  
35 =over 4
36  
37 =item C<%params>
38  
39 Hash map containing initial values for the object. Valid keys are:
40  
41 =over 4
42  
43 =item amount
44  
45 Amount of the refund in the smallest unit of your currency. Example: 100 = $1.00 (B<required>)
46  
47 =item payment
48  
49 ID of the payment for the refund
50  
51 =item reason
52  
53 Reason for the refund
54  
55 =item reference
56  
57 Custom reference field to be used with outside systems.
58  
59 =item replayId
60  
61 An identifier that can be sent to uniquely identify a refund request to facilitate retries due to I/O related issues. This identifier must be unique for your account (sandbox or live) across all of your refunds. If supplied, we will check for a refund on your account that matches this identifier. If found we will return an identical response to that of the original request. [max length: 50, min length: 1]
62  
63  
64  
65 =item statementDescription.name
66  
67 Merchant name. (B<required>)
68  
69 =item statementDescription.phoneNumber
70  
71 Merchant contact phone number.
72  
73  
74 =back
75  
76 =item C<$auth>
77  
78 Authentication object for accessing the API. If no value is passed the global keys
79 C<$Net::Simplify::public_key> and C<$Net::Simplify::private_key> are used.
80  
81 =back
82  
83  
84  
85  
86 =head3 list(%criteria, $auth)
87  
88 Retrieve a list of C<Net::Simplify::Refund> objects. The parameters are:
89  
90 =over 4
91  
92 =item C<%criteria>
93  
94 Hash map representing the criteria to limit the results of the list operation. Valid keys are:
95  
96 =over 4
97  
98 =item C<filter>
99  
100 <table class="filter_list"><tr><td>filter.id</td><td>Filter by the refund Id</td></tr><tr><td>filter.text</td><td>Filter by the refund description text</td></tr><tr><td>filter.replayId</td><td>Filter by the compoundReplayId</td></tr><tr><td>filter.authCode</td><td>Filter by the authorization code (Not authorization ID)</td></tr><tr><td>filter.amount</td><td>Filter by the refund amount (in the smallest unit of your currency)</td></tr><tr><td>filter.dateCreatedMin<sup>*</sup></td><td>Filter by the minimum created date you are searching for - Date in UTC millis</td></tr><tr><td>filter.dateCreatedMax<sup>*</sup></td><td>Filter by the maximum created date you are searching for - Date in UTC millis</td></tr><tr><td>filter.deposit</td><td>Filter by the deposit id</td></tr><tr><td>filter.q</td><td>You can use this to filter by the Id, the authCode or the amount of the refund</td></tr></table><br><sup>*</sup>Use dateCreatedMin with dateCreatedMax in the same filter if you want to search between two created dates
101  
102  
103  
104 =item C<max>
105  
106 Allows up to a max of 50 list items to return. [min value: 0, max value: 50, default: 20]
107  
108  
109  
110 =item C<offset>
111  
112 Used in paging of the list. This is the start offset of the page. [min value: 0, default: 0]
113  
114  
115  
116 =item C<sorting>
117  
118 Allows for ascending or descending sorting of the list.
119 The value maps properties to the sort direction (either C<asc> for ascending or C<desc> for descending). Sortable properties are:
120  
121 =over 4
122  
123 =item C<id>
124  
125 =item C<amount>
126  
127 =item C<description>
128  
129 =item C<dateCreated>
130  
131 =item C<paymentDate>
132  
133  
134 =back
135  
136  
137  
138  
139 =back
140  
141 =back
142  
143  
144  
145 =head3 find($id, $auth)
146  
147 Retrieve a C<Net::Simplify::Refund> object from the API. Parameters are:
148  
149 =over 4
150  
151 =item C<$id>
152  
153 Identifier of the object to retrieve.
154  
155 =item C<$auth>
156  
157 Authentication object for accessing the API. If no value is passed the global keys
158 C<$Net::Simplify::public_key> and C<$Net::Simplify::private_key> are used.
159  
160 =back
161  
162  
163  
164  
165  
166 =head1 SEE ALSO
167  
168 L<Net::Simplify>,
169 L<Net::Simplify::Domain>,
170 L<Net::Simplify::DomainList>,
171 L<Net::Simplify::Authentication>,
172 L<Net::Simplify::ApiException>,
173 L<http://www.simplify.com>
174  
175 =head1 VERSION
176  
177 1.6.0
178  
179 =head1 LICENSE
180  
181 Copyright (c) 2013 - 2022 MasterCard International Incorporated
182 All rights reserved.
183  
184 Redistribution and use in source and binary forms, with or without modification, are
185 permitted provided that the following conditions are met:
186  
187 Redistributions of source code must retain the above copyright notice, this list of
188 conditions and the following disclaimer.
189 Redistributions in binary form must reproduce the above copyright notice, this list of
190 conditions and the following disclaimer in the documentation and/or other materials
191 provided with the distribution.
192 Neither the name of the MasterCard International Incorporated nor the names of its
193 contributors may be used to endorse or promote products derived from this software
194 without specific prior written permission.
195 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
196 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
197 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
198 SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
199 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
200 TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
201 OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
202 IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
203 IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
204 SUCH DAMAGE.
205  
206 =head1 SEE ALSO
207  
208 =cut
209  
210 use 5.006;
211 use strict;
212 use warnings FATAL => 'all';
213  
214 use Net::Simplify::Domain;
215 use Net::Simplify::DomainList;
216  
217 our @ISA = qw(Net::Simplify::Domain);
218  
219 sub create {
220  
221 my ($class, $params, $auth) = @_;
222
223 $auth = Net::Simplify::SimplifyApi->get_authentication($auth);
224 my $result = Net::Simplify::SimplifyApi->send_api_request("refund", 'create', $params, $auth);
225  
226 $class->SUPER::new($result, $auth);
227 }
228  
229 sub list {
230 my ($class, $criteria, $auth) = @_;
231
232 $auth = Net::Simplify::SimplifyApi->get_authentication($auth);
233 my $result = Net::Simplify::SimplifyApi->send_api_request("refund", 'list', $criteria, $auth);
234  
235 Net::Simplify::DomainList->new($result, $class, $auth);
236 }
237  
238 sub find {
239 my ($class, $id, $auth) = @_;
240  
241 $auth = Net::Simplify::SimplifyApi->get_authentication($auth);
242 my $result = Net::Simplify::SimplifyApi->send_api_request("refund", 'find', { id => $id }, $auth);
243  
244 $class->SUPER::new($result, $auth);
245 }
246  
247  
248 1;