File Coverage

blib/lib/WebService/Braintree/Validations.pm
Criterion Covered Total %
statement 12 30 40.0
branch 0 10 0.0
condition n/a
subroutine 4 14 28.5
pod 0 10 0.0
total 16 64 25.0


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