line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyright 2013 Digital River, Inc. |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); |
4
|
|
|
|
|
|
|
# you may not use this file except in compliance with the License. |
5
|
|
|
|
|
|
|
# You may obtain a copy of the License at |
6
|
|
|
|
|
|
|
# |
7
|
|
|
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0 |
8
|
|
|
|
|
|
|
# |
9
|
|
|
|
|
|
|
# Unless required by applicable law or agreed to in writing, software |
10
|
|
|
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS, |
11
|
|
|
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12
|
|
|
|
|
|
|
# See the License for the specific language governing permissions and |
13
|
|
|
|
|
|
|
# limitations under the License. |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
package Net::MyCommerce::API::Resource::PAR; |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
18
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
25
|
|
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
5
|
use base qw( Net::MyCommerce::API::Resource ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
505
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 NAME |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
Net::MyCommerce::API::Resource::PAR |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 VERSION |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
version 1.0.0 |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=cut |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
our $VERSION = '1.0.0'; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 SCHEMA |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
http://help.mycommerce.com/index.php/mycommerce-apis/TBD |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 METHODS |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head2 new ($args) |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
Subclass Net::MyCommerce::API::Resource |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=cut |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub new { |
47
|
0
|
|
|
0
|
1
|
|
my ($pkg, %args) = @_; |
48
|
0
|
|
|
|
|
|
return $pkg->SUPER::new( %args, scope=>'payments' ); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head2 request (%opts) |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Subclass Net::MyCommerce::API::Resource::request |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=cut |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub request { |
58
|
0
|
|
|
0
|
1
|
|
my ($self, %opts) = @_; |
59
|
0
|
|
0
|
|
|
|
$opts{params} ||= {}; |
60
|
0
|
|
|
|
|
|
return $self->SUPER::request(%opts); |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head2 create_par (%opts) |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Create a new Payment Account Resource |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Examples: |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
http://help.mycommerce.com/index.php/mycommerce-apis/TBD |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=cut |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub create_par { |
74
|
0
|
|
|
0
|
1
|
|
my ($self, %opts) = @_; |
75
|
0
|
|
|
|
|
|
return $self->request( |
76
|
|
|
|
|
|
|
method => 'POST', |
77
|
|
|
|
|
|
|
path => '/payment-accounts', |
78
|
|
|
|
|
|
|
params => $opts{params}, |
79
|
|
|
|
|
|
|
data => { |
80
|
|
|
|
|
|
|
billing_address => $opts{billing_address}, |
81
|
|
|
|
|
|
|
cc_number => $opts{cc_number}, |
82
|
|
|
|
|
|
|
exp_month => $opts{exp_month}, |
83
|
|
|
|
|
|
|
exp_year => $opts{exp_year}, |
84
|
|
|
|
|
|
|
payment_type => $opts{payment_type}, |
85
|
|
|
|
|
|
|
currency_id => $opts{currency_id}, |
86
|
|
|
|
|
|
|
cvv_code => $opts{cvv_code}, |
87
|
|
|
|
|
|
|
}, |
88
|
|
|
|
|
|
|
); |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head2 update_par (%opts) |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Update Payment Account Resource |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=cut |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub update_par { |
98
|
0
|
|
|
0
|
1
|
|
my ($self, %opts) = @_; |
99
|
0
|
0
|
|
|
|
|
return $self->request( |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
100
|
|
|
|
|
|
|
method => 'POST', |
101
|
|
|
|
|
|
|
path => [ '/payment-accounts', $opts{cart_id} ], |
102
|
|
|
|
|
|
|
params => $opts{params}, |
103
|
|
|
|
|
|
|
data => { |
104
|
|
|
|
|
|
|
( $opts{billing_address} ? (billing_address => $opts{billing_address}) : () ), |
105
|
|
|
|
|
|
|
( $opts{cc_number} ? (cc_number => $opts{cc_number}) : () ), |
106
|
|
|
|
|
|
|
( $opts{exp_month} ? (exp_month => $opts{exp_month}) : () ), |
107
|
|
|
|
|
|
|
( $opts{exp_year} ? (exp_year => $opts{exp_year}) : () ), |
108
|
|
|
|
|
|
|
( $opts{payment_type} ? (payment_type => $opts{payment_type}) : () ), |
109
|
|
|
|
|
|
|
( $opts{currency_id} ? (currency_id => $opts{currency_id}) : () ), |
110
|
|
|
|
|
|
|
( $opts{cvv_code} ? (cvv_code => $opts{cvv_code}) : () ), |
111
|
|
|
|
|
|
|
}, |
112
|
|
|
|
|
|
|
); |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head2 get_par (%opts) |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
Retrieve an existing Payment Account Resource |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Examples: |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
http://help.mycommerce.com/index.php/mycommerce-apis/TBD |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=cut |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
sub get_par { |
126
|
0
|
|
|
0
|
1
|
|
my ($self, %opts) = @_; |
127
|
0
|
|
|
|
|
|
my ($error, $result) = $self->request( |
128
|
|
|
|
|
|
|
method => 'GET', |
129
|
|
|
|
|
|
|
path => [ '/payment-accounts', $opts{par_id} ], |
130
|
|
|
|
|
|
|
params => $opts{params}, |
131
|
|
|
|
|
|
|
); |
132
|
0
|
|
|
|
|
|
return ($error, $result); |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
1; |