line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::Braintree::Customer; |
2
|
1
|
|
|
1
|
|
4
|
use Moose; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
3
|
|
|
|
|
|
|
extends 'Net::Braintree::ResultObject'; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
my $meta = __PACKAGE__->meta; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub BUILD { |
8
|
0
|
|
|
0
|
0
|
|
my ($self, $attributes) = @_; |
9
|
0
|
|
|
|
|
|
my $sub_objects = { |
10
|
|
|
|
|
|
|
credit_cards => "Net::Braintree::CreditCard", |
11
|
|
|
|
|
|
|
addresses => "Net::Braintree::Address", |
12
|
|
|
|
|
|
|
paypal_accounts => "Net::Braintree::PayPalAccount" |
13
|
|
|
|
|
|
|
}; |
14
|
|
|
|
|
|
|
|
15
|
0
|
|
|
|
|
|
$self->setup_sub_objects($self, $attributes, $sub_objects); |
16
|
0
|
|
|
|
|
|
$self->set_attributes_from_hash($self, $attributes); |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub payment_methods { |
20
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
21
|
0
|
|
|
|
|
|
my @pmt_methods; |
22
|
0
|
0
|
|
|
|
|
if (defined($self->credit_cards)) { |
23
|
0
|
|
|
|
|
|
foreach my $credit_card (@{$self->credit_cards}) { |
|
0
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
push @pmt_methods, $credit_card; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
0
|
0
|
|
|
|
|
if (defined($self->paypal_accounts)) { |
29
|
0
|
|
|
|
|
|
foreach my $paypal_account (@{$self->paypal_accounts}) { |
|
0
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
push @pmt_methods, $paypal_account; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
return \@pmt_methods; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub create { |
38
|
0
|
|
|
0
|
0
|
|
my ($class, $params) = @_; |
39
|
0
|
|
|
|
|
|
$class->gateway->customer->create($params); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub find { |
43
|
0
|
|
|
0
|
0
|
|
my($class, $id) = @_; |
44
|
0
|
|
|
|
|
|
$class->gateway->customer->find($id); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub delete { |
48
|
0
|
|
|
0
|
0
|
|
my ($class, $id) = @_; |
49
|
0
|
|
|
|
|
|
$class->gateway->customer->delete($id); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub update { |
53
|
0
|
|
|
0
|
0
|
|
my ($class, $id, $params) = @_; |
54
|
0
|
|
|
|
|
|
$class->gateway->customer->update($id, $params); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub search { |
58
|
0
|
|
|
0
|
0
|
|
my ($class, $block) = @_; |
59
|
0
|
|
|
|
|
|
$class->gateway->customer->search($block); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub all { |
63
|
0
|
|
|
0
|
0
|
|
my ($class) = @_; |
64
|
0
|
|
|
|
|
|
$class->gateway->customer->all; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub gateway { |
68
|
0
|
|
|
0
|
0
|
|
return Net::Braintree->configuration->gateway; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
1; |