kount_complete 1.0.9 → 2.0.0
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 +1 -1
- data/lib/kount/Response.rb +202 -315
- data/lib/kount/client.rb +8 -5
- data/lib/kount/request.rb +1 -1
- data/lib/kount/request/inquiry.rb +3 -3
- data/lib/kount/security_mash.rb +1 -1
- data/lib/kount/utils/khash.rb +7 -7
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e922a5e36e327e583f752054dca2de9616ad66fa7ffd4f33b9d4d749c2ced26b
|
4
|
+
data.tar.gz: a519cbaa5397737daf744416c5e5b5ecda316cd7bd9700c000e7a397d0ffddc5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59d9b02f738b98d2151ba485050ab40e8e89fd6b4e07ae8e5cd9bc299f177b98511a5ed76e91e3574521da05ba87a3c875d182abdf63b8b0a27bd3fdba929ae8
|
7
|
+
data.tar.gz: 2ab19bd5cee331b87fa43c4fb8f87635c4f6c5b14f57a5de72d6c8ac0413332d736ea3ac7b302bc95a58483638c217eb8969a57cdd4415385ed83abde31bbde4
|
data/lib/kount.rb
CHANGED
data/lib/kount/Response.rb
CHANGED
@@ -1,457 +1,344 @@
|
|
1
1
|
require 'json'
|
2
|
-
module Response
|
3
2
|
|
3
|
+
|
4
|
+
module Response
|
4
5
|
class Resp
|
5
6
|
def initialize(paramlist)
|
6
7
|
@paramlist = paramlist
|
7
8
|
puts @paramlist
|
8
9
|
end
|
9
10
|
|
10
|
-
def
|
11
|
-
modes = @paramlist[
|
12
|
-
|
13
|
-
return modes
|
14
|
-
end
|
15
|
-
|
11
|
+
def get_mode
|
12
|
+
modes = @paramlist['MODE'].to_s
|
13
|
+
return modes unless modes.empty?
|
16
14
|
end
|
17
15
|
|
18
|
-
def
|
19
|
-
vers = @paramlist[
|
20
|
-
|
21
|
-
return vers
|
22
|
-
end
|
16
|
+
def get_version
|
17
|
+
vers = @paramlist['VERS'].to_s
|
18
|
+
return vers unless vers.empty?
|
23
19
|
end
|
24
20
|
|
25
|
-
def
|
26
|
-
tran = @paramlist[
|
27
|
-
|
28
|
-
return tran
|
29
|
-
end
|
21
|
+
def get_transaction_id
|
22
|
+
tran = @paramlist['TRAN'].to_s
|
23
|
+
return tran unless tran.empty?
|
30
24
|
end
|
31
25
|
|
32
|
-
def
|
33
|
-
merchantid = @paramlist[
|
34
|
-
|
35
|
-
return merchantid
|
36
|
-
end
|
26
|
+
def get_merchant_id
|
27
|
+
merchantid = @paramlist['MERC'].to_s
|
28
|
+
return merchantid unless merchantid.empty?
|
37
29
|
end
|
38
30
|
|
39
|
-
def
|
40
|
-
sessionid = @paramlist[
|
41
|
-
|
42
|
-
return sessionid
|
43
|
-
end
|
31
|
+
def get_session_id
|
32
|
+
sessionid = @paramlist['SESS'].to_s
|
33
|
+
return sessionid unless sessionid.empty?
|
44
34
|
end
|
45
35
|
|
46
|
-
def
|
47
|
-
orderno = @paramlist[
|
48
|
-
|
49
|
-
return orderno
|
50
|
-
end
|
36
|
+
def get_order_number
|
37
|
+
orderno = @paramlist['ORDR'].to_s
|
38
|
+
return orderno unless orderno.empty?
|
51
39
|
end
|
52
40
|
|
53
|
-
def
|
54
|
-
site = @paramlist[
|
55
|
-
|
56
|
-
return site
|
57
|
-
end
|
41
|
+
def get_site
|
42
|
+
site = @paramlist['SITE'].to_s
|
43
|
+
return site unless site.empty?
|
58
44
|
end
|
59
45
|
|
60
|
-
def
|
61
|
-
auto = @paramlist[
|
62
|
-
|
63
|
-
return auto
|
64
|
-
end
|
46
|
+
def get_auto
|
47
|
+
auto = @paramlist['AUTO'].to_s
|
48
|
+
return auto unless auto.empty?
|
65
49
|
end
|
66
50
|
|
67
|
-
def
|
68
|
-
score = @paramlist[
|
69
|
-
|
70
|
-
return score
|
71
|
-
end
|
51
|
+
def get_score
|
52
|
+
score = @paramlist['SCOR'].to_s
|
53
|
+
return score unless score.empty?
|
72
54
|
end
|
73
55
|
|
74
|
-
def
|
75
|
-
omniscore = @paramlist['OMNISCORE'].to_s
|
76
|
-
|
77
|
-
return omniscore
|
78
|
-
end
|
56
|
+
def get_omniscore
|
57
|
+
omniscore = @paramlist['OMNISCORE'].to_s
|
58
|
+
return omniscore unless omniscore.empty?
|
79
59
|
end
|
80
60
|
|
81
|
-
def
|
82
|
-
geox = @paramlist[
|
83
|
-
|
84
|
-
return geox
|
85
|
-
end
|
61
|
+
def get_geox
|
62
|
+
geox = @paramlist['GEOX'].to_s
|
63
|
+
return geox unless geox.empty?
|
86
64
|
end
|
87
65
|
|
88
|
-
def
|
89
|
-
brand = @paramlist[
|
90
|
-
|
91
|
-
return brand
|
92
|
-
end
|
66
|
+
def get_brand
|
67
|
+
brand = @paramlist['BRND'].to_s
|
68
|
+
return brand unless brand.empty?
|
93
69
|
end
|
94
70
|
|
95
|
-
def
|
96
|
-
velo = @paramlist[
|
97
|
-
|
98
|
-
return velo
|
99
|
-
end
|
71
|
+
def get_velo
|
72
|
+
velo = @paramlist['VELO'].to_s
|
73
|
+
return velo unless velo.empty?
|
100
74
|
end
|
101
75
|
|
102
|
-
def
|
103
|
-
vmax = @paramlist[
|
104
|
-
|
105
|
-
return vmax
|
106
|
-
end
|
76
|
+
def get_vmax
|
77
|
+
vmax = @paramlist['VMAX'].to_s
|
78
|
+
return vmax unless vmax.empty?
|
107
79
|
end
|
108
80
|
|
109
|
-
def
|
110
|
-
network = @paramlist[
|
111
|
-
|
112
|
-
return network
|
113
|
-
end
|
81
|
+
def get_network
|
82
|
+
network = @paramlist['NETW'].to_s
|
83
|
+
return network unless network.empty?
|
114
84
|
end
|
115
85
|
|
116
|
-
def
|
117
|
-
region = @paramlist[
|
118
|
-
|
119
|
-
return region
|
120
|
-
end
|
86
|
+
def get_region
|
87
|
+
region = @paramlist['REGN'].to_s
|
88
|
+
return region unless region.empty?
|
121
89
|
end
|
122
90
|
|
123
|
-
def
|
124
|
-
kapt = @paramlist[
|
125
|
-
|
126
|
-
return kapt
|
127
|
-
end
|
91
|
+
def get_kaptcha
|
92
|
+
kapt = @paramlist['KAPT'].to_s
|
93
|
+
return kapt unless kapt.empty?
|
128
94
|
end
|
129
95
|
|
130
|
-
def
|
131
|
-
proxy = @paramlist[
|
132
|
-
|
133
|
-
return proxy
|
134
|
-
end
|
96
|
+
def get_proxy
|
97
|
+
proxy = @paramlist['PROXY'].to_s
|
98
|
+
return proxy unless proxy.empty?
|
135
99
|
end
|
136
100
|
|
137
|
-
def
|
138
|
-
email = @paramlist[
|
139
|
-
|
140
|
-
return email
|
141
|
-
end
|
101
|
+
def get_emails
|
102
|
+
email = @paramlist['EMAILS'].to_s
|
103
|
+
return email unless email.empty?
|
142
104
|
end
|
143
105
|
|
144
|
-
def
|
145
|
-
httmcountry = @paramlist[
|
146
|
-
|
147
|
-
return httmcountry
|
148
|
-
end
|
106
|
+
def get_http_country
|
107
|
+
httmcountry = @paramlist['HTTP_COUNTRY'].to_s
|
108
|
+
return httmcountry unless httmcountry.empty?
|
149
109
|
end
|
150
110
|
|
151
|
-
def
|
152
|
-
timezone = @paramlist[
|
153
|
-
|
154
|
-
return timezone
|
155
|
-
end
|
111
|
+
def get_timezone
|
112
|
+
timezone = @paramlist['TIMEZONE'].to_s
|
113
|
+
return timezone unless timezone.empty?
|
156
114
|
end
|
157
115
|
|
158
|
-
def
|
159
|
-
cards = @paramlist[
|
160
|
-
|
161
|
-
return cards
|
162
|
-
end
|
116
|
+
def get_cards
|
117
|
+
cards = @paramlist['CARDS'].to_s
|
118
|
+
return cards unless cards.empty?
|
163
119
|
end
|
164
120
|
|
165
|
-
def
|
166
|
-
pcremote = @paramlist[
|
167
|
-
|
168
|
-
return pcremote
|
169
|
-
end
|
121
|
+
def get_pc_remote
|
122
|
+
pcremote = @paramlist['PC_REMOTE'].to_s
|
123
|
+
return pcremote unless pcremote.empty?
|
170
124
|
end
|
171
125
|
|
172
|
-
def
|
173
|
-
devices = @paramlist[
|
174
|
-
|
175
|
-
return devices
|
176
|
-
end
|
126
|
+
def get_devices
|
127
|
+
devices = @paramlist['DEVICES'].to_s
|
128
|
+
return devices unless devices.empty?
|
177
129
|
end
|
178
130
|
|
179
|
-
def
|
180
|
-
device_layers = @paramlist[
|
181
|
-
|
182
|
-
return device_layers
|
183
|
-
end
|
131
|
+
def get_device_layers
|
132
|
+
device_layers = @paramlist['DEVICE_LAYERS'].to_s
|
133
|
+
return device_layers unless device_layers.empty?
|
184
134
|
end
|
185
135
|
|
186
|
-
def
|
187
|
-
mobile_forwarder = @paramlist[
|
188
|
-
|
189
|
-
return mobile_forwarder
|
190
|
-
end
|
136
|
+
def get_mobile_forwarder
|
137
|
+
mobile_forwarder = @paramlist['MOBILE_FORWARDER'].to_s
|
138
|
+
return mobile_forwarder unless mobile_forwarder.empty?
|
191
139
|
end
|
192
140
|
|
193
|
-
def
|
194
|
-
voicedevice = @paramlist[
|
195
|
-
|
196
|
-
return voicedevice
|
197
|
-
end
|
141
|
+
def get_voice_device
|
142
|
+
voicedevice = @paramlist['VOICE_DEVICE'].to_s
|
143
|
+
return voicedevice unless voicedevice.empty?
|
198
144
|
end
|
199
145
|
|
200
|
-
def
|
201
|
-
localtime = @paramlist[
|
202
|
-
|
203
|
-
return localtime
|
204
|
-
end
|
146
|
+
def get_local_time
|
147
|
+
localtime = @paramlist['LOCALTIME'].to_s
|
148
|
+
return localtime unless localtime.empty?
|
205
149
|
end
|
206
150
|
|
207
|
-
def
|
208
|
-
mobiletype = @paramlist[
|
209
|
-
|
210
|
-
return mobiletype
|
211
|
-
end
|
151
|
+
def get_mobile_type
|
152
|
+
mobiletype = @paramlist['MOBILE_TYPE'].to_s
|
153
|
+
return mobiletype unless mobiletype.empty?
|
212
154
|
end
|
213
155
|
|
214
|
-
def
|
215
|
-
fingerprint = @paramlist[
|
216
|
-
|
217
|
-
return fingerprint
|
218
|
-
end
|
156
|
+
def get_fingerprint
|
157
|
+
fingerprint = @paramlist['FINGERPRINT'].to_s
|
158
|
+
return fingerprint unless fingerprint.empty?
|
219
159
|
end
|
220
160
|
|
221
|
-
def
|
222
|
-
flash = @paramlist[
|
223
|
-
|
224
|
-
return flash
|
225
|
-
end
|
161
|
+
def get_flash
|
162
|
+
flash = @paramlist['FLASH'].to_s
|
163
|
+
return flash unless flash.empty?
|
226
164
|
end
|
227
165
|
|
228
|
-
def
|
229
|
-
language = @paramlist[
|
230
|
-
|
231
|
-
return language
|
232
|
-
end
|
166
|
+
def get_language
|
167
|
+
language = @paramlist['LANGUAGE'].to_s
|
168
|
+
return language unless language.empty?
|
233
169
|
end
|
234
170
|
|
235
|
-
def
|
236
|
-
country = @paramlist[
|
237
|
-
|
238
|
-
return country
|
239
|
-
end
|
171
|
+
def get_country
|
172
|
+
country = @paramlist['COUNTRY'].to_s
|
173
|
+
return country unless country.empty?
|
240
174
|
end
|
241
175
|
|
242
|
-
def
|
243
|
-
javascript = @paramlist[
|
244
|
-
|
245
|
-
return javascript
|
246
|
-
end
|
176
|
+
def get_javascript
|
177
|
+
javascript = @paramlist['JAVASCRIPT'].to_s
|
178
|
+
return javascript unless javascript.empty?
|
247
179
|
end
|
248
180
|
|
249
|
-
def
|
250
|
-
cookie = @paramlist[
|
251
|
-
|
252
|
-
return cookie
|
253
|
-
end
|
181
|
+
def get_cookies
|
182
|
+
cookie = @paramlist['COOKIES'].to_s
|
183
|
+
return cookie unless cookie.empty?
|
254
184
|
end
|
255
185
|
|
256
|
-
def
|
257
|
-
mobiledevice = @paramlist[
|
258
|
-
|
259
|
-
return mobiledevice
|
260
|
-
end
|
186
|
+
def get_mobile_device
|
187
|
+
mobiledevice = @paramlist['MOBILE_DEVICE'].to_s
|
188
|
+
return mobiledevice unless mobiledevice.empty?
|
261
189
|
end
|
262
190
|
|
263
|
-
def
|
264
|
-
pip_address = @paramlist[
|
265
|
-
|
266
|
-
return pip_address
|
267
|
-
end
|
191
|
+
def get_pierced_ipaddress
|
192
|
+
pip_address = @paramlist['PIP_IPAD'].to_s
|
193
|
+
return pip_address unless pip_address.empty?
|
268
194
|
end
|
269
195
|
|
270
|
-
def
|
271
|
-
pip_lat = @paramlist[
|
272
|
-
|
273
|
-
return pip_lat
|
274
|
-
end
|
196
|
+
def get_piercedipaddress_latitude
|
197
|
+
pip_lat = @paramlist['PIP_LAT'].to_s
|
198
|
+
return pip_lat unless pip_lat.empty?
|
275
199
|
end
|
276
200
|
|
277
|
-
def
|
278
|
-
pip_long = @paramlist[
|
279
|
-
|
280
|
-
return pip_long
|
281
|
-
end
|
201
|
+
def get_piercedipaddress_longitude
|
202
|
+
pip_long = @paramlist['PIP_LON'].to_s
|
203
|
+
return pip_long unless pip_long.empty?
|
282
204
|
end
|
283
205
|
|
284
|
-
def
|
285
|
-
pip_country = @paramlist[
|
286
|
-
|
287
|
-
return pip_country
|
288
|
-
end
|
206
|
+
def get_piercedipaddress_country
|
207
|
+
pip_country = @paramlist['PIP_COUNTRY'].to_s
|
208
|
+
return pip_country unless pip_country.empty?
|
289
209
|
end
|
290
210
|
|
291
|
-
def
|
292
|
-
pip_region = @paramlist[
|
293
|
-
|
294
|
-
return pip_region
|
295
|
-
end
|
211
|
+
def get_piercedipaddress_region
|
212
|
+
pip_region = @paramlist['PIP_REGION'].to_s
|
213
|
+
return pip_region unless pip_region.empty?
|
296
214
|
end
|
297
215
|
|
298
|
-
def
|
299
|
-
pip_city = @paramlist[
|
300
|
-
|
301
|
-
return pip_city
|
302
|
-
end
|
216
|
+
def get_piercedipaddress_city
|
217
|
+
pip_city = @paramlist['PIP_CITY'].to_s
|
218
|
+
return pip_city unless pip_city.empty?
|
303
219
|
end
|
304
220
|
|
305
|
-
def
|
306
|
-
pip_org = @paramlist[
|
307
|
-
|
308
|
-
return pip_org
|
309
|
-
end
|
221
|
+
def get_piercedipaddress_organization
|
222
|
+
pip_org = @paramlist['PIP_ORG'].to_s
|
223
|
+
return pip_org unless pip_org.empty?
|
310
224
|
end
|
311
225
|
|
312
|
-
def
|
313
|
-
ip_ipad = @paramlist[
|
314
|
-
|
315
|
-
return ip_ipad
|
316
|
-
end
|
226
|
+
def get_ipaddress
|
227
|
+
ip_ipad = @paramlist['IP_IPAD'].to_s
|
228
|
+
return ip_ipad unless ip_ipad.empty?
|
317
229
|
end
|
318
230
|
|
319
|
-
def
|
320
|
-
ip_lat = @paramlist[
|
321
|
-
|
322
|
-
return ip_lat
|
323
|
-
end
|
231
|
+
def get_ipaddress_latitude
|
232
|
+
ip_lat = @paramlist['IP_LAT'].to_s
|
233
|
+
return ip_lat unless ip_lat.empty?
|
324
234
|
end
|
325
235
|
|
326
|
-
def
|
327
|
-
ip_long = @paramlist[
|
328
|
-
|
329
|
-
return ip_long
|
330
|
-
end
|
236
|
+
def get_ipaddress_longitude
|
237
|
+
ip_long = @paramlist['IP_LON'].to_s
|
238
|
+
return ip_long unless ip_long.empty?
|
331
239
|
end
|
332
240
|
|
333
|
-
def
|
334
|
-
ip_country = @paramlist[
|
335
|
-
|
336
|
-
return ip_country
|
337
|
-
end
|
241
|
+
def get_ipaddress_country
|
242
|
+
ip_country = @paramlist['IP_COUNTRY'].to_s
|
243
|
+
return ip_country unless ip_country.empty?
|
338
244
|
end
|
339
245
|
|
340
|
-
def
|
341
|
-
ip_region = @paramlist[
|
342
|
-
|
343
|
-
return ip_region
|
344
|
-
end
|
246
|
+
def get_ipaddress_region
|
247
|
+
ip_region = @paramlist['IP_REGION'].to_s
|
248
|
+
return ip_region unless ip_region.empty?
|
345
249
|
end
|
346
250
|
|
347
|
-
def
|
348
|
-
ip_city = @paramlist[
|
349
|
-
|
350
|
-
return ip_city
|
351
|
-
end
|
251
|
+
def get_ipaddress_city
|
252
|
+
ip_city = @paramlist['IP_CITY'].to_s
|
253
|
+
return ip_city unless ip_city.empty?
|
352
254
|
end
|
353
255
|
|
354
|
-
def
|
355
|
-
ip_org = @paramlist[
|
356
|
-
|
357
|
-
return ip_org
|
358
|
-
end
|
256
|
+
def get_ipaddress_organization
|
257
|
+
ip_org = @paramlist['IP_ORG'].to_s
|
258
|
+
return ip_org unless ip_org.empty?
|
359
259
|
end
|
360
260
|
|
361
|
-
def
|
362
|
-
ddfs = @paramlist[
|
363
|
-
|
364
|
-
return ddfs
|
365
|
-
end
|
261
|
+
def get_date_device_firstseen
|
262
|
+
ddfs = @paramlist['DDFS'].to_s
|
263
|
+
return ddfs unless ddfs.empty?
|
366
264
|
end
|
367
265
|
|
368
|
-
def
|
369
|
-
user_agent = @paramlist[
|
370
|
-
|
371
|
-
return user_agent
|
372
|
-
end
|
266
|
+
def get_useragent_string
|
267
|
+
user_agent = @paramlist['UAS'].to_s
|
268
|
+
return user_agent unless user_agent.empty?
|
373
269
|
end
|
374
270
|
|
375
|
-
def
|
376
|
-
dsr = @paramlist[
|
377
|
-
|
378
|
-
return dsr
|
379
|
-
end
|
271
|
+
def get_devicescreen_resolution
|
272
|
+
dsr = @paramlist['DSR'].to_s
|
273
|
+
return dsr unless dsr.empty?
|
380
274
|
end
|
381
275
|
|
382
|
-
def
|
383
|
-
os = @paramlist[
|
384
|
-
|
385
|
-
return os
|
386
|
-
end
|
276
|
+
def get_os
|
277
|
+
os = @paramlist['OS'].to_s
|
278
|
+
return os unless os.empty?
|
387
279
|
end
|
388
280
|
|
389
|
-
def
|
390
|
-
browser = @paramlist[
|
391
|
-
|
392
|
-
return browser
|
393
|
-
end
|
281
|
+
def get_browser
|
282
|
+
browser = @paramlist['BROWSER'].to_s
|
283
|
+
return browser unless browser.empty?
|
394
284
|
end
|
395
285
|
|
396
|
-
def
|
397
|
-
no_rules_triggered = @paramlist[
|
398
|
-
|
286
|
+
def get_numberrules_triggered
|
287
|
+
no_rules_triggered = @paramlist['RULES_TRIGGERED'].to_s
|
288
|
+
no_rules_triggered
|
399
289
|
end
|
400
290
|
|
401
|
-
def
|
402
|
-
rules_count =
|
403
|
-
rules =
|
404
|
-
|
291
|
+
def get_rules_triggered
|
292
|
+
rules_count = get_numberrules_triggered
|
293
|
+
rules = []
|
294
|
+
(0..rules_count.to_i - 1).each do |i|
|
405
295
|
ruleid = @paramlist["RULE_ID_#{i}"]
|
406
|
-
rules[ruleid.to_i
|
296
|
+
rules[ruleid.to_i] = @paramlist["RULE_DESCRIPTION_#{i}"]
|
407
297
|
end
|
408
|
-
|
409
|
-
|
298
|
+
rules.compact
|
410
299
|
end
|
411
300
|
|
412
|
-
def
|
413
|
-
warning_count = @paramlist[
|
414
|
-
|
301
|
+
def get_warning_count
|
302
|
+
warning_count = @paramlist['WARNING_COUNT'].to_s
|
303
|
+
warning_count
|
415
304
|
end
|
416
305
|
|
417
|
-
def
|
418
|
-
warnings =
|
419
|
-
warningcount =
|
420
|
-
|
306
|
+
def get_warnings
|
307
|
+
warnings = []
|
308
|
+
warningcount = get_warning_count
|
309
|
+
(0..warningcount.to_i - 1).each do |i|
|
421
310
|
warnings = @paramlist["WARNING_#{i}"]
|
422
311
|
end
|
423
|
-
|
312
|
+
warnings.compact
|
424
313
|
end
|
425
314
|
|
426
|
-
def
|
427
|
-
errorcount = @paramlist[
|
428
|
-
|
315
|
+
def get_error_count
|
316
|
+
errorcount = @paramlist['ERROR_COUNT'].to_s
|
317
|
+
errorcount
|
429
318
|
end
|
430
319
|
|
431
|
-
def
|
432
|
-
errors =
|
433
|
-
error_count =
|
434
|
-
|
320
|
+
def geterrors
|
321
|
+
errors = []
|
322
|
+
error_count = get_error_count
|
323
|
+
(0..error_count.to_i - 1).each do |i|
|
435
324
|
errors = @paramlist["ERROR_#{i}"]
|
436
325
|
end
|
437
|
-
|
326
|
+
errors.compact
|
438
327
|
end
|
439
328
|
|
440
|
-
def
|
441
|
-
count_triggered = @paramlist[
|
442
|
-
|
329
|
+
def get_numbercounters_triggered
|
330
|
+
count_triggered = @paramlist['COUNTERS_TRIGGERED'].to_s
|
331
|
+
count_triggered
|
443
332
|
end
|
444
333
|
|
445
|
-
def
|
446
|
-
counters =
|
447
|
-
numCounters =
|
448
|
-
|
334
|
+
def get_counters_triggered
|
335
|
+
counters = []
|
336
|
+
numCounters = get_numbercounters_triggered
|
337
|
+
(0..numCounters.to_i - 1).each do |i|
|
449
338
|
countername = @paramlist["COUNTER_NAME_#{i}"]
|
450
|
-
counters[countername.to_s
|
339
|
+
counters[countername.to_s] = @paramlist["COUNTER_VALUE_#{i}"]
|
451
340
|
end
|
452
|
-
|
341
|
+
counters.compact
|
453
342
|
end
|
454
|
-
|
455
343
|
end
|
456
|
-
|
457
|
-
end
|
344
|
+
end
|
data/lib/kount/client.rb
CHANGED
@@ -7,7 +7,7 @@ require 'rest-client'
|
|
7
7
|
require 'uri'
|
8
8
|
require 'kount/utils/khash'
|
9
9
|
|
10
|
-
|
10
|
+
|
11
11
|
module Kount
|
12
12
|
##
|
13
13
|
# This class is where the primary interaction with
|
@@ -30,13 +30,15 @@ module Kount
|
|
30
30
|
PROD_DEFAULT_OPTIONS = {
|
31
31
|
endpoint: ENDPOINT_PROD,
|
32
32
|
version: DEFAULT_VERSION,
|
33
|
-
is_test: false
|
33
|
+
is_test: false,
|
34
|
+
timeout: 10
|
34
35
|
}
|
35
36
|
|
36
37
|
# Default params for test if is_test is TRUE
|
37
38
|
TEST_DEFAULT_OPTIONS = {
|
38
39
|
endpoint: ENDPOINT_TEST,
|
39
|
-
version: DEFAULT_VERSION
|
40
|
+
version: DEFAULT_VERSION,
|
41
|
+
timeout: 10
|
40
42
|
}
|
41
43
|
|
42
44
|
# Initialize a client object
|
@@ -66,10 +68,11 @@ module Kount
|
|
66
68
|
begin
|
67
69
|
response = RestClient::Resource.new(
|
68
70
|
endpoint,
|
69
|
-
verify_ssl: verify_ssl_option, timeout:
|
71
|
+
verify_ssl: verify_ssl_option, timeout: timeout
|
72
|
+
).post params, x_kount_api_key: key
|
70
73
|
|
71
74
|
JSON.parse(response)
|
72
|
-
rescue
|
75
|
+
rescue StandardError
|
73
76
|
# RIS errors do not come back as JSON, so just pass them along raw.
|
74
77
|
response
|
75
78
|
end
|
data/lib/kount/request.rb
CHANGED
@@ -12,7 +12,7 @@ module Kount
|
|
12
12
|
#
|
13
13
|
# @param initial_params [Hash] Initial params for request
|
14
14
|
def initialize(initial_params = {})
|
15
|
-
|
15
|
+
raise "Cannot directly instantiate a #{self.class}." if
|
16
16
|
self.class == Request
|
17
17
|
@params = initial_params
|
18
18
|
end
|
@@ -40,14 +40,14 @@ module Kount
|
|
40
40
|
case params[:PTYP]
|
41
41
|
when 'CARD', 'TOKEN'
|
42
42
|
#ptok = Kount::SecurityMash.hash_credit_card(ptok, ksalt)
|
43
|
-
ptok = Kount::Khash.
|
43
|
+
ptok = Kount::Khash.hash_payment_token(ptok, ksalt)
|
44
44
|
params.merge!(PTOK: ptok, PENC: 'KHASH')
|
45
45
|
when 'GIFT', 'OTHER'
|
46
46
|
#ptok = Kount::SecurityMash.hash_gift_card(ptok, ksalt, merchant_id)
|
47
|
-
ptok = Kount::Khash.
|
47
|
+
ptok = Kount::Khash.hash_gift_card(ptok, ksalt, merchant_id)
|
48
48
|
params.merge!(PTOK: ptok, PENC: 'KHASH')
|
49
49
|
when 'CHEK', 'OTHER'
|
50
|
-
ptok = Kount::Khash.
|
50
|
+
ptok = Kount::Khash.hash_check_payment(ptok, ksalt)
|
51
51
|
params.merge!(PTOK: ptok, PENC: 'KHASH')
|
52
52
|
when 'NONE'
|
53
53
|
params.merge!(PTOK: nil, PENC: nil)
|
data/lib/kount/security_mash.rb
CHANGED
@@ -2,7 +2,7 @@ require 'digest/sha1'
|
|
2
2
|
module Kount
|
3
3
|
##
|
4
4
|
# This class implements the Kount KHASH for cards and gift cards.
|
5
|
-
|
5
|
+
|
6
6
|
class SecurityMash
|
7
7
|
# @param plain_text [String] String to be hashed
|
8
8
|
# @param ptyp [String] Payment type code: CARD, GIFT, or OTHER
|
data/lib/kount/utils/khash.rb
CHANGED
@@ -13,7 +13,7 @@ module Kount
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
def self.
|
16
|
+
def self.getkhash(data, len, m)
|
17
17
|
a = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
18
18
|
r = Digest::SHA1.hexdigest("#{data}.#{m}")
|
19
19
|
c = ''
|
@@ -27,20 +27,20 @@ module Kount
|
|
27
27
|
c
|
28
28
|
end
|
29
29
|
|
30
|
-
def self.
|
30
|
+
def self.hash_payment_token(plain_text, ksalt)
|
31
31
|
first_six = plain_text[0..5]
|
32
|
-
mashed =
|
32
|
+
mashed = getkhash(plain_text, 14, ksalt)
|
33
33
|
"#{first_six}#{mashed}"
|
34
34
|
end
|
35
35
|
|
36
|
-
def self.
|
36
|
+
def self.hash_check_payment(plain_text, ksalt)
|
37
37
|
first_six = plain_text[0..5]
|
38
|
-
mashed =
|
38
|
+
mashed = getkhash(plain_text, 14, ksalt)
|
39
39
|
"#{first_six}#{mashed}"
|
40
40
|
end
|
41
41
|
|
42
|
-
def self.
|
43
|
-
mashed =
|
42
|
+
def self.hash_gift_card(plain_text, ksalt, merchant_id)
|
43
|
+
mashed = getkhash(plain_text, 14, ksalt)
|
44
44
|
"#{merchant_id}#{mashed}"
|
45
45
|
end
|
46
46
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kount_complete
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kount
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -72,7 +72,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: '2.3'
|
76
76
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
77
|
requirements:
|
78
78
|
- - ">="
|