line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Paymill::REST; |
2
|
|
|
|
|
|
|
|
3
|
9
|
|
|
9
|
|
1504363
|
use strict; |
|
9
|
|
|
|
|
48
|
|
|
9
|
|
|
|
|
246
|
|
4
|
9
|
|
|
9
|
|
325
|
use 5.008_005; |
|
9
|
|
|
|
|
34
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
my $PRIVATE_KEY = ''; |
8
|
|
|
|
|
|
|
|
9
|
9
|
|
|
9
|
|
4160
|
use Module::Find; |
|
9
|
|
|
|
|
11984
|
|
|
9
|
|
|
|
|
621
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
BEGIN { |
12
|
9
|
|
|
9
|
|
57
|
useall Paymill::REST; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
1; |
16
|
|
|
|
|
|
|
__END__ |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=encoding utf-8 |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 NAME |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
Paymill::REST - A wrapper around PAYMILL's payment API |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 SYNOPSIS |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
use Paymill::REST; |
27
|
|
|
|
|
|
|
my $trx_api = Paymill::REST::Transactions->new; |
28
|
|
|
|
|
|
|
my $created_transaction = $trx_api->create( |
29
|
|
|
|
|
|
|
{ |
30
|
|
|
|
|
|
|
amount => 4200, |
31
|
|
|
|
|
|
|
token => '098f6bcd4621d373cade4e832627b4f6', |
32
|
|
|
|
|
|
|
currency => 'USD', |
33
|
|
|
|
|
|
|
description => "Hitchhiker's Guide to the Galaxy", |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 DESCRIPTION |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Paymill::REST is a wrapper around PAYMILL's payment API. |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 GENERAL ARCHITECTURE |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
It is intended that things such creating and retrieving items is done through |
44
|
|
|
|
|
|
|
operations called on the respective C<Paymill::REST::*> modules (a so called B<item factory>), so |
45
|
|
|
|
|
|
|
everything related to transactions is achieved |
46
|
|
|
|
|
|
|
through L<Paymill::REST::Transactions>. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Each operation of those factories is returning one or a list of the |
49
|
|
|
|
|
|
|
appropriate item modules, so operations called on L<Paymill::REST::Transactions> |
50
|
|
|
|
|
|
|
are returning one or a list of L<Paymill::REST::Item::Transaction>. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head2 AVAILABLE OPERATIONS |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Not all operations are available to every item factory (currently only |
55
|
|
|
|
|
|
|
C<delete> is not available to L<Paymill::REST::Item::Refund>). |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=over 4 |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=item Creating new items |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
L<Paymill::REST::Operations::Create> |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=item Delete existing items |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
L<Paymill::REST::Operations::Delete> |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=item Find a single item |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
L<Paymill::REST::Operations::Find> |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=item List all or a subset of items |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
L<Paymill::REST::Operations::List> |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=back |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 CONFIGURATION |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Each item factory inherits from L<Paymill::REST::Base>, which is |
80
|
|
|
|
|
|
|
holding all the configuration. The following options are available: |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=over 4 |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=item api_key |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Defines your private API key which you get from PAYMILL. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=item proxy |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
An L<URI> or URI string which is passed to L<LWP::UserAgent>'s C<proxy> |
91
|
|
|
|
|
|
|
method for connecting to the PAYMILL API. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=back |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
B<Note:> every other option you'll find in the code is only meant for |
96
|
|
|
|
|
|
|
development of this module and shouldn't be changed! |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 AUTHOR |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Matthias Dietrich E<lt>perl@rainboxx.deE<gt> |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 COPYRIGHT |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Copyright 2013 - Matthias Dietrich |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 LICENSE |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
109
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 SEE ALSO |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=over 4 |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=item PAYMILL: |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
L<http://www.paymill.com> |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=item Item factories: |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
L<Paymill::REST::Clients>, L<Paymill::REST::Offers>, L<Paymill::REST::Payments>, |
122
|
|
|
|
|
|
|
L<Paymill::REST::Preauthorizations>, L<Paymill::REST::Refunds>, |
123
|
|
|
|
|
|
|
L<Paymill::REST::Subscriptions>, L<Paymill::REST::Transactions>, |
124
|
|
|
|
|
|
|
L<Paymill::REST::Webhooks> |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=item Item modules: |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
L<Paymill::REST::Item::Client>, L<Paymill::REST::Item::Offer>, L<Paymill::REST::Item::Payment>, |
129
|
|
|
|
|
|
|
L<Paymill::REST::Item::Preauthorization>, L<Paymill::REST::Item::Refund>, |
130
|
|
|
|
|
|
|
L<Paymill::REST::Item::Subscription>, L<Paymill::REST::Item::Transaction>, |
131
|
|
|
|
|
|
|
L<Paymill::REST::Item::Webhook> |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=back |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head1 TODO |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=over 4 |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=item Add ability to save changes to item objects |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=item Add convenience operations (eg. C<refund> for transactions) where possible |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=back |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=cut |