Simplify/TransactionReview.pm untested

filter: Statementstmt 0.0% 0 / 38 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 10 Podpod 0.0% 0 / 5 totaltotal 0.0% 0 / 53 CC 1 SCAR 6.9
CC
1
Cov
0%
create
2.0
delete
2.0
list
2.0
CRAP 2.0
1 package Net::Simplify::TransactionReview;
2  
3 =head1 NAME
4  
5 Net::Simplify::TransactionReview - A Simplify Commerce TransactionReview 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 TransactionReview.
16 my $transaction_review = Net::Simplify::TransactionReview->create{ {...});
17  
18 # Retrieve a TransactionReview given its ID.
19 my $transaction_review = Net::Simplify::TransactionReview->find('a7e41');
20  
21 # Update existing TransactionReview.
22 my $transaction_review = Net::Simplify::TransactionReview->find('a7e41');
23 $transaction_review->{PROPERTY} = "NEW VALUE";
24 $transaction_review->update();
25  
26 # Delete
27 my $transaction_review = Net::Simplify::TransactionReview->find('a7e41');
28 $transaction_review->delete();
29  
30 # Retrieve a list of objects
31 my $transaction_reviews = Net::Simplify::TransactionReview->list({max => 10});
32 foreach my $v ($transaction_reviews->list) {
33 # ...
34 }
35  
36 =head1 DESCRIPTION
37  
38 =head2 METHODS
39  
40 =head3 create(%params, $auth)
41  
42 Creates a C<Net::Simplify::TransactionReview> object. The parameters are:
43  
44 =over 4
45  
46 =item C<%params>
47  
48 Hash map containing initial values for the object. Valid keys are:
49  
50 =over 4
51  
52  
53 =back
54  
55 =item C<$auth>
56  
57 Authentication object for accessing the API. If no value is passed the global keys
58 C<$Net::Simplify::public_key> and C<$Net::Simplify::private_key> are used.
59  
60 =back
61  
62  
63  
64  
65 =head3 delete()
66  
67 Deletes the C<Net::Simplify::TransactionReview> object. Authentication is done using the same credentials used when the AccessToken was created.
68  
69  
70  
71 =head3 list(%criteria, $auth)
72  
73 Retrieve a list of C<Net::Simplify::TransactionReview> objects. The parameters are:
74  
75 =over 4
76  
77 =item C<%criteria>
78  
79 Hash map representing the criteria to limit the results of the list operation. Valid keys are:
80  
81 =over 4
82  
83  
84 =back
85  
86 =back
87  
88  
89  
90 =head3 find($id, $auth)
91  
92 Retrieve a C<Net::Simplify::TransactionReview> object from the API. Parameters are:
93  
94 =over 4
95  
96 =item C<$id>
97  
98 Identifier of the object to retrieve.
99  
100 =item C<$auth>
101  
102 Authentication object for accessing the API. If no value is passed the global keys
103 C<$Net::Simplify::public_key> and C<$Net::Simplify::private_key> are used.
104  
105 =back
106  
107  
108  
109  
110 =head3 update()
111  
112 Update C<Net::Simplify::TransactionReview> object.
113 The properties that can be updated are:
114  
115 =over 4
116  
117  
118 Authentication is done using the same credentials used when the AccessToken was created.
119  
120 =back
121  
122  
123  
124  
125 =head1 SEE ALSO
126  
127 L<Net::Simplify>,
128 L<Net::Simplify::Domain>,
129 L<Net::Simplify::DomainList>,
130 L<Net::Simplify::Authentication>,
131 L<Net::Simplify::ApiException>,
132 L<http://www.simplify.com>
133  
134 =head1 VERSION
135  
136 1.6.0
137  
138 =head1 LICENSE
139  
140 Copyright (c) 2013 - 2022 MasterCard International Incorporated
141 All rights reserved.
142  
143 Redistribution and use in source and binary forms, with or without modification, are
144 permitted provided that the following conditions are met:
145  
146 Redistributions of source code must retain the above copyright notice, this list of
147 conditions and the following disclaimer.
148 Redistributions in binary form must reproduce the above copyright notice, this list of
149 conditions and the following disclaimer in the documentation and/or other materials
150 provided with the distribution.
151 Neither the name of the MasterCard International Incorporated nor the names of its
152 contributors may be used to endorse or promote products derived from this software
153 without specific prior written permission.
154 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
155 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
156 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
157 SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
158 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
159 TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
160 OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
161 IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
162 IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
163 SUCH DAMAGE.
164  
165 =head1 SEE ALSO
166  
167 =cut
168  
169 use 5.006;
170 use strict;
171 use warnings FATAL => 'all';
172  
173 use Net::Simplify::Domain;
174 use Net::Simplify::DomainList;
175  
176 our @ISA = qw(Net::Simplify::Domain);
177  
178 sub create {
179  
180 my ($class, $params, $auth) = @_;
181
182 $auth = Net::Simplify::SimplifyApi->get_authentication($auth);
183 my $result = Net::Simplify::SimplifyApi->send_api_request("transactionReview", 'create', $params, $auth);
184  
185 $class->SUPER::new($result, $auth);
186 }
187  
188 sub delete {
189  
190 my ($self) = @_;
191  
192 my $auth = Net::Simplify::SimplifyApi->get_authentication($self->{_authentication});
193  
194 my $id = $self->{id};
195 $self->merge(Net::Simplify::SimplifyApi->send_api_request("transactionReview", 'delete', {id => $id}, $auth));
196 }
197  
198 sub list {
199 my ($class, $criteria, $auth) = @_;
200
201 $auth = Net::Simplify::SimplifyApi->get_authentication($auth);
202 my $result = Net::Simplify::SimplifyApi->send_api_request("transactionReview", 'list', $criteria, $auth);
203  
204 Net::Simplify::DomainList->new($result, $class, $auth);
205 }
206  
207 sub find {
208 my ($class, $id, $auth) = @_;
209  
210 $auth = Net::Simplify::SimplifyApi->get_authentication($auth);
211 my $result = Net::Simplify::SimplifyApi->send_api_request("transactionReview", 'find', { id => $id }, $auth);
212  
213 $class->SUPER::new($result, $auth);
214 }
215  
216 sub update {
217  
218 my ($self) = @_;
219  
220 my $auth = Net::Simplify::SimplifyApi->get_authentication($self->{_authentication});
221 my $params = { %$self };
222 delete $params->{_authentication};
223  
224 $self->merge(Net::Simplify::SimplifyApi->send_api_request("transactionReview", 'update', $params, $auth));
225 }
226  
227  
228 1;