aliquot-pay 2.1.2 → 3.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/aliquot-pay.rb +12 -16
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35dfff1ebd40162ee529331539e3e84c3cd9d4584aa8c5cbcd512ad4f1bddbcd
|
4
|
+
data.tar.gz: 06405dd759121d55be37e9488f0a21b50bf710613b5d00cc9d91cbdd6bc1a6a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eab0cb24c340f738da984ec910f134836cd04deee6baca6ee2946e9fdcedc0253f8aba93c71e3c9f98b36f086ae7b003fb1a3eeb5964f9a67a1b189cede7132c
|
7
|
+
data.tar.gz: 8ec410a4184ba33fd932694d77ac37978e2da7af1851c5a97ff6640aad82a8690a14114e48607cd3df1dfdbb5a71ea0525a588895574cbfe1b6dbfcf34611999
|
data/lib/aliquot-pay.rb
CHANGED
@@ -18,7 +18,7 @@ class AliquotPay
|
|
18
18
|
attr_accessor :signed_key, :signatures
|
19
19
|
attr_accessor :key_expiration, :key_value
|
20
20
|
attr_accessor :encrypted_message, :cleartext_message, :ephemeral_public_key, :tag
|
21
|
-
attr_accessor :message_expiration, :message_id, :payment_method, :payment_method_details
|
21
|
+
attr_accessor :message_expiration, :message_id, :payment_method, :payment_method_details, :gateway_merchant_id
|
22
22
|
attr_accessor :pan, :expiration_month, :expiration_year, :auth_method
|
23
23
|
attr_accessor :cryptogram, :eci_indicator
|
24
24
|
|
@@ -34,7 +34,7 @@ class AliquotPay
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def extract_root_signing_keys
|
37
|
-
key = Base64.strict_encode64(
|
37
|
+
key = Base64.strict_encode64(ensure_root_key.to_der)
|
38
38
|
{
|
39
39
|
'keys' => [
|
40
40
|
'protocolVersion' => @protocol_version,
|
@@ -43,19 +43,6 @@ class AliquotPay
|
|
43
43
|
}.to_json
|
44
44
|
end
|
45
45
|
|
46
|
-
if OpenSSL::VERSION >= '3'
|
47
|
-
# pkeys are immutable on OpenSSL >=3.0
|
48
|
-
def eckey_to_public(key)
|
49
|
-
key.public_to_der
|
50
|
-
end
|
51
|
-
else
|
52
|
-
def eckey_to_public(key)
|
53
|
-
k = OpenSSL::PKey::EC.new(EC_CURVE)
|
54
|
-
k.public_key = key.public_key
|
55
|
-
k.to_der
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
46
|
def sign(key, message)
|
60
47
|
d = OpenSSL::Digest::SHA256.new
|
61
48
|
def key.private?; private_key?; end
|
@@ -116,6 +103,7 @@ class AliquotPay
|
|
116
103
|
|
117
104
|
def build_cleartext_message
|
118
105
|
return @cleartext_message if @cleartext_message
|
106
|
+
|
119
107
|
default_message_id = Base64.strict_encode64(OpenSSL::Random.random_bytes(24))
|
120
108
|
default_message_expiration = ((Time.now.to_f + 60 * 5) * 1000).round.to_s
|
121
109
|
|
@@ -125,6 +113,14 @@ class AliquotPay
|
|
125
113
|
'paymentMethod' => @payment_method || 'CARD',
|
126
114
|
'paymentMethodDetails' => build_payment_method_details
|
127
115
|
}
|
116
|
+
|
117
|
+
if @protocol_version == :ECv2
|
118
|
+
@cleartext_message.merge!(
|
119
|
+
'gatewayMerchantId' => @gateway_merchant_id || 'SOME GATEWAY MERCHANT ID'
|
120
|
+
)
|
121
|
+
end
|
122
|
+
|
123
|
+
@cleartext_message
|
128
124
|
end
|
129
125
|
|
130
126
|
def build_signed_message
|
@@ -150,7 +146,7 @@ class AliquotPay
|
|
150
146
|
fail 'Intermediate key must be public and private key'
|
151
147
|
end
|
152
148
|
|
153
|
-
default_key_value = Base64.strict_encode64(
|
149
|
+
default_key_value = Base64.strict_encode64(@intermediate_key.to_der)
|
154
150
|
default_key_expiration = "#{Time.now.to_i + 3600}000"
|
155
151
|
|
156
152
|
@signed_key = {
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aliquot-pay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Clearhaus
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hkdf
|