line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::Braintree::MerchantAccountGateway; |
2
|
1
|
|
|
1
|
|
5
|
use Moose; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
10
|
|
3
|
1
|
|
|
1
|
|
6314
|
use Carp qw(confess); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
60
|
|
4
|
1
|
|
|
1
|
|
5
|
use Net::Braintree::Validations qw(verify_params); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
37
|
|
5
|
1
|
|
|
1
|
|
5
|
use Net::Braintree::Util qw(validate_id); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
38
|
|
6
|
1
|
|
|
1
|
|
5
|
use Net::Braintree::Result; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
494
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
has 'gateway' => (is => 'ro'); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub create { |
11
|
0
|
|
|
0
|
0
|
|
my ($self, $params) = @_; |
12
|
0
|
0
|
|
|
|
|
confess "ArgumentError" unless verify_params($params, _detect_signature($params)); |
13
|
0
|
|
|
|
|
|
$self->_make_request("/merchant_accounts/create_via_api", "post", {merchant_account => $params}); |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub update { |
17
|
0
|
|
|
0
|
0
|
|
my ($self, $merchant_account_id, $params) = @_; |
18
|
0
|
0
|
|
|
|
|
confess "ArgumentError" unless verify_params($params, _update_signature()); |
19
|
0
|
|
|
|
|
|
$self->_make_request("/merchant_accounts/${merchant_account_id}/update_via_api", "put", {merchant_account => $params}); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub find { |
23
|
0
|
|
|
0
|
0
|
|
my ($self, $id) = @_; |
24
|
0
|
0
|
|
|
|
|
confess "NotFoundError" unless validate_id($id); |
25
|
0
|
|
|
|
|
|
my $result = $self->_make_request("/merchant_accounts/$id", "get", undef)->merchant_account; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub _make_request { |
29
|
0
|
|
|
0
|
|
|
my($self, $path, $verb, $params) = @_; |
30
|
0
|
|
|
|
|
|
my $response = $self->gateway->http->$verb($path, $params); |
31
|
0
|
|
|
|
|
|
my $result = Net::Braintree::Result->new(response => $response); |
32
|
0
|
|
|
|
|
|
return $result; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub _detect_signature { |
36
|
0
|
|
|
0
|
|
|
my ($params) = @_; |
37
|
0
|
0
|
|
|
|
|
if (ref($params->{applicant_details}) eq 'HASH') { |
38
|
0
|
|
|
|
|
|
warnings::warnif("deprecated", "[DEPRECATED] Passing applicant_details to create is deprecated. Please use individual, business, and funding."); |
39
|
0
|
|
|
|
|
|
return _deprecated_create_signature(); |
40
|
|
|
|
|
|
|
} else { |
41
|
0
|
|
|
|
|
|
return _create_signature(); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub _deprecated_create_signature{ |
46
|
|
|
|
|
|
|
return { |
47
|
0
|
|
|
0
|
|
|
applicant_details => { |
48
|
|
|
|
|
|
|
company_name => ".", |
49
|
|
|
|
|
|
|
first_name => ".", |
50
|
|
|
|
|
|
|
last_name => ".", |
51
|
|
|
|
|
|
|
email => ".", |
52
|
|
|
|
|
|
|
phone => ".", |
53
|
|
|
|
|
|
|
date_of_birth => ".", |
54
|
|
|
|
|
|
|
ssn => ".", |
55
|
|
|
|
|
|
|
tax_id => ".", |
56
|
|
|
|
|
|
|
routing_number => ".", |
57
|
|
|
|
|
|
|
account_number => ".", |
58
|
|
|
|
|
|
|
address => { |
59
|
|
|
|
|
|
|
street_address => ".", |
60
|
|
|
|
|
|
|
postal_code => ".", |
61
|
|
|
|
|
|
|
locality => ".", |
62
|
|
|
|
|
|
|
region => ".", |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
}, |
65
|
|
|
|
|
|
|
tos_accepted => ".", |
66
|
|
|
|
|
|
|
master_merchant_account_id => ".", |
67
|
|
|
|
|
|
|
id => "." |
68
|
|
|
|
|
|
|
}; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub _create_signature{ |
72
|
|
|
|
|
|
|
return { |
73
|
0
|
|
|
0
|
|
|
individual => { |
74
|
|
|
|
|
|
|
first_name => ".", |
75
|
|
|
|
|
|
|
last_name => ".", |
76
|
|
|
|
|
|
|
email => ".", |
77
|
|
|
|
|
|
|
phone => ".", |
78
|
|
|
|
|
|
|
date_of_birth => ".", |
79
|
|
|
|
|
|
|
ssn => ".", |
80
|
|
|
|
|
|
|
address => { |
81
|
|
|
|
|
|
|
street_address => ".", |
82
|
|
|
|
|
|
|
postal_code => ".", |
83
|
|
|
|
|
|
|
locality => ".", |
84
|
|
|
|
|
|
|
region => ".", |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
}, |
87
|
|
|
|
|
|
|
business => { |
88
|
|
|
|
|
|
|
legal_name => ".", |
89
|
|
|
|
|
|
|
dba_name => ".", |
90
|
|
|
|
|
|
|
tax_id => ".", |
91
|
|
|
|
|
|
|
address => { |
92
|
|
|
|
|
|
|
street_address => ".", |
93
|
|
|
|
|
|
|
postal_code => ".", |
94
|
|
|
|
|
|
|
locality => ".", |
95
|
|
|
|
|
|
|
region => ".", |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
}, |
98
|
|
|
|
|
|
|
funding => { |
99
|
|
|
|
|
|
|
destination => ".", |
100
|
|
|
|
|
|
|
email => ".", |
101
|
|
|
|
|
|
|
mobile_phone => ".", |
102
|
|
|
|
|
|
|
routing_number => ".", |
103
|
|
|
|
|
|
|
account_number => ".", |
104
|
|
|
|
|
|
|
descriptor => ".", |
105
|
|
|
|
|
|
|
}, |
106
|
|
|
|
|
|
|
tos_accepted => ".", |
107
|
|
|
|
|
|
|
master_merchant_account_id => ".", |
108
|
|
|
|
|
|
|
id => "." |
109
|
|
|
|
|
|
|
}; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
sub _update_signature{ |
113
|
|
|
|
|
|
|
return { |
114
|
0
|
|
|
0
|
|
|
individual => { |
115
|
|
|
|
|
|
|
first_name => ".", |
116
|
|
|
|
|
|
|
last_name => ".", |
117
|
|
|
|
|
|
|
email => ".", |
118
|
|
|
|
|
|
|
phone => ".", |
119
|
|
|
|
|
|
|
date_of_birth => ".", |
120
|
|
|
|
|
|
|
ssn => ".", |
121
|
|
|
|
|
|
|
address => { |
122
|
|
|
|
|
|
|
street_address => ".", |
123
|
|
|
|
|
|
|
postal_code => ".", |
124
|
|
|
|
|
|
|
locality => ".", |
125
|
|
|
|
|
|
|
region => ".", |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
}, |
128
|
|
|
|
|
|
|
business => { |
129
|
|
|
|
|
|
|
legal_name => ".", |
130
|
|
|
|
|
|
|
dba_name => ".", |
131
|
|
|
|
|
|
|
tax_id => ".", |
132
|
|
|
|
|
|
|
address => { |
133
|
|
|
|
|
|
|
street_address => ".", |
134
|
|
|
|
|
|
|
postal_code => ".", |
135
|
|
|
|
|
|
|
locality => ".", |
136
|
|
|
|
|
|
|
region => ".", |
137
|
|
|
|
|
|
|
} |
138
|
|
|
|
|
|
|
}, |
139
|
|
|
|
|
|
|
funding => { |
140
|
|
|
|
|
|
|
destination => ".", |
141
|
|
|
|
|
|
|
email => ".", |
142
|
|
|
|
|
|
|
mobile_phone => ".", |
143
|
|
|
|
|
|
|
routing_number => ".", |
144
|
|
|
|
|
|
|
account_number => ".", |
145
|
|
|
|
|
|
|
descriptor => ".", |
146
|
|
|
|
|
|
|
}, |
147
|
|
|
|
|
|
|
master_merchant_account_id => ".", |
148
|
|
|
|
|
|
|
id => "." |
149
|
|
|
|
|
|
|
}; |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
1; |