File Coverage

blib/lib/Paymill/REST/Item/Transaction.pm
Criterion Covered Total %
statement 9 9 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 12 12 100.0


line stmt bran cond sub pod time code
1             package Paymill::REST::Item::Transaction;
2              
3 9     9   6054 use Moose;
  9         32  
  9         73  
4 9     9   62510 use MooseX::Types::DateTime::ButMaintained qw(DateTime);
  9         25  
  9         122  
5              
6             has _factory => (is => 'ro', isa => 'Object');
7              
8             has id => (is => 'ro', isa => 'Str');
9             has description => (is => 'ro', isa => 'Str');
10             has amount => (is => 'ro', isa => 'Int', required => 1);
11             has origin_amount => (is => 'ro', isa => 'Int');
12             has currency => (is => 'ro', isa => 'Str', required => 1);
13             has livemode => (is => 'ro', isa => 'Bool');
14             has created_at => (is => 'ro', isa => DateTime, coerce => 1);
15             has updated_at => (is => 'ro', isa => DateTime, coerce => 1);
16             has status => (is => 'ro', isa => 'TxStatus');
17             has response_code => (is => 'ro', isa => 'Int');
18             has short_id => (is => 'ro', isa => 'Str');
19             has invoices => (is => 'ro', isa => 'Undef|ArrayRef');
20             has fees => (is => 'ro', isa => 'Undef|ArrayRef');
21             has app_id => (is => 'ro', isa => 'Undef|Str');
22              
23             has client => (
24             is => 'ro',
25             isa => 'Undef|Object|HashRef',
26             trigger => sub { Paymill::REST::TypesAndTriggers::item_from_hashref('client', @_) }
27             );
28             has payment => (
29             is => 'ro',
30             isa => 'Undef|Object|HashRef',
31             trigger => sub { Paymill::REST::TypesAndTriggers::item_from_hashref('payment', @_) }
32             );
33             has preauthorization => (
34             is => 'ro',
35             isa => 'Undef|Object|HashRef',
36             trigger => sub { Paymill::REST::TypesAndTriggers::item_from_hashref('preauthorization', @_) }
37             );
38             has refunds => (
39             is => 'ro',
40             isa => 'Undef|Object|ArrayRef',
41             trigger => sub { Paymill::REST::TypesAndTriggers::items_from_arrayref('refunds', @_) }
42             );
43              
44              
45 9     9   20984 no Moose;
  9         28  
  9         78  
46             1;
47             __END__
48              
49             =encoding utf-8
50              
51             =head1 NAME
52              
53             Paymill::REST::Item::Transaction - Item class for a transaction
54              
55             =head1 SYNOPSIS
56              
57             my $transaction_api = Paymill::REST::Transactions->new;
58             $transaction = $transaction_api->find('tran_lk2j34h5lk34h5lkjh2');
59              
60             say $transaction->amount; # Prints amount of the transaction
61              
62             =head1 DESCRIPTION
63              
64             Represents a transaction with all attributes and all sub items.
65              
66             =head1 ATTRIBUTES
67              
68             =over 4
69              
70             =item id
71              
72             String containing the identifier of the client
73              
74             =item amount
75              
76             Integer containing the charged amount minus amount refunded
77              
78             =item origin_amount
79              
80             String containing the initially charged amount
81              
82             =item currency
83              
84             String containing the currency in which the amount has been charged
85              
86             =item description
87              
88             String containing the assigned description
89              
90             =item status
91              
92             String indicating the current status of the transaction. Can be one of:
93              
94             =over
95              
96             =item *
97              
98             open
99              
100             =item *
101              
102             pending
103              
104             =item *
105              
106             closed
107              
108             =item *
109              
110             failed
111              
112             =item *
113              
114             partial_refunded
115              
116             =item *
117              
118             refunded
119              
120             =item *
121              
122             preauth
123              
124             =item *
125              
126             chargeback
127              
128             =back
129              
130             =item livemode
131              
132             Boolean indicating whether this transaction has been made with the live keys or not
133              
134             =item created_at
135              
136             L<DateTime> object indicating the date of the creation as returned by the API
137              
138             =item updated_at
139              
140             L<DateTime> object indicating the date of the last update as returned by the API
141              
142             =item response_code
143              
144             Integer containing the response code from the API
145              
146             =item short_id
147              
148             String containing the short id from the API
149              
150             =item invoices
151              
152             Arrayref of invoices, if transaction has been billed yet
153              
154             =item fees
155              
156             Arrayref of fees
157              
158             =item app_id
159              
160             String representing the app id that issued this transaction
161              
162             =back
163              
164             =head1 SUB ITEMS
165              
166             =over 4
167              
168             =item client
169              
170             A client object.
171              
172             See also L<Paymill::REST::Item::Client>.
173              
174             =item payment
175              
176             A payment object.
177              
178             See also L<Paymill::REST::Item::Payment>.
179              
180             =item preauthorization
181              
182             A preauthorization object.
183              
184             See also L<Paymill::REST::Item::Preauthorization>.
185              
186             =item refunds
187              
188             A list of refund objects.
189              
190             See also L<Paymill::REST::Item::Refund>.
191              
192             =back
193              
194             =head1 AVAILABLE OPERATIONS
195              
196             =over 4
197              
198             =item -
199              
200             =back
201              
202             =head1 SEE ALSO
203              
204             L<Paymill::REST> for more documentation.
205              
206             =head1 AUTHOR
207              
208             Matthias Dietrich E<lt>perl@rainboxx.deE<gt>
209              
210             =head1 COPYRIGHT
211              
212             Copyright 2013 - Matthias Dietrich
213              
214             =head1 LICENSE
215              
216             This library is free software; you can redistribute it and/or modify
217             it under the same terms as Perl itself.