justifi 0.5.0 → 0.5.1
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/Gemfile.lock +6 -6
- data/README.md +1 -8
- data/lib/justifi/util.rb +7 -0
- data/lib/justifi/version.rb +1 -1
- data/lib/justifi/webhook.rb +11 -0
- data/lib/justifi.rb +1 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db211cc27d14f3a8c481e942c147da0d3991d00dfdf4f0c01a2b81918a36592b
|
4
|
+
data.tar.gz: e91acbe0e30fc8ca4f8d0982c6aa15a2f332b3af836458f4074361503081b2c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2f14ebba685f687c554d39ed43b9a6291ef540c4d4bca463825dd726fb7829bee152f38186c26d176082775232c42e516e3fb3cec7f6dd12e755b5c3af5382f
|
7
|
+
data.tar.gz: 3afc707b5e171126379f0b011e9cf285976212db354d00e6a8e0e376a57ff1c0fc0a055f8371abec48897329dc595b107f5a66fb581432a767b397cbce1011fb
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
justifi (0.5.
|
4
|
+
justifi (0.5.1)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -22,7 +22,7 @@ GEM
|
|
22
22
|
public_suffix (4.0.7)
|
23
23
|
rainbow (3.1.1)
|
24
24
|
rake (13.0.6)
|
25
|
-
regexp_parser (2.3.
|
25
|
+
regexp_parser (2.3.1)
|
26
26
|
repo-small-badge (0.2.7)
|
27
27
|
victor (~> 0.2.8)
|
28
28
|
rexml (3.2.5)
|
@@ -39,13 +39,13 @@ GEM
|
|
39
39
|
diff-lcs (>= 1.2.0, < 2.0)
|
40
40
|
rspec-support (~> 3.11.0)
|
41
41
|
rspec-support (3.11.0)
|
42
|
-
rubocop (1.
|
42
|
+
rubocop (1.28.2)
|
43
43
|
parallel (~> 1.10)
|
44
44
|
parser (>= 3.1.0.0)
|
45
45
|
rainbow (>= 2.2.2, < 4.0)
|
46
46
|
regexp_parser (>= 1.8, < 3.0)
|
47
47
|
rexml
|
48
|
-
rubocop-ast (>= 1.
|
48
|
+
rubocop-ast (>= 1.17.0, < 2.0)
|
49
49
|
ruby-progressbar (~> 1.7)
|
50
50
|
unicode-display_width (>= 1.4.0, < 3.0)
|
51
51
|
rubocop-ast (1.17.0)
|
@@ -63,8 +63,8 @@ GEM
|
|
63
63
|
repo-small-badge (~> 0.2.7)
|
64
64
|
simplecov (~> 0.17)
|
65
65
|
simplecov_json_formatter (0.1.4)
|
66
|
-
standard (1.
|
67
|
-
rubocop (= 1.
|
66
|
+
standard (1.11.0)
|
67
|
+
rubocop (= 1.28.2)
|
68
68
|
rubocop-performance (= 1.13.3)
|
69
69
|
unicode-display_width (2.1.0)
|
70
70
|
victor (0.2.8)
|
data/README.md
CHANGED
@@ -5,24 +5,17 @@ It includes a pre-defined set of modules and classes that are essentially wrappe
|
|
5
5
|
|
6
6
|
## Installation
|
7
7
|
|
8
|
-
From the command line:
|
9
|
-
```bash
|
10
|
-
gem install justifi --version "0.4.0" --source "https://rubygems.pkg.github.com/justifi-tech"
|
11
|
-
```
|
12
|
-
OR
|
13
|
-
|
14
8
|
Add these lines to your application's Gemfile:
|
15
9
|
|
16
10
|
```ruby
|
17
11
|
source "https://rubygems.pkg.github.com/justifi-tech" do
|
18
|
-
gem "justifi"
|
12
|
+
gem "justifi"
|
19
13
|
end
|
20
14
|
```
|
21
15
|
And then execute:
|
22
16
|
|
23
17
|
$ bundle install
|
24
18
|
|
25
|
-
|
26
19
|
## Setup
|
27
20
|
|
28
21
|
The gem needs to be configured with your `client_id` and `client_secret` in order to access JustiFi API resources.
|
data/lib/justifi/util.rb
CHANGED
@@ -78,5 +78,12 @@ module Justifi
|
|
78
78
|
end
|
79
79
|
result
|
80
80
|
end
|
81
|
+
|
82
|
+
# Creates a computed signature that can verify the payload sent.
|
83
|
+
# Each webhook has its own signature key that can be achieved in JustiFi's platform
|
84
|
+
def self.compute_signature(received_event, timestamp, secret_key)
|
85
|
+
timestamp_payload = "#{timestamp}.#{received_event.to_json}"
|
86
|
+
OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new("sha256"), secret_key, timestamp_payload)
|
87
|
+
end
|
81
88
|
end
|
82
89
|
end
|
data/lib/justifi/version.rb
CHANGED
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Justifi
|
4
|
+
module Webhook
|
5
|
+
class << self
|
6
|
+
def verify_signature(received_event:, timestamp:, secret_key:, signature:)
|
7
|
+
signature == Util.compute_signature(received_event, timestamp, secret_key)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
data/lib/justifi.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: justifi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JustiFi
|
@@ -177,6 +177,7 @@ files:
|
|
177
177
|
- lib/justifi/refund.rb
|
178
178
|
- lib/justifi/util.rb
|
179
179
|
- lib/justifi/version.rb
|
180
|
+
- lib/justifi/webhook.rb
|
180
181
|
homepage: https://justifi.ai
|
181
182
|
licenses: []
|
182
183
|
metadata:
|