File Coverage

lib/WebService/Braintree/Validations.pm
Criterion Covered Total %
statement 14 32 43.7
branch 0 10 0.0
condition n/a
subroutine 5 15 33.3
pod 0 10 0.0
total 19 67 28.3


line stmt bran cond sub pod time code
1             package WebService::Braintree::Validations;
2             $WebService::Braintree::Validations::VERSION = '0.94';
3 20     20   348 use 5.010_001;
  20         68  
4 20     20   100 use strictures 1;
  20         120  
  20         694  
5              
6 20     20   1828 use WebService::Braintree::Util qw(is_hashref);
  20         41  
  20         894  
7              
8 20     20   108 use vars qw(@ISA @EXPORT_OK);
  20         40  
  20         1077  
9 20     20   124 use Exporter;
  20         50  
  20         10151  
10             our @ISA = qw(Exporter);
11              
12             our @EXPORT_OK = qw(
13             verify_params
14             address_signature
15             client_token_signature_with_customer_id
16             client_token_signature_without_customer_id
17             credit_card_signature
18             customer_signature
19             transaction_signature
20             clone_transaction_signature
21             merchant_account_signature
22             transaction_search_results_signature
23             );
24              
25             sub verify_params {
26 0     0 0   my ($params, $white_list) = @_;
27 0           foreach (keys %$params) {
28 0           my $key = $_;
29 0           my $sub_white_list = $white_list-> {$key};
30 0 0         return 0 unless($sub_white_list);
31 0 0         if (is_hashref($sub_white_list)) {
    0          
32 0 0         return 0 unless verify_params($params->{$key}, $sub_white_list);
33             } elsif (is_hashref($params->{$key})) {
34 0 0         return 0 if $sub_white_list ne "_any_key_";
35             }
36             }
37 0           return 1;
38             }
39              
40             sub search_results_signature {
41             return {
42 0     0 0   page_size => ".",
43             ids => "."
44             };
45             }
46              
47             sub transaction_search_results_signature {
48             return {
49 0     0 0   search_results => search_results_signature
50             };
51             }
52              
53             sub address_signature {
54             return {
55 0     0 0   company => ".", country_code_alpha2 => ".", country_code_alpha3 => ".", country_code_numeric => ".",
56             country_name => ".", extended_address => ".", first_name => ".",
57             options => { update_existing => "." },
58             last_name => ".", locality => ".", postal_code => ".", region => ".", street_address => "."
59             };
60             }
61              
62             sub client_token_signature_with_customer_id {
63             return {
64 0     0 0   customer_id => ".",
65             proxy_merchant_id => ".",
66             version => ".",
67             options => {
68             make_default => ".",
69             fail_on_duplicate_payment_method => ".",
70             verify_card => "."
71             },
72             merchant_account_id => "."
73             };
74             }
75              
76             sub client_token_signature_without_customer_id {
77             return {
78 0     0 0   proxy_merchant_id => ".",
79             version => ".",
80             merchant_account_id => "."
81             };
82             }
83              
84             sub credit_card_signature {
85             return {
86 0     0 0   customer_id => ".",
87             billing_address_id => ".", cardholder_name => ".", cvv => ".", expiration_date => ".",
88             expiration_month => ".", expiration_year => ".", number => ".", token => ".",
89             venmo_sdk_payment_method_code => ".",
90             payment_method_nonce => ".",
91             device_session_id => ".",
92             device_data => ".",
93             fraud_merchant_id => ".",
94             options => {
95             make_default => ".",
96             verification_merchant_account_id => ".",
97             verify_card => ".",
98             update_existing_token => ".",
99             fail_on_duplicate_payment_method => ".",
100             venmo_sdk_session => "."
101             },
102             billing_address => address_signature
103             };
104             }
105              
106             sub customer_signature {
107             return {
108 0     0 0   company => ".", email => ".", fax => ".", first_name => ".", id => ".", last_name => ".", phone => ".", website => ".", device_data => ".",
109             device_session_id => ".", fraud_merchant_id => ".",
110             credit_card => credit_card_signature,
111             payment_method_nonce => ".",
112             custom_fields => "_any_key_"
113             };
114             }
115              
116             sub clone_transaction_signature {
117 0     0 0   return { amount => ".", "channel" => ".", options => { submit_for_settlement => "." } };
118             }
119              
120             sub transaction_signature{
121             return {
122 0     0 0   amount => ".", customer_id => ".", merchant_account_id => ".", order_id => ".", channel => ".", payment_method_token => ".",
123             "payment_method_nonce" => ".", "device_session_id" => ".", "device_data" => ".", fraud_merchant_id => ".", billing_address_id => ".",
124             purchase_order_number => ".", recurring => ".", shipping_address_id => ".", type => ".", tax_amount => ".", tax_exempt => ".",
125             credit_card => {token => ".", cardholder_name => ".", cvv => ".", expiration_date => ".", expiration_month => ".", expiration_year => ".", number => "."},
126             customer => {id => ".", company => ".", email => ".", fax => ".", first_name => ".", last_name => ".", phone => ".", website => "."} ,
127             billing => address_signature,
128             shipping => address_signature,
129             options => {
130             store_in_vault => ".",
131             store_in_vault_on_success => ".",
132             submit_for_settlement => ".",
133             add_billing_address_to_payment_method => ".",
134             store_shipping_address_in_vault => ".",
135             venmo_sdk_session => ".",
136             hold_in_escrow => ".",
137             payee_email => "."
138             },
139             paypal_account => {
140             payee_email => "."
141             },
142             custom_fields => "_any_key_",
143             descriptor => {name => ".", phone => ".", url => "."},
144             subscription_id => ".",
145             venmo_sdk_payment_method_code => ".",
146             service_fee_amount => ".",
147             three_d_secure_token => "."
148             };
149             }
150              
151             1;
152             __END__