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