rubycicd_uat 3.0.2 → 3.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 +31 -31
- data/lib/kount/Logs.log +497 -497
- data/lib/kount/Response.rb +344 -344
- data/lib/kount/cart.rb +36 -36
- data/lib/kount/client.rb +147 -147
- data/lib/kount/payment_types.rb +52 -52
- data/lib/kount/request.rb +50 -50
- data/lib/kount/request/inquiry.rb +90 -90
- data/lib/kount/request/update.rb +28 -28
- data/lib/kount/ris_inquiry.rb +73 -73
- data/lib/kount/security_mash.rb +82 -82
- data/lib/kount/utils/khash.rb +56 -56
- metadata +3 -3
data/lib/kount/security_mash.rb
CHANGED
@@ -1,82 +1,82 @@
|
|
1
|
-
require 'digest/sha1'
|
2
|
-
module Kount
|
3
|
-
##
|
4
|
-
# This class implements the Kount KHASH for cards and gift cards.
|
5
|
-
|
6
|
-
class SecurityMash
|
7
|
-
# @param plain_text [String] String to be hashed
|
8
|
-
# @param ptyp [String] Payment type code: CARD, GIFT, or OTHER
|
9
|
-
# @return [String] KHASH version of string
|
10
|
-
def self.hash_token(plain_text, ptyp, ksalt, merchant_id = '')
|
11
|
-
if ptyp == 'CARD'
|
12
|
-
hash_credit_card(plain_text, ksalt)
|
13
|
-
else
|
14
|
-
hash_gift_card(plain_text, ksalt, merchant_id)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
# Hash a credit card number.
|
19
|
-
# Preserves first six characters of the input so that hashed cards can be
|
20
|
-
# categorized by Bank Identification Number (BIN).
|
21
|
-
#
|
22
|
-
# Example usage:
|
23
|
-
# hashed = Kount::SecurityMash.hash_credit_card("4111111111111111")
|
24
|
-
# Expect: 411111WMS5YA6FUZA1KC
|
25
|
-
# hashed = Kount::SecurityMash.hash_credit_card("5199185454061655")
|
26
|
-
# Expect: 5199182NOQRXNKTTFL11
|
27
|
-
# hashed = Kount::SecurityMash.hash_credit_card("4259344583883")
|
28
|
-
# Expect: 425934FEXQI1QS6TH2O5
|
29
|
-
#
|
30
|
-
# @param plain_text [String] String to be hashed
|
31
|
-
# @return [String] KHASH version of string
|
32
|
-
def self.hash_credit_card(plain_text, ksalt)
|
33
|
-
return plain_text if khashed?(plain_text)
|
34
|
-
first_six = plain_text[0..5]
|
35
|
-
mashed = mash(plain_text, 14, ksalt)
|
36
|
-
"#{first_six}#{mashed}"
|
37
|
-
end
|
38
|
-
|
39
|
-
# Hash a gift card number.
|
40
|
-
# Use the six characters of the merchant id so that hashed cards can be
|
41
|
-
# unique across the entire domain.
|
42
|
-
#
|
43
|
-
# Example usage:
|
44
|
-
# hashed = Kount::SecurityMash.hash_gift_card("123456", "3245876")
|
45
|
-
# Expect: 1234569HXH32Y5NNJCGB
|
46
|
-
|
47
|
-
# @param plain_text [String] String to be hashed
|
48
|
-
# @return [String] KHASH version of string
|
49
|
-
def self.hash_gift_card(plain_text, ksalt, merchant_id)
|
50
|
-
mashed = mash(plain_text, 14, ksalt)
|
51
|
-
"#{merchant_id}#{mashed}"
|
52
|
-
end
|
53
|
-
|
54
|
-
# Compute a base64 hash of the provided data.
|
55
|
-
#
|
56
|
-
# @param data [String] Data to hash
|
57
|
-
# @param len [int] Length of hash to retain
|
58
|
-
# @return [String] Hashed data
|
59
|
-
# rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
60
|
-
def self.mash(data, len, m)
|
61
|
-
a = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
62
|
-
r = Digest::SHA1.hexdigest("#{data}.#{m}")
|
63
|
-
c = ''
|
64
|
-
len = 17 if len > 17
|
65
|
-
limit = 2 * len
|
66
|
-
i = 0
|
67
|
-
while i < limit
|
68
|
-
c << a[r[i..i + 6].to_i(16) % 36]
|
69
|
-
i += 2
|
70
|
-
end
|
71
|
-
c
|
72
|
-
end
|
73
|
-
|
74
|
-
# end mash
|
75
|
-
|
76
|
-
# @param val [String] Token that may or may not be khashed
|
77
|
-
# @return [Boolean] True if token is already khashed
|
78
|
-
def self.khashed?(val)
|
79
|
-
true if val =~ /(\d{6}[A-Z0-9]{14})/
|
80
|
-
end
|
81
|
-
end # end KountSecurityMash
|
82
|
-
end
|
1
|
+
require 'digest/sha1'
|
2
|
+
module Kount
|
3
|
+
##
|
4
|
+
# This class implements the Kount KHASH for cards and gift cards.
|
5
|
+
|
6
|
+
class SecurityMash
|
7
|
+
# @param plain_text [String] String to be hashed
|
8
|
+
# @param ptyp [String] Payment type code: CARD, GIFT, or OTHER
|
9
|
+
# @return [String] KHASH version of string
|
10
|
+
def self.hash_token(plain_text, ptyp, ksalt, merchant_id = '')
|
11
|
+
if ptyp == 'CARD'
|
12
|
+
hash_credit_card(plain_text, ksalt)
|
13
|
+
else
|
14
|
+
hash_gift_card(plain_text, ksalt, merchant_id)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
# Hash a credit card number.
|
19
|
+
# Preserves first six characters of the input so that hashed cards can be
|
20
|
+
# categorized by Bank Identification Number (BIN).
|
21
|
+
#
|
22
|
+
# Example usage:
|
23
|
+
# hashed = Kount::SecurityMash.hash_credit_card("4111111111111111")
|
24
|
+
# Expect: 411111WMS5YA6FUZA1KC
|
25
|
+
# hashed = Kount::SecurityMash.hash_credit_card("5199185454061655")
|
26
|
+
# Expect: 5199182NOQRXNKTTFL11
|
27
|
+
# hashed = Kount::SecurityMash.hash_credit_card("4259344583883")
|
28
|
+
# Expect: 425934FEXQI1QS6TH2O5
|
29
|
+
#
|
30
|
+
# @param plain_text [String] String to be hashed
|
31
|
+
# @return [String] KHASH version of string
|
32
|
+
def self.hash_credit_card(plain_text, ksalt)
|
33
|
+
return plain_text if khashed?(plain_text)
|
34
|
+
first_six = plain_text[0..5]
|
35
|
+
mashed = mash(plain_text, 14, ksalt)
|
36
|
+
"#{first_six}#{mashed}"
|
37
|
+
end
|
38
|
+
|
39
|
+
# Hash a gift card number.
|
40
|
+
# Use the six characters of the merchant id so that hashed cards can be
|
41
|
+
# unique across the entire domain.
|
42
|
+
#
|
43
|
+
# Example usage:
|
44
|
+
# hashed = Kount::SecurityMash.hash_gift_card("123456", "3245876")
|
45
|
+
# Expect: 1234569HXH32Y5NNJCGB
|
46
|
+
|
47
|
+
# @param plain_text [String] String to be hashed
|
48
|
+
# @return [String] KHASH version of string
|
49
|
+
def self.hash_gift_card(plain_text, ksalt, merchant_id)
|
50
|
+
mashed = mash(plain_text, 14, ksalt)
|
51
|
+
"#{merchant_id}#{mashed}"
|
52
|
+
end
|
53
|
+
|
54
|
+
# Compute a base64 hash of the provided data.
|
55
|
+
#
|
56
|
+
# @param data [String] Data to hash
|
57
|
+
# @param len [int] Length of hash to retain
|
58
|
+
# @return [String] Hashed data
|
59
|
+
# rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
60
|
+
def self.mash(data, len, m)
|
61
|
+
a = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
62
|
+
r = Digest::SHA1.hexdigest("#{data}.#{m}")
|
63
|
+
c = ''
|
64
|
+
len = 17 if len > 17
|
65
|
+
limit = 2 * len
|
66
|
+
i = 0
|
67
|
+
while i < limit
|
68
|
+
c << a[r[i..i + 6].to_i(16) % 36]
|
69
|
+
i += 2
|
70
|
+
end
|
71
|
+
c
|
72
|
+
end
|
73
|
+
|
74
|
+
# end mash
|
75
|
+
|
76
|
+
# @param val [String] Token that may or may not be khashed
|
77
|
+
# @return [Boolean] True if token is already khashed
|
78
|
+
def self.khashed?(val)
|
79
|
+
true if val =~ /(\d{6}[A-Z0-9]{14})/
|
80
|
+
end
|
81
|
+
end # end KountSecurityMash
|
82
|
+
end
|
data/lib/kount/utils/khash.rb
CHANGED
@@ -1,56 +1,56 @@
|
|
1
|
-
module Kount
|
2
|
-
class Khash
|
3
|
-
# @param plain_text [String] String to be hashed
|
4
|
-
# @param ptyp [String] Payment type code: CARD, GIFT, or OTHER
|
5
|
-
# @return [String] KHASH version of string
|
6
|
-
def self.hash_token(plain_text, ptyp, ksalt, merchant_id = '')
|
7
|
-
if ptyp == 'CARD'
|
8
|
-
HashPaymentToken(plain_text, ksalt)
|
9
|
-
elsif ptyp == 'CHEK'
|
10
|
-
HashCheckPayment(plain_text, ksalt)
|
11
|
-
else
|
12
|
-
HashGiftCard(plain_text, ksalt, merchant_id)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.getkhash(data, len, m)
|
17
|
-
a = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
18
|
-
r = Digest::SHA1.hexdigest("#{data}.#{m}")
|
19
|
-
c = ''
|
20
|
-
len = 17 if len > 17
|
21
|
-
limit = 2 * len
|
22
|
-
i = 0
|
23
|
-
while i < limit
|
24
|
-
c << a[r[i..i + 6].to_i(16) % 36]
|
25
|
-
i += 2
|
26
|
-
end
|
27
|
-
c
|
28
|
-
end
|
29
|
-
|
30
|
-
def self.hash_payment_token(plain_text, ksalt)
|
31
|
-
return plain_text if khashed?(plain_text)
|
32
|
-
first_six = plain_text[0..5]
|
33
|
-
mashed = getkhash(plain_text, 14, ksalt)
|
34
|
-
"#{first_six}#{mashed}"
|
35
|
-
end
|
36
|
-
|
37
|
-
def self.hash_check_payment(plain_text, ksalt)
|
38
|
-
return plain_text if khashed?(plain_text)
|
39
|
-
first_six = plain_text[0..5]
|
40
|
-
mashed = getkhash(plain_text, 14, ksalt)
|
41
|
-
"#{first_six}#{mashed}"
|
42
|
-
end
|
43
|
-
|
44
|
-
def self.hash_gift_card(plain_text, ksalt, merchant_id)
|
45
|
-
mashed = getkhash(plain_text, 14, ksalt)
|
46
|
-
"#{merchant_id}#{mashed}"
|
47
|
-
end
|
48
|
-
|
49
|
-
# @param val [String] Token that may or may not be khashed
|
50
|
-
# @return [Boolean] True if token is already khashed
|
51
|
-
def self.khashed?(val)
|
52
|
-
true if val =~ /(\d{6}[A-Z0-9]{14})/
|
53
|
-
end
|
54
|
-
|
55
|
-
end
|
56
|
-
end
|
1
|
+
module Kount
|
2
|
+
class Khash
|
3
|
+
# @param plain_text [String] String to be hashed
|
4
|
+
# @param ptyp [String] Payment type code: CARD, GIFT, or OTHER
|
5
|
+
# @return [String] KHASH version of string
|
6
|
+
def self.hash_token(plain_text, ptyp, ksalt, merchant_id = '')
|
7
|
+
if ptyp == 'CARD'
|
8
|
+
HashPaymentToken(plain_text, ksalt)
|
9
|
+
elsif ptyp == 'CHEK'
|
10
|
+
HashCheckPayment(plain_text, ksalt)
|
11
|
+
else
|
12
|
+
HashGiftCard(plain_text, ksalt, merchant_id)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.getkhash(data, len, m)
|
17
|
+
a = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
18
|
+
r = Digest::SHA1.hexdigest("#{data}.#{m}")
|
19
|
+
c = ''
|
20
|
+
len = 17 if len > 17
|
21
|
+
limit = 2 * len
|
22
|
+
i = 0
|
23
|
+
while i < limit
|
24
|
+
c << a[r[i..i + 6].to_i(16) % 36]
|
25
|
+
i += 2
|
26
|
+
end
|
27
|
+
c
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.hash_payment_token(plain_text, ksalt)
|
31
|
+
return plain_text if khashed?(plain_text)
|
32
|
+
first_six = plain_text[0..5]
|
33
|
+
mashed = getkhash(plain_text, 14, ksalt)
|
34
|
+
"#{first_six}#{mashed}"
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.hash_check_payment(plain_text, ksalt)
|
38
|
+
return plain_text if khashed?(plain_text)
|
39
|
+
first_six = plain_text[0..5]
|
40
|
+
mashed = getkhash(plain_text, 14, ksalt)
|
41
|
+
"#{first_six}#{mashed}"
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.hash_gift_card(plain_text, ksalt, merchant_id)
|
45
|
+
mashed = getkhash(plain_text, 14, ksalt)
|
46
|
+
"#{merchant_id}#{mashed}"
|
47
|
+
end
|
48
|
+
|
49
|
+
# @param val [String] Token that may or may not be khashed
|
50
|
+
# @return [Boolean] True if token is already khashed
|
51
|
+
def self.khashed?(val)
|
52
|
+
true if val =~ /(\d{6}[A-Z0-9]{14})/
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubycicd_uat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SanjeevITT
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-08-
|
11
|
+
date: 2020-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -81,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 1.3.5
|
83
83
|
requirements: []
|
84
|
-
rubygems_version: 3.
|
84
|
+
rubygems_version: 3.0.3
|
85
85
|
signing_key:
|
86
86
|
specification_version: 4
|
87
87
|
summary: Ruby CI/CD Services Wrapper
|