cardknox 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/cardknox/agent.rb +1 -1
- data/lib/cardknox/api.rb +10 -0
- data/lib/cardknox/version.rb +1 -1
- data/lib/cardknox/webhook.rb +19 -0
- data/lib/cardknox.rb +2 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c8aaf412811cc4de9a7b18b57bc53cb6569a1ff7d603f447f9bc5fd2a0ad542
|
4
|
+
data.tar.gz: 19563fc7274c0dca754f3b21fd0b2f83ebafd1faeb64b8633d61e5a8e4fbab30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3739e1e43a8886069d4dbf977da63288a19bf1c78d3dde24c9df7e0e26541389636275035b351ce9636cfdc1183ff91cd5b7e4afe232d494f97fa9a92debd36
|
7
|
+
data.tar.gz: 504dee42b616762d383302f1ef5e187120595f08fda0a30cb4d00ed0f89c5401c182f17a8c5afce77b9c3b518e27e9b7283eedfbb0a4663095277bac3c1f1263
|
data/lib/cardknox/agent.rb
CHANGED
@@ -21,7 +21,7 @@ module Cardknox
|
|
21
21
|
|
22
22
|
def parse(response)
|
23
23
|
JSON.parse(response.body, symbolize_names: true).tap do |payload|
|
24
|
-
|
24
|
+
unless ["Approved", "Success"].include?(payload[:xStatus])
|
25
25
|
raise Error::TransactionFailure.new(payload[:xError], response)
|
26
26
|
end
|
27
27
|
end
|
data/lib/cardknox/api.rb
CHANGED
@@ -24,6 +24,16 @@ module Cardknox
|
|
24
24
|
}))
|
25
25
|
end
|
26
26
|
|
27
|
+
def report(command, params = {})
|
28
|
+
@agent.post("/reportjson", params.merge({
|
29
|
+
xKey: config.api_key,
|
30
|
+
xVersion: config.gateway_version,
|
31
|
+
xSoftwareName: config.software_name,
|
32
|
+
xSoftwareVersion: config.software_version,
|
33
|
+
xCommand: command,
|
34
|
+
}))
|
35
|
+
end
|
36
|
+
|
27
37
|
def status
|
28
38
|
@agent.get("/status")
|
29
39
|
end
|
data/lib/cardknox/version.rb
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cardknox
|
4
|
+
module Webhook
|
5
|
+
class << self
|
6
|
+
def verify_signature(params:, secret_key:, signature:)
|
7
|
+
sorted_values = params.to_h.sort_by do |key, _value|
|
8
|
+
key.downcase
|
9
|
+
end.map(&:last).join
|
10
|
+
|
11
|
+
hexdigest = Digest::MD5.hexdigest(
|
12
|
+
"#{sorted_values}#{secret_key}",
|
13
|
+
).upcase
|
14
|
+
|
15
|
+
hexdigest == signature
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/cardknox.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cardknox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Algonauti
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -57,6 +57,7 @@ files:
|
|
57
57
|
- lib/cardknox/configuration.rb
|
58
58
|
- lib/cardknox/error.rb
|
59
59
|
- lib/cardknox/version.rb
|
60
|
+
- lib/cardknox/webhook.rb
|
60
61
|
homepage: https://github.com/algonauti/cardknow
|
61
62
|
licenses:
|
62
63
|
- MIT
|