line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::Stripe::Customer; |
2
|
|
|
|
|
|
|
$Net::Stripe::Customer::VERSION = '0.41'; |
3
|
2
|
|
|
2
|
|
17
|
use Moose; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
20
|
|
4
|
2
|
|
|
2
|
|
14684
|
use Kavorka; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
22
|
|
5
|
2
|
|
|
2
|
|
1739
|
use Net::Stripe::Plan; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
58
|
|
6
|
2
|
|
|
2
|
|
12
|
use Net::Stripe::Token; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
48
|
|
7
|
2
|
|
|
2
|
|
12
|
use Net::Stripe::Card; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
51
|
|
8
|
2
|
|
|
2
|
|
964
|
use Net::Stripe::Discount; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
84
|
|
9
|
2
|
|
|
2
|
|
1072
|
use Net::Stripe::List; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
646
|
|
10
|
|
|
|
|
|
|
extends 'Net::Stripe::Resource'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# ABSTRACT: represent a Customer object from Stripe |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# Customer creation args |
15
|
|
|
|
|
|
|
has 'email' => (is => 'rw', isa => 'Maybe[Str]'); |
16
|
|
|
|
|
|
|
has 'description' => (is => 'rw', isa => 'Maybe[Str]'); |
17
|
|
|
|
|
|
|
has 'trial_end' => (is => 'rw', isa => 'Maybe[Int|Str]'); |
18
|
|
|
|
|
|
|
has 'card' => (is => 'rw', isa => 'Maybe[Net::Stripe::Token|Net::Stripe::Card|StripeTokenId]'); |
19
|
|
|
|
|
|
|
has 'source' => (is => 'rw', isa => 'Maybe[Net::Stripe::Card|StripeTokenId|StripeSourceId]'); |
20
|
|
|
|
|
|
|
has 'quantity' => (is => 'rw', isa => 'Maybe[Int]'); |
21
|
|
|
|
|
|
|
has 'plan' => (is => 'rw', isa => 'Maybe[Net::Stripe::Plan|Str]'); |
22
|
|
|
|
|
|
|
has 'coupon' => (is => 'rw', isa => 'Maybe[Net::Stripe::Coupon|Str]'); |
23
|
|
|
|
|
|
|
has 'discount' => (is => 'rw', isa => 'Maybe[Net::Stripe::Discount]'); |
24
|
|
|
|
|
|
|
has 'metadata' => (is => 'rw', isa => 'Maybe[HashRef]'); |
25
|
|
|
|
|
|
|
has 'account_balance' => (is => 'rw', isa => 'Maybe[Int]', trigger => \&_account_balance_trigger); |
26
|
|
|
|
|
|
|
has 'balance' => (is => 'rw', isa => 'Maybe[Int]', trigger => \&_balance_trigger); |
27
|
|
|
|
|
|
|
has 'default_card' => (is => 'rw', isa => 'Maybe[Net::Stripe::Token|Net::Stripe::Card|Str]'); |
28
|
|
|
|
|
|
|
has 'default_source' => (is => 'rw', isa => 'Maybe[StripeCardId|StripeSourceId]'); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# API object args |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
has 'id' => (is => 'ro', isa => 'Maybe[Str]'); |
33
|
|
|
|
|
|
|
has 'cards' => (is => 'ro', isa => 'Net::Stripe::List'); |
34
|
|
|
|
|
|
|
has 'deleted' => (is => 'ro', isa => 'Maybe[Bool|Object]', default => 0); |
35
|
|
|
|
|
|
|
has 'sources' => (is => 'ro', isa => 'Net::Stripe::List'); |
36
|
|
|
|
|
|
|
has 'subscriptions' => (is => 'ro', isa => 'Net::Stripe::List'); |
37
|
|
|
|
|
|
|
has 'subscription' => (is => 'ro', |
38
|
|
|
|
|
|
|
lazy => 1, |
39
|
|
|
|
|
|
|
builder => '_build_subscription'); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub _build_subscription { |
42
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
43
|
0
|
|
|
|
|
0
|
return $self->subscriptions->get(0); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
method _account_balance_trigger( |
47
|
|
|
|
|
|
|
Maybe[Int] $new_value!, |
48
|
|
|
|
|
|
|
Maybe[Int] $old_value?, |
49
|
2
|
0
|
|
2
|
|
34062
|
) { |
|
2
|
0
|
|
2
|
|
5
|
|
|
2
|
0
|
|
2
|
|
417
|
|
|
2
|
0
|
|
0
|
|
47
|
|
|
2
|
0
|
|
|
|
5
|
|
|
2
|
0
|
|
|
|
283
|
|
|
2
|
0
|
|
|
|
27
|
|
|
2
|
0
|
|
|
|
6
|
|
|
2
|
0
|
|
|
|
301
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
50
|
0
|
0
|
|
|
|
0
|
return unless defined( $new_value ); |
51
|
0
|
0
|
0
|
|
|
0
|
return if defined( $old_value ) && $old_value eq $new_value; |
52
|
0
|
0
|
0
|
|
|
0
|
return if defined( $self->balance ) && $self->balance == $new_value; |
53
|
0
|
|
|
|
|
0
|
$self->balance( $new_value ); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
method _balance_trigger( |
57
|
|
|
|
|
|
|
Maybe[Int] $new_value!, |
58
|
|
|
|
|
|
|
Maybe[Int] $old_value?, |
59
|
2
|
0
|
|
2
|
|
9762
|
) { |
|
2
|
0
|
|
2
|
|
5
|
|
|
2
|
0
|
|
2
|
|
335
|
|
|
2
|
0
|
|
0
|
|
25
|
|
|
2
|
0
|
|
|
|
7
|
|
|
2
|
0
|
|
|
|
287
|
|
|
2
|
0
|
|
|
|
16
|
|
|
2
|
0
|
|
|
|
6
|
|
|
2
|
0
|
|
|
|
322
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
60
|
0
|
0
|
|
|
|
0
|
return unless defined( $new_value ); |
61
|
0
|
0
|
0
|
|
|
0
|
return if defined( $old_value ) && $old_value eq $new_value; |
62
|
0
|
0
|
0
|
|
|
0
|
return if defined( $self->account_balance ) && $self->account_balance == $new_value; |
63
|
0
|
|
|
|
|
0
|
$self->account_balance( $new_value ); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
2
|
50
|
|
2
|
|
2352
|
method form_fields { |
|
2
|
|
|
2
|
|
5
|
|
|
2
|
|
|
|
|
449
|
|
|
2
|
|
|
|
|
26
|
|
|
2
|
|
|
|
|
4
|
|
67
|
2
|
0
|
33
|
|
|
60
|
$self->account_balance( undef ) if |
|
|
|
33
|
|
|
|
|
68
|
|
|
|
|
|
|
defined( $self->account_balance ) && |
69
|
|
|
|
|
|
|
defined( $self->balance ) && |
70
|
|
|
|
|
|
|
$self->account_balance == $self->balance; |
71
|
2
|
|
|
|
|
14
|
return $self->form_fields_for( |
72
|
|
|
|
|
|
|
qw/email description trial_end account_balance balance quantity card plan coupon |
73
|
|
|
|
|
|
|
metadata default_card source default_source/ |
74
|
|
|
|
|
|
|
); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
78
|
|
|
|
|
|
|
1; |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
__END__ |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=pod |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 NAME |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Net::Stripe::Customer - represent a Customer object from Stripe |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 VERSION |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
version 0.41 |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head2 account_balance |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Reader: account_balance |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Writer: account_balance |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Type: Maybe[Int] |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head2 balance |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Reader: balance |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Writer: balance |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Type: Maybe[Int] |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head2 boolean_attributes |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
Reader: boolean_attributes |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Type: ArrayRef[Str] |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head2 card |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Reader: card |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Writer: card |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Type: Maybe[Net::Stripe::Card|Net::Stripe::Token|StripeTokenId] |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head2 cards |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Reader: cards |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
Type: Net::Stripe::List |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head2 coupon |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Reader: coupon |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
Writer: coupon |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
Type: Maybe[Net::Stripe::Coupon|Str] |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head2 default_card |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
Reader: default_card |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
Writer: default_card |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
Type: Maybe[Net::Stripe::Card|Net::Stripe::Token|Str] |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=head2 default_source |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
Reader: default_source |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
Writer: default_source |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
Type: Maybe[StripeCardId|StripeSourceId] |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=head2 deleted |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
Reader: deleted |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
Type: Maybe[Bool|Object] |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=head2 description |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
Reader: description |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
Writer: description |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
Type: Maybe[Str] |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=head2 discount |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
Reader: discount |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
Writer: discount |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
Type: Maybe[Net::Stripe::Discount] |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=head2 email |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
Reader: email |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
Writer: email |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
Type: Maybe[Str] |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=head2 id |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
Reader: id |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
Type: Maybe[Str] |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=head2 metadata |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
Reader: metadata |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
Writer: metadata |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
Type: Maybe[HashRef] |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=head2 plan |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
Reader: plan |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
Writer: plan |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
Type: Maybe[Net::Stripe::Plan|Str] |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
=head2 quantity |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
Reader: quantity |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
Writer: quantity |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
Type: Maybe[Int] |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
=head2 source |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
Reader: source |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
Writer: source |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
Type: Maybe[Net::Stripe::Card|StripeSourceId|StripeTokenId] |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=head2 sources |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
Reader: sources |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
Type: Net::Stripe::List |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
=head2 subscription |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
Reader: subscription |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
=head2 subscriptions |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
Reader: subscriptions |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
Type: Net::Stripe::List |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
=head2 trial_end |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
Reader: trial_end |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
Writer: trial_end |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
Type: Maybe[Int|Str] |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
=head1 AUTHORS |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
=over 4 |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
=item * |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
Luke Closs |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
=item * |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
Rusty Conover |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
=back |
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
This software is copyright (c) 2015 by Prime Radiant, Inc., (c) copyright 2014 Lucky Dinosaur LLC. |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
265
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
=cut |