File Coverage

blib/lib/Net/Braintree/MerchantAccount.pm
Criterion Covered Total %
statement 33 54 61.1
branch 0 8 0.0
condition n/a
subroutine 11 16 68.7
pod 0 5 0.0
total 44 83 53.0


line stmt bran cond sub pod time code
1             package Net::Braintree::MerchantAccount;
2 1     1   323 use Net::Braintree::MerchantAccount::IndividualDetails;
  1         2  
  1         28  
3 1     1   5 use Net::Braintree::MerchantAccount::AddressDetails;
  1         1  
  1         15  
4 1     1   375 use Net::Braintree::MerchantAccount::BusinessDetails;
  1         2  
  1         27  
5 1     1   349 use Net::Braintree::MerchantAccount::FundingDetails;
  1         1  
  1         26  
6              
7 1     1   6 use Moose;
  1         1  
  1         3  
8             extends "Net::Braintree::ResultObject";
9             my $meta = __PACKAGE__->meta;
10              
11             {
12             package Net::Braintree::MerchantAccount::Status;
13              
14 1     1   3822 use constant Active => "active";
  1         2  
  1         64  
15 1     1   4 use constant Pending => "pending";
  1         1  
  1         35  
16 1     1   4 use constant Suspended => "suspended";
  1         1  
  1         48  
17             }
18              
19             {
20             package Net::Braintree::MerchantAccount::FundingDestination;
21              
22 1     1   4 use constant Bank => "bank";
  1         1  
  1         36  
23 1     1   3 use constant Email => "email";
  1         1  
  1         31  
24 1     1   3 use constant MobilePhone => "mobile_phone";
  1         1  
  1         281  
25             }
26              
27             sub BUILD {
28 0     0 0   my ($self, $attributes) = @_;
29 0           $meta->add_attribute('master_merchant_account', is => 'rw');
30 0 0         $self->master_merchant_account(Net::Braintree::MerchantAccount->new($attributes->{master_merchant_account})) if ref($attributes->{master_merchant_account}) eq 'HASH';
31 0           delete($attributes->{master_merchant_account});
32              
33 0           $meta->add_attribute('individual_details', is => 'rw');
34 0 0         $self->individual_details(Net::Braintree::MerchantAccount::IndividualDetails->new($attributes->{individual})) if ref($attributes->{individual}) eq 'HASH';
35 0           delete($attributes->{individual});
36              
37 0           $meta->add_attribute('business_details', is => 'rw');
38 0 0         $self->business_details(Net::Braintree::MerchantAccount::BusinessDetails->new($attributes->{business})) if ref($attributes->{business}) eq 'HASH';
39 0           delete($attributes->{business});
40              
41 0           $meta->add_attribute('funding_details', is => 'rw');
42 0 0         $self->funding_details(Net::Braintree::MerchantAccount::FundingDetails->new($attributes->{funding})) if ref($attributes->{funding}) eq 'HASH';
43 0           delete($attributes->{funding});
44              
45 0           $self->set_attributes_from_hash($self, $attributes);
46             }
47              
48             sub create {
49 0     0 0   my ($class, $params) = @_;
50 0           $class->gateway->merchant_account->create($params);
51             }
52              
53             sub update {
54 0     0 0   my ($class, $merchant_account_id, $params) = @_;
55 0           $class->gateway->merchant_account->update($merchant_account_id, $params);
56             }
57              
58             sub find {
59 0     0 0   my ($class, $merchant_account_id) = @_;
60 0           $class->gateway->merchant_account->find($merchant_account_id);
61             }
62              
63             sub gateway {
64 0     0 0   return Net::Braintree->configuration->gateway;
65             }
66              
67             1;