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