kount_complete 1.0.7 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/kount.rb +28 -28
- data/lib/kount/Response.rb +344 -0
- data/lib/kount/cart.rb +36 -36
- data/lib/kount/client.rb +133 -125
- data/lib/kount/payment_types.rb +52 -52
- data/lib/kount/request.rb +41 -41
- data/lib/kount/request/inquiry.rb +90 -90
- data/lib/kount/request/update.rb +28 -28
- data/lib/kount/security_mash.rb +82 -82
- data/lib/kount/utils/khash.rb +56 -47
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89d6e66be40078e26b18861dbd0bb99ff427acfa1ff0717d1f9092efadc0250a
|
4
|
+
data.tar.gz: '086b6abb447bb81459b6ad933213e81e6a9e690e9a945d4c4cd6aed8774973ca'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 211dc77e3326c05bcd7fb27cfa173c3eba9f733dd3943004110b7e85b8a206ed06180b045fb3652597eba54145a58690b0bc92f4469d83a38bda9d447e0fa79b
|
7
|
+
data.tar.gz: 0f34dec4c5891478ed8c0cc57d60809476d90a74438c59469fd90232bb973e839ec6e4cbcdfda1b6b07be946792f8548552ed11eb6b3b45f57d540a1d6ddc8fe
|
data/lib/kount.rb
CHANGED
@@ -1,28 +1,28 @@
|
|
1
|
-
require 'kount/client'
|
2
|
-
require 'kount/payment_types'
|
3
|
-
|
4
|
-
##
|
5
|
-
# This module is the main entry point to the service wrapper.
|
6
|
-
# Its primary function is to collect the runtime options
|
7
|
-
# and return a Client object, on which all of the runtime
|
8
|
-
# integration takes place.
|
9
|
-
module Kount
|
10
|
-
# Creates the client object
|
11
|
-
#
|
12
|
-
# Expected options include:
|
13
|
-
# options = {
|
14
|
-
# :merchant_id => "MERCHANT_ID" # required (6 digit number)
|
15
|
-
# :ksalt => "KSALT" # required (provided by Kount)
|
16
|
-
# :key => "RIS_KEY" # required (created in the AWC web app)
|
17
|
-
# :endpoint => "RIS_ENDPOINT" # optional (default https://risk.kount.net)
|
18
|
-
# :version => "RIS_VERSION" # optional (defaults "0630")
|
19
|
-
# :is_test => "IS_TEST" # optional (defaults to false)
|
20
|
-
# }
|
21
|
-
# @param options Hash
|
22
|
-
def new(options = {})
|
23
|
-
|
24
|
-
Client.new(options)
|
25
|
-
end
|
26
|
-
|
27
|
-
module_function :new
|
28
|
-
end
|
1
|
+
require 'kount/client'
|
2
|
+
require 'kount/payment_types'
|
3
|
+
|
4
|
+
##
|
5
|
+
# This module is the main entry point to the service wrapper.
|
6
|
+
# Its primary function is to collect the runtime options
|
7
|
+
# and return a Client object, on which all of the runtime
|
8
|
+
# integration takes place.
|
9
|
+
module Kount
|
10
|
+
# Creates the client object
|
11
|
+
#
|
12
|
+
# Expected options include:
|
13
|
+
# options = {
|
14
|
+
# :merchant_id => "MERCHANT_ID" # required (6 digit number)
|
15
|
+
# :ksalt => "KSALT" # required (provided by Kount)
|
16
|
+
# :key => "RIS_KEY" # required (created in the AWC web app)
|
17
|
+
# :endpoint => "RIS_ENDPOINT" # optional (default https://risk.kount.net)
|
18
|
+
# :version => "RIS_VERSION" # optional (defaults "0630")
|
19
|
+
# :is_test => "IS_TEST" # optional (defaults to false)
|
20
|
+
# }
|
21
|
+
# @param options Hash
|
22
|
+
def new(options = {})
|
23
|
+
raise ArgumentError, 'Config options required' if options.empty?
|
24
|
+
Client.new(options)
|
25
|
+
end
|
26
|
+
|
27
|
+
module_function :new
|
28
|
+
end
|
@@ -0,0 +1,344 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
|
4
|
+
module Response
|
5
|
+
class Resp
|
6
|
+
def initialize(paramlist)
|
7
|
+
@paramlist = paramlist
|
8
|
+
puts @paramlist
|
9
|
+
end
|
10
|
+
|
11
|
+
def get_mode
|
12
|
+
modes = @paramlist['MODE'].to_s
|
13
|
+
return modes unless modes.empty?
|
14
|
+
end
|
15
|
+
|
16
|
+
def get_version
|
17
|
+
vers = @paramlist['VERS'].to_s
|
18
|
+
return vers unless vers.empty?
|
19
|
+
end
|
20
|
+
|
21
|
+
def get_transaction_id
|
22
|
+
tran = @paramlist['TRAN'].to_s
|
23
|
+
return tran unless tran.empty?
|
24
|
+
end
|
25
|
+
|
26
|
+
def get_merchant_id
|
27
|
+
merchantid = @paramlist['MERC'].to_s
|
28
|
+
return merchantid unless merchantid.empty?
|
29
|
+
end
|
30
|
+
|
31
|
+
def get_session_id
|
32
|
+
sessionid = @paramlist['SESS'].to_s
|
33
|
+
return sessionid unless sessionid.empty?
|
34
|
+
end
|
35
|
+
|
36
|
+
def get_order_number
|
37
|
+
orderno = @paramlist['ORDR'].to_s
|
38
|
+
return orderno unless orderno.empty?
|
39
|
+
end
|
40
|
+
|
41
|
+
def get_site
|
42
|
+
site = @paramlist['SITE'].to_s
|
43
|
+
return site unless site.empty?
|
44
|
+
end
|
45
|
+
|
46
|
+
def get_auto
|
47
|
+
auto = @paramlist['AUTO'].to_s
|
48
|
+
return auto unless auto.empty?
|
49
|
+
end
|
50
|
+
|
51
|
+
def get_score
|
52
|
+
score = @paramlist['SCOR'].to_s
|
53
|
+
return score unless score.empty?
|
54
|
+
end
|
55
|
+
|
56
|
+
def get_omniscore
|
57
|
+
omniscore = @paramlist['OMNISCORE'].to_s
|
58
|
+
return omniscore unless omniscore.empty?
|
59
|
+
end
|
60
|
+
|
61
|
+
def get_geox
|
62
|
+
geox = @paramlist['GEOX'].to_s
|
63
|
+
return geox unless geox.empty?
|
64
|
+
end
|
65
|
+
|
66
|
+
def get_brand
|
67
|
+
brand = @paramlist['BRND'].to_s
|
68
|
+
return brand unless brand.empty?
|
69
|
+
end
|
70
|
+
|
71
|
+
def get_velo
|
72
|
+
velo = @paramlist['VELO'].to_s
|
73
|
+
return velo unless velo.empty?
|
74
|
+
end
|
75
|
+
|
76
|
+
def get_vmax
|
77
|
+
vmax = @paramlist['VMAX'].to_s
|
78
|
+
return vmax unless vmax.empty?
|
79
|
+
end
|
80
|
+
|
81
|
+
def get_network
|
82
|
+
network = @paramlist['NETW'].to_s
|
83
|
+
return network unless network.empty?
|
84
|
+
end
|
85
|
+
|
86
|
+
def get_region
|
87
|
+
region = @paramlist['REGN'].to_s
|
88
|
+
return region unless region.empty?
|
89
|
+
end
|
90
|
+
|
91
|
+
def get_kaptcha
|
92
|
+
kapt = @paramlist['KAPT'].to_s
|
93
|
+
return kapt unless kapt.empty?
|
94
|
+
end
|
95
|
+
|
96
|
+
def get_proxy
|
97
|
+
proxy = @paramlist['PROXY'].to_s
|
98
|
+
return proxy unless proxy.empty?
|
99
|
+
end
|
100
|
+
|
101
|
+
def get_emails
|
102
|
+
email = @paramlist['EMAILS'].to_s
|
103
|
+
return email unless email.empty?
|
104
|
+
end
|
105
|
+
|
106
|
+
def get_http_country
|
107
|
+
httmcountry = @paramlist['HTTP_COUNTRY'].to_s
|
108
|
+
return httmcountry unless httmcountry.empty?
|
109
|
+
end
|
110
|
+
|
111
|
+
def get_timezone
|
112
|
+
timezone = @paramlist['TIMEZONE'].to_s
|
113
|
+
return timezone unless timezone.empty?
|
114
|
+
end
|
115
|
+
|
116
|
+
def get_cards
|
117
|
+
cards = @paramlist['CARDS'].to_s
|
118
|
+
return cards unless cards.empty?
|
119
|
+
end
|
120
|
+
|
121
|
+
def get_pc_remote
|
122
|
+
pcremote = @paramlist['PC_REMOTE'].to_s
|
123
|
+
return pcremote unless pcremote.empty?
|
124
|
+
end
|
125
|
+
|
126
|
+
def get_devices
|
127
|
+
devices = @paramlist['DEVICES'].to_s
|
128
|
+
return devices unless devices.empty?
|
129
|
+
end
|
130
|
+
|
131
|
+
def get_device_layers
|
132
|
+
device_layers = @paramlist['DEVICE_LAYERS'].to_s
|
133
|
+
return device_layers unless device_layers.empty?
|
134
|
+
end
|
135
|
+
|
136
|
+
def get_mobile_forwarder
|
137
|
+
mobile_forwarder = @paramlist['MOBILE_FORWARDER'].to_s
|
138
|
+
return mobile_forwarder unless mobile_forwarder.empty?
|
139
|
+
end
|
140
|
+
|
141
|
+
def get_voice_device
|
142
|
+
voicedevice = @paramlist['VOICE_DEVICE'].to_s
|
143
|
+
return voicedevice unless voicedevice.empty?
|
144
|
+
end
|
145
|
+
|
146
|
+
def get_local_time
|
147
|
+
localtime = @paramlist['LOCALTIME'].to_s
|
148
|
+
return localtime unless localtime.empty?
|
149
|
+
end
|
150
|
+
|
151
|
+
def get_mobile_type
|
152
|
+
mobiletype = @paramlist['MOBILE_TYPE'].to_s
|
153
|
+
return mobiletype unless mobiletype.empty?
|
154
|
+
end
|
155
|
+
|
156
|
+
def get_fingerprint
|
157
|
+
fingerprint = @paramlist['FINGERPRINT'].to_s
|
158
|
+
return fingerprint unless fingerprint.empty?
|
159
|
+
end
|
160
|
+
|
161
|
+
def get_flash
|
162
|
+
flash = @paramlist['FLASH'].to_s
|
163
|
+
return flash unless flash.empty?
|
164
|
+
end
|
165
|
+
|
166
|
+
def get_language
|
167
|
+
language = @paramlist['LANGUAGE'].to_s
|
168
|
+
return language unless language.empty?
|
169
|
+
end
|
170
|
+
|
171
|
+
def get_country
|
172
|
+
country = @paramlist['COUNTRY'].to_s
|
173
|
+
return country unless country.empty?
|
174
|
+
end
|
175
|
+
|
176
|
+
def get_javascript
|
177
|
+
javascript = @paramlist['JAVASCRIPT'].to_s
|
178
|
+
return javascript unless javascript.empty?
|
179
|
+
end
|
180
|
+
|
181
|
+
def get_cookies
|
182
|
+
cookie = @paramlist['COOKIES'].to_s
|
183
|
+
return cookie unless cookie.empty?
|
184
|
+
end
|
185
|
+
|
186
|
+
def get_mobile_device
|
187
|
+
mobiledevice = @paramlist['MOBILE_DEVICE'].to_s
|
188
|
+
return mobiledevice unless mobiledevice.empty?
|
189
|
+
end
|
190
|
+
|
191
|
+
def get_pierced_ipaddress
|
192
|
+
pip_address = @paramlist['PIP_IPAD'].to_s
|
193
|
+
return pip_address unless pip_address.empty?
|
194
|
+
end
|
195
|
+
|
196
|
+
def get_piercedipaddress_latitude
|
197
|
+
pip_lat = @paramlist['PIP_LAT'].to_s
|
198
|
+
return pip_lat unless pip_lat.empty?
|
199
|
+
end
|
200
|
+
|
201
|
+
def get_piercedipaddress_longitude
|
202
|
+
pip_long = @paramlist['PIP_LON'].to_s
|
203
|
+
return pip_long unless pip_long.empty?
|
204
|
+
end
|
205
|
+
|
206
|
+
def get_piercedipaddress_country
|
207
|
+
pip_country = @paramlist['PIP_COUNTRY'].to_s
|
208
|
+
return pip_country unless pip_country.empty?
|
209
|
+
end
|
210
|
+
|
211
|
+
def get_piercedipaddress_region
|
212
|
+
pip_region = @paramlist['PIP_REGION'].to_s
|
213
|
+
return pip_region unless pip_region.empty?
|
214
|
+
end
|
215
|
+
|
216
|
+
def get_piercedipaddress_city
|
217
|
+
pip_city = @paramlist['PIP_CITY'].to_s
|
218
|
+
return pip_city unless pip_city.empty?
|
219
|
+
end
|
220
|
+
|
221
|
+
def get_piercedipaddress_organization
|
222
|
+
pip_org = @paramlist['PIP_ORG'].to_s
|
223
|
+
return pip_org unless pip_org.empty?
|
224
|
+
end
|
225
|
+
|
226
|
+
def get_ipaddress
|
227
|
+
ip_ipad = @paramlist['IP_IPAD'].to_s
|
228
|
+
return ip_ipad unless ip_ipad.empty?
|
229
|
+
end
|
230
|
+
|
231
|
+
def get_ipaddress_latitude
|
232
|
+
ip_lat = @paramlist['IP_LAT'].to_s
|
233
|
+
return ip_lat unless ip_lat.empty?
|
234
|
+
end
|
235
|
+
|
236
|
+
def get_ipaddress_longitude
|
237
|
+
ip_long = @paramlist['IP_LON'].to_s
|
238
|
+
return ip_long unless ip_long.empty?
|
239
|
+
end
|
240
|
+
|
241
|
+
def get_ipaddress_country
|
242
|
+
ip_country = @paramlist['IP_COUNTRY'].to_s
|
243
|
+
return ip_country unless ip_country.empty?
|
244
|
+
end
|
245
|
+
|
246
|
+
def get_ipaddress_region
|
247
|
+
ip_region = @paramlist['IP_REGION'].to_s
|
248
|
+
return ip_region unless ip_region.empty?
|
249
|
+
end
|
250
|
+
|
251
|
+
def get_ipaddress_city
|
252
|
+
ip_city = @paramlist['IP_CITY'].to_s
|
253
|
+
return ip_city unless ip_city.empty?
|
254
|
+
end
|
255
|
+
|
256
|
+
def get_ipaddress_organization
|
257
|
+
ip_org = @paramlist['IP_ORG'].to_s
|
258
|
+
return ip_org unless ip_org.empty?
|
259
|
+
end
|
260
|
+
|
261
|
+
def get_date_device_firstseen
|
262
|
+
ddfs = @paramlist['DDFS'].to_s
|
263
|
+
return ddfs unless ddfs.empty?
|
264
|
+
end
|
265
|
+
|
266
|
+
def get_useragent_string
|
267
|
+
user_agent = @paramlist['UAS'].to_s
|
268
|
+
return user_agent unless user_agent.empty?
|
269
|
+
end
|
270
|
+
|
271
|
+
def get_devicescreen_resolution
|
272
|
+
dsr = @paramlist['DSR'].to_s
|
273
|
+
return dsr unless dsr.empty?
|
274
|
+
end
|
275
|
+
|
276
|
+
def get_os
|
277
|
+
os = @paramlist['OS'].to_s
|
278
|
+
return os unless os.empty?
|
279
|
+
end
|
280
|
+
|
281
|
+
def get_browser
|
282
|
+
browser = @paramlist['BROWSER'].to_s
|
283
|
+
return browser unless browser.empty?
|
284
|
+
end
|
285
|
+
|
286
|
+
def get_numberrules_triggered
|
287
|
+
no_rules_triggered = @paramlist['RULES_TRIGGERED'].to_s
|
288
|
+
no_rules_triggered
|
289
|
+
end
|
290
|
+
|
291
|
+
def get_rules_triggered
|
292
|
+
rules_count = get_numberrules_triggered
|
293
|
+
rules = []
|
294
|
+
(0..rules_count.to_i - 1).each do |i|
|
295
|
+
ruleid = @paramlist["RULE_ID_#{i}"]
|
296
|
+
rules[ruleid.to_i] = @paramlist["RULE_DESCRIPTION_#{i}"]
|
297
|
+
end
|
298
|
+
rules.compact
|
299
|
+
end
|
300
|
+
|
301
|
+
def get_warning_count
|
302
|
+
warning_count = @paramlist['WARNING_COUNT'].to_s
|
303
|
+
warning_count
|
304
|
+
end
|
305
|
+
|
306
|
+
def get_warnings
|
307
|
+
warnings = []
|
308
|
+
warningcount = get_warning_count
|
309
|
+
(0..warningcount.to_i - 1).each do |i|
|
310
|
+
warnings = @paramlist["WARNING_#{i}"]
|
311
|
+
end
|
312
|
+
warnings.compact
|
313
|
+
end
|
314
|
+
|
315
|
+
def get_error_count
|
316
|
+
errorcount = @paramlist['ERROR_COUNT'].to_s
|
317
|
+
errorcount
|
318
|
+
end
|
319
|
+
|
320
|
+
def geterrors
|
321
|
+
errors = []
|
322
|
+
error_count = get_error_count
|
323
|
+
(0..error_count.to_i - 1).each do |i|
|
324
|
+
errors = @paramlist["ERROR_#{i}"]
|
325
|
+
end
|
326
|
+
errors.compact
|
327
|
+
end
|
328
|
+
|
329
|
+
def get_numbercounters_triggered
|
330
|
+
count_triggered = @paramlist['COUNTERS_TRIGGERED'].to_s
|
331
|
+
count_triggered
|
332
|
+
end
|
333
|
+
|
334
|
+
def get_counters_triggered
|
335
|
+
counters = []
|
336
|
+
numCounters = get_numbercounters_triggered
|
337
|
+
(0..numCounters.to_i - 1).each do |i|
|
338
|
+
countername = @paramlist["COUNTER_NAME_#{i}"]
|
339
|
+
counters[countername.to_s] = @paramlist["COUNTER_VALUE_#{i}"]
|
340
|
+
end
|
341
|
+
counters.compact
|
342
|
+
end
|
343
|
+
end
|
344
|
+
end
|
data/lib/kount/cart.rb
CHANGED
@@ -1,36 +1,36 @@
|
|
1
|
-
module Kount
|
2
|
-
##
|
3
|
-
# This class handles cart data until the get_request is ready
|
4
|
-
# to push the data into the form fields
|
5
|
-
class Cart
|
6
|
-
attr_accessor :items
|
7
|
-
|
8
|
-
# Initialize cart object
|
9
|
-
def initialize
|
10
|
-
@items = []
|
11
|
-
end
|
12
|
-
|
13
|
-
# Add cart items
|
14
|
-
#
|
15
|
-
# @param item [String] Cart item name
|
16
|
-
# @param type [String] Cart type name
|
17
|
-
# @param desc [String] Cart item long description
|
18
|
-
# @param quant [String] Cart item quantity
|
19
|
-
# @param price [String] Cart item price in cents
|
20
|
-
def add_item(item, type, desc, quant, price)
|
21
|
-
@items << { TYPE: type,
|
22
|
-
DESC: desc,
|
23
|
-
ITEM: item,
|
24
|
-
QUANT: quant,
|
25
|
-
PRICE: price }
|
26
|
-
end
|
27
|
-
|
28
|
-
# Initialize an Inquiry object
|
29
|
-
#
|
30
|
-
# @param param [String] Param type: :TYPE, :DESC, :ITEM, :PRICE, or :QUANT
|
31
|
-
# @return [Array] Ordered array of the cart contents for each param type
|
32
|
-
def get_item(param)
|
33
|
-
@items.collect { |item| item[param] }
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
1
|
+
module Kount
|
2
|
+
##
|
3
|
+
# This class handles cart data until the get_request is ready
|
4
|
+
# to push the data into the form fields
|
5
|
+
class Cart
|
6
|
+
attr_accessor :items
|
7
|
+
|
8
|
+
# Initialize cart object
|
9
|
+
def initialize
|
10
|
+
@items = []
|
11
|
+
end
|
12
|
+
|
13
|
+
# Add cart items
|
14
|
+
#
|
15
|
+
# @param item [String] Cart item name
|
16
|
+
# @param type [String] Cart type name
|
17
|
+
# @param desc [String] Cart item long description
|
18
|
+
# @param quant [String] Cart item quantity
|
19
|
+
# @param price [String] Cart item price in cents
|
20
|
+
def add_item(item, type, desc, quant, price)
|
21
|
+
@items << { TYPE: type,
|
22
|
+
DESC: desc,
|
23
|
+
ITEM: item,
|
24
|
+
QUANT: quant,
|
25
|
+
PRICE: price }
|
26
|
+
end
|
27
|
+
|
28
|
+
# Initialize an Inquiry object
|
29
|
+
#
|
30
|
+
# @param param [String] Param type: :TYPE, :DESC, :ITEM, :PRICE, or :QUANT
|
31
|
+
# @return [Array] Ordered array of the cart contents for each param type
|
32
|
+
def get_item(param)
|
33
|
+
@items.collect { |item| item[param] }
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|