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