File Coverage

blib/lib/Paymill/REST/Item/Preauthorization.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::Preauthorization;
2              
3 9     9   7771 use Moose;
  9         27  
  9         190  
4 9     9   69658 use MooseX::Types::DateTime::ButMaintained qw(DateTime);
  9         33  
  9         136  
5              
6             with 'Paymill::REST::Operations::Delete';
7              
8             has _factory => (is => 'ro', isa => 'Object');
9              
10             has id => (is => 'ro', isa => 'Str');
11             has amount => (is => 'ro', isa => 'Int', required => 1);
12             has currency => (is => 'ro', isa => 'Str', required => 1);
13             has status => (is => 'ro', isa => 'PreauthStatus');
14             has livemode => (is => 'ro', isa => 'Bool');
15             has created_at => (is => 'ro', isa => DateTime, coerce => 1);
16             has updated_at => (is => 'ro', isa => DateTime, coerce => 1);
17             has app_id => (is => 'ro', isa => 'Undef|Str');
18              
19             has client => (
20             is => 'ro',
21             isa => 'Undef|Object|HashRef',
22             trigger => sub { Paymill::REST::TypesAndTriggers::item_from_hashref('client', @_) }
23             );
24             has payment => (
25             is => 'ro',
26             isa => 'Undef|Object|HashRef',
27             trigger => sub { Paymill::REST::TypesAndTriggers::item_from_hashref('payment', @_) }
28             );
29              
30 9     9   21366 no Moose;
  9         40  
  9         82  
31             1;
32             __END__
33              
34             =encoding utf-8
35              
36             =head1 NAME
37              
38             Paymill::REST::Item::Preauthorization - Item class for a preauthorization
39              
40             =head1 SYNOPSIS
41              
42             my $preauth_api = Paymill::REST::Preauthorizations->new;
43             $preauth = $preauth_api->find('preauth_lk2j34h5lk34h5lkjh2');
44              
45             say $preauth->amount; # Prints amount of the preauthorization
46              
47             =head1 DESCRIPTION
48              
49             Represents a preauthorization with all attributes and all sub items.
50              
51             =head1 ATTRIBUTES
52              
53             =over 4
54              
55             =item id
56              
57             String containing the identifier of the client
58              
59             =item amount
60              
61             Integer containing the assigned amount
62              
63             =item currency
64              
65             String containing the currency for the amount
66              
67             =item status
68              
69             String indicating the current status of the preauthorization. Can be one of:
70              
71             =over
72              
73             =item *
74              
75             open
76              
77             =item *
78              
79             pending
80              
81             =item *
82              
83             closed
84              
85             =item *
86              
87             failed
88              
89             =item *
90              
91             deleted
92              
93             =item *
94              
95             preauth
96              
97             =back
98              
99             =item livemode
100              
101             Boolean indicating whether this preauthorization has been made with the live keys or not
102              
103             =item created_at
104              
105             L<DateTime> object indicating the date of the creation as returned by the API
106              
107             =item updated_at
108              
109             L<DateTime> object indicating the date of the last update as returned by the API
110              
111             =item app_id
112              
113             String representing the app id that created this preauthorization
114              
115             =back
116              
117             =head1 SUB ITEMS
118              
119             =over 4
120              
121             =item client
122              
123             A client object.
124              
125             See also L<Paymill::REST::Item::Client>.
126              
127             =item payment
128              
129             A payment object.
130              
131             See also L<Paymill::REST::Item::Payment>.
132              
133             =back
134              
135             =head1 AVAILABLE OPERATIONS
136              
137             =over 4
138              
139             =item delete
140              
141             L<Paymill::REST::Operations::Delete>
142              
143             =back
144              
145             =head1 SEE ALSO
146              
147             L<Paymill::REST> for more documentation.
148              
149             =head1 AUTHOR
150              
151             Matthias Dietrich E<lt>perl@rainboxx.deE<gt>
152              
153             =head1 COPYRIGHT
154              
155             Copyright 2013 - Matthias Dietrich
156              
157             =head1 LICENSE
158              
159             This library is free software; you can redistribute it and/or modify
160             it under the same terms as Perl itself.