lib/WebService/Braintree/MerchantAccountGateway.pm

filter: Statementstmt 54.5% 24 / 44 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 46.6% 7 / 15 Podpod 0.0% 0 / 4 totaltotal 42.4% 31 / 73 CC 6 SCAR 14.7
CC
6
Cov
44%
update
12.0
create
6.0
find
6.0
CRAP 4.3
« lib/WebService/Braintree/SubscriptionGateway.pm ↑ Summary lib/WebService/Braintree/AddressGateway.pm »
1 # vim: sw=4 ts=4 ft=perl
2  
3 package # hide from pause
4 WebService::Braintree::MerchantAccountGateway;
5  
6 22 ▶use 5.010_001;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 22 ▶use strictures 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 22 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 22 with 'WebService::Braintree::Role::MakeRequest';
11 22 with 'WebService::Braintree::Role::CollectionBuilder';
12  
13 22 ▶use Carp qw(confess);
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 22 ▶use WebService::Braintree::Util qw(validate_id is_hashref);
Subroutine BEGIN: called CC=1 SCAR=0.0
16 22 ▶use WebService::Braintree::Validations qw(verify_params);
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 22 ▶use WebService::Braintree::_::MerchantAccount;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 0 ▶sub create {
Subroutine create: not called CC=2 SCAR=17.9
Pod undocumented
21 0 my ($self, $params) = @_;
22 0 ▶ confess "ArgumentError" unless verify_params($params, _detect_signature($params));
Branch: 1 branch
BranchTrueFalseTotal
unless verify_params($params, _detect_signature($params)) 0 0 0
23 0 $self->_make_request("/merchant_accounts/create_via_api", "post", {merchant_account => $params});
24 }
25  
26 0 ▶sub update {
Subroutine update: not called CC=3 SCAR=24.8
Pod undocumented
27 0 my ($self, $merchant_account_id, $params) = @_;
28 0 ▶ confess "NotFoundError" unless validate_id($merchant_account_id);
Branch: 1 branch
BranchTrueFalseTotal
unless validate_id($merchant_account_id) 0 0 0
29 0 ▶ confess "ArgumentError" unless verify_params($params, _update_signature());
Branch: 1 branch
BranchTrueFalseTotal
unless verify_params($params, _update_signature()) 0 0 0
30 0 $self->_make_request("/merchant_accounts/${merchant_account_id}/update_via_api", "put", {merchant_account => $params});
31 }
32  
33 0 ▶sub find {
Subroutine find: not called CC=2 SCAR=17.9
Pod undocumented
34 0 my ($self, $id) = @_;
35 0 ▶ confess "NotFoundError" unless validate_id($id);
Branch: 1 branch
BranchTrueFalseTotal
unless validate_id($id) 0 0 0
36 0 my $result = $self->_make_request("/merchant_accounts/$id", "get", undef)->merchant_account;
37 }
38  
39 0 ▶sub all {
Subroutine all: not called CC=1 SCAR=6.9
Pod undocumented
40 0 my $self = shift;
41  
42 0 return $self->paginated_collection({
43 url => "/merchant_accounts",
44 inflate => [qw/merchant_accounts merchant_account _::MerchantAccount/],
45 });
46 }
47  
48 0 ▶sub _detect_signature {
Subroutine _detect_signature: not called CC=2 SCAR=17.9
49 0 my ($params) = @_;
50 0 ▶ if (is_hashref($params->{applicant_details})) {
Branch: 1 branch
BranchTrueFalseTotal
if (is_hashref($params->{'applicant_details'})) { } 0 0 0
51 0 warnings::warnif("deprecated", "[DEPRECATED] Passing applicant_details to create is deprecated. Please use individual, business, and funding.");
52 0 return _deprecated_create_signature();
53 } else {
54 0 return _create_signature();
55 }
56 }
57  
58 0 ▶sub _deprecated_create_signature{
Subroutine _deprecated_create_signature: not called CC=1 SCAR=6.9
59 return {
60 0 applicant_details => {
61 company_name => ".",
62 first_name => ".",
63 last_name => ".",
64 email => ".",
65 phone => ".",
66 date_of_birth => ".",
67 ssn => ".",
68 tax_id => ".",
69 routing_number => ".",
70 account_number => ".",
71 address => {
72 street_address => ".",
73 postal_code => ".",
74 locality => ".",
75 region => ".",
76 }
77 },
78 tos_accepted => ".",
79 master_merchant_account_id => ".",
80 id => "."
81 };
82 }
83  
84 0 ▶sub _create_signature{
Subroutine _create_signature: not called CC=1 SCAR=6.9
85 return {
86 0 individual => {
87 first_name => ".",
88 last_name => ".",
89 email => ".",
90 phone => ".",
91 date_of_birth => ".",
92 ssn => ".",
93 address => {
94 street_address => ".",
95 postal_code => ".",
96 locality => ".",
97 region => ".",
98 }
99 },
100 business => {
101 legal_name => ".",
102 dba_name => ".",
103 tax_id => ".",
104 address => {
105 street_address => ".",
106 postal_code => ".",
107 locality => ".",
108 region => ".",
109 }
110 },
111 funding => {
112 destination => ".",
113 email => ".",
114 mobile_phone => ".",
115 routing_number => ".",
116 account_number => ".",
117 descriptor => ".",
118 },
119 tos_accepted => ".",
120 master_merchant_account_id => ".",
121 id => "."
122 };
123 }
124  
125 0 ▶sub _update_signature{
Subroutine _update_signature: not called CC=1 SCAR=6.9
126 return {
127 0 individual => {
128 first_name => ".",
129 last_name => ".",
130 email => ".",
131 phone => ".",
132 date_of_birth => ".",
133 ssn => ".",
134 address => {
135 street_address => ".",
136 postal_code => ".",
137 locality => ".",
138 region => ".",
139 }
140 },
141 business => {
142 legal_name => ".",
143 dba_name => ".",
144 tax_id => ".",
145 address => {
146 street_address => ".",
147 postal_code => ".",
148 locality => ".",
149 region => ".",
150 }
151 },
152 funding => {
153 destination => ".",
154 email => ".",
155 mobile_phone => ".",
156 routing_number => ".",
157 account_number => ".",
158 descriptor => ".",
159 },
160 master_merchant_account_id => ".",
161 id => "."
162 };
163 }
164  
165 22 __PACKAGE__->meta->make_immutable;
166  
167 22 1;
168 __END__
« lib/WebService/Braintree/SubscriptionGateway.pm ↑ Summary lib/WebService/Braintree/AddressGateway.pm »