onfido 0.12.0 → 1.1.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 +5 -5
- data/.rubocop.yml +4 -3
- data/.travis.yml +8 -7
- data/CHANGELOG.md +23 -0
- data/LICENSE +2 -1
- data/README.md +70 -70
- data/lib/onfido.rb +1 -1
- data/lib/onfido/api.rb +4 -4
- data/lib/onfido/configuration.rb +12 -16
- data/lib/onfido/resource.rb +3 -6
- data/lib/onfido/resources/address.rb +1 -1
- data/lib/onfido/resources/applicant.rb +9 -5
- data/lib/onfido/resources/check.rb +10 -14
- data/lib/onfido/resources/document.rb +11 -11
- data/lib/onfido/resources/extraction.rb +9 -0
- data/lib/onfido/resources/live_photo.rb +9 -14
- data/lib/onfido/resources/live_video.rb +5 -8
- data/lib/onfido/resources/report.rb +8 -9
- data/lib/onfido/resources/sdk_token.rb +3 -5
- data/lib/onfido/resources/webhook.rb +11 -9
- data/lib/onfido/version.rb +1 -1
- data/onfido.gemspec +8 -9
- data/spec/integrations/address_spec.rb +1 -0
- data/spec/integrations/applicant_spec.rb +38 -32
- data/spec/integrations/check_spec.rb +13 -23
- data/spec/integrations/document_spec.rb +16 -17
- data/spec/integrations/exceptions_spec.rb +12 -13
- data/spec/integrations/extraction_spec.rb +19 -0
- data/spec/integrations/live_photo_spec.rb +12 -13
- data/spec/integrations/live_video_spec.rb +7 -10
- data/spec/integrations/report_spec.rb +11 -13
- data/spec/integrations/sdk_token_spec.rb +5 -5
- data/spec/integrations/webhook_spec.rb +35 -20
- data/spec/onfido/resource_spec.rb +10 -14
- data/spec/onfido_spec.rb +13 -13
- data/spec/support/fake_onfido_api.rb +60 -77
- data/spec/support/fixtures/applicant.json +21 -42
- data/spec/support/fixtures/check.json +4 -4
- data/spec/support/fixtures/checks.json +4 -4
- data/spec/support/fixtures/document.json +2 -2
- data/spec/support/fixtures/documents.json +8 -8
- data/spec/support/fixtures/extraction.json +23 -0
- data/spec/support/fixtures/live_photo.json +3 -3
- data/spec/support/fixtures/live_photos.json +6 -6
- data/spec/support/fixtures/live_video.json +3 -3
- data/spec/support/fixtures/live_videos.json +4 -4
- data/spec/support/fixtures/not_scheduled_for_deletion_error.json +7 -0
- data/spec/support/fixtures/report.json +4 -4
- data/spec/support/fixtures/reports.json +8 -8
- data/spec/support/fixtures/webhook.json +6 -5
- data/spec/support/fixtures/webhooks.json +17 -12
- metadata +22 -42
- data/lib/onfido/resources/report_type_group.rb +0 -11
- data/spec/integrations/report_type_group_spec.rb +0 -19
- data/spec/support/fixtures/check_with_expanded_reports.json +0 -30
- data/spec/support/fixtures/checks_with_expanded_reports.json +0 -34
- data/spec/support/fixtures/report_type_group.json +0 -25
- data/spec/support/fixtures/report_type_groups.json +0 -30
@@ -1,59 +1,49 @@
|
|
1
1
|
describe Onfido::Check do
|
2
2
|
subject(:check) { described_class.new }
|
3
3
|
let(:applicant_id) { '61f659cb-c90b-4067-808a-6136b5c01351' }
|
4
|
+
let(:check_id) { '8546921-123123-123123' }
|
4
5
|
|
5
6
|
describe '#create' do
|
6
|
-
let(:params) { { type: 'express', reports: [{ name: 'identity' }] } }
|
7
|
-
|
8
7
|
it 'creates a new check for an applicant' do
|
9
|
-
response = check.create(
|
8
|
+
response = check.create(
|
9
|
+
applicant_id: applicant_id,
|
10
|
+
report_names: ['identity_enhanced']
|
11
|
+
)
|
10
12
|
expect(response['id']).not_to be_nil
|
11
13
|
end
|
12
14
|
end
|
13
15
|
|
14
16
|
describe '#find' do
|
15
|
-
let(:check_id) { '8546921-123123-123123' }
|
16
|
-
|
17
17
|
it 'returns an existing check for the applicant' do
|
18
|
-
response = check.find(
|
18
|
+
response = check.find(check_id)
|
19
|
+
|
19
20
|
expect(response['id']).to eq(check_id)
|
20
21
|
end
|
21
22
|
|
22
|
-
it "returns
|
23
|
-
response = check.find(
|
24
|
-
expect(response['reports'].first).to be_a(String)
|
25
|
-
end
|
23
|
+
it "returns report_ids" do
|
24
|
+
response = check.find(check_id)
|
26
25
|
|
27
|
-
|
28
|
-
response = check.find(applicant_id, check_id, expand: "reports")
|
29
|
-
expect(response['reports'].first).to be_a(Hash)
|
26
|
+
expect(response['report_ids'].first).to be_a(String)
|
30
27
|
end
|
31
28
|
end
|
32
29
|
|
33
30
|
describe '#all' do
|
34
|
-
let(:check_id) { '8546921-123123-123123' }
|
35
|
-
|
36
31
|
context 'with the default page and per page params' do
|
37
32
|
it 'returns all existing checks for the applicant' do
|
38
33
|
response = check.all(applicant_id)
|
34
|
+
|
39
35
|
expect(response['checks'].size).to eq(1)
|
40
36
|
end
|
41
37
|
end
|
42
38
|
|
43
|
-
it "returns
|
39
|
+
it "returns report_ids" do
|
44
40
|
response = check.all(applicant_id)
|
45
|
-
expect(response['checks'].first['reports'].first).to be_a(String)
|
46
|
-
end
|
47
41
|
|
48
|
-
|
49
|
-
response = check.all(applicant_id, expand: "reports")
|
50
|
-
expect(response['checks'].first['reports'].first).to be_a(Hash)
|
42
|
+
expect(response['checks'].first['report_ids'].first).to be_a(String)
|
51
43
|
end
|
52
44
|
end
|
53
45
|
|
54
46
|
describe "#resume" do
|
55
|
-
let(:check_id) { '8546921-123123-123123' }
|
56
|
-
|
57
47
|
it 'returns success response' do
|
58
48
|
expect { check.resume(check_id) }.not_to raise_error
|
59
49
|
end
|
@@ -6,15 +6,15 @@ describe Onfido::Document do
|
|
6
6
|
describe '#create' do
|
7
7
|
let(:params) do
|
8
8
|
{
|
9
|
-
|
10
|
-
|
11
|
-
file: file
|
9
|
+
applicant_id: '1030303-123123-123123',
|
10
|
+
type: 'driving_licence',
|
11
|
+
file: file,
|
12
|
+
side: 'front'
|
12
13
|
}
|
13
14
|
end
|
14
|
-
let(:applicant_id) { '1030303-123123-123123' }
|
15
15
|
|
16
16
|
context 'with a File-like object to upload' do
|
17
|
-
let(:file) { Tempfile.new(['
|
17
|
+
let(:file) { Tempfile.new(['driving_licence', '.jpg']) }
|
18
18
|
|
19
19
|
after do
|
20
20
|
file.close
|
@@ -22,7 +22,8 @@ describe Onfido::Document do
|
|
22
22
|
end
|
23
23
|
|
24
24
|
it 'creates a new document' do
|
25
|
-
response = document.create(
|
25
|
+
response = document.create(**params)
|
26
|
+
|
26
27
|
expect(response['id']).not_to be_nil
|
27
28
|
end
|
28
29
|
end
|
@@ -31,37 +32,35 @@ describe Onfido::Document do
|
|
31
32
|
let(:file) { 'https://onfido.com/images/logo.png' }
|
32
33
|
|
33
34
|
it 'raises an ArgumentError' do
|
34
|
-
expect { document.create(
|
35
|
+
expect { document.create(**params) }.
|
35
36
|
to raise_error(ArgumentError, /must be a `File`-like object/)
|
36
37
|
end
|
37
38
|
end
|
38
39
|
end
|
39
40
|
|
40
41
|
describe '#find' do
|
41
|
-
let(:applicant_id) { '1030303-123123-123123' }
|
42
|
-
let(:document_id) { '7568415-123123-123123' }
|
43
|
-
|
44
42
|
it 'returns the expected document' do
|
45
|
-
|
43
|
+
document_id = '7568415-123123-123123'
|
44
|
+
response = document.find(document_id)
|
45
|
+
|
46
46
|
expect(response['id']).to eq(document_id)
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
50
|
describe '#all' do
|
51
|
-
let(:applicant_id) { '1030303-123123-123123' }
|
52
|
-
|
53
51
|
it 'returns list of documents' do
|
52
|
+
applicant_id = '1030303-123123-123123'
|
54
53
|
response = document.all(applicant_id)
|
54
|
+
|
55
55
|
expect(response['documents']).not_to be_empty
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
59
|
describe '#download' do
|
60
|
-
let(:applicant_id) { '1030303-123123-123123' }
|
61
|
-
let(:document_id) { '1212121-123123-123123' }
|
62
|
-
|
63
60
|
it 'returns the file data' do
|
64
|
-
|
61
|
+
document_id = '1212121-123123-123123'
|
62
|
+
response = document.download(document_id)
|
63
|
+
|
65
64
|
expect(response).not_to be_nil
|
66
65
|
end
|
67
66
|
end
|
@@ -1,34 +1,33 @@
|
|
1
1
|
describe Onfido::Resource do
|
2
2
|
let(:resource) { described_class.new }
|
3
|
-
let(:url) { Onfido.endpoint + path }
|
4
3
|
let(:api_key) { 'some_key' }
|
5
4
|
let(:payload) { { postcode: 'SE1 4NG' } }
|
6
5
|
|
7
6
|
before { allow(Onfido).to receive(:api_key).and_return(api_key) }
|
8
7
|
|
9
8
|
context '4xx response' do
|
10
|
-
let(:path) { '4xx_response' }
|
11
|
-
|
12
9
|
it 'raises a custom error' do
|
13
|
-
|
10
|
+
path = '4xx_response'
|
11
|
+
|
12
|
+
expect { resource.get(path: path, payload: payload) }.
|
14
13
|
to raise_error(Onfido::RequestError, 'Something went wrong')
|
15
14
|
end
|
16
15
|
end
|
17
16
|
|
18
17
|
context 'unexpected error format' do
|
19
|
-
let(:path) { 'unexpected_error_format' }
|
20
|
-
|
21
18
|
it 'raises a custom error' do
|
22
|
-
|
19
|
+
path = 'unexpected_error_format'
|
20
|
+
|
21
|
+
expect { resource.get(path: path, payload: payload) }.
|
23
22
|
to raise_error(Onfido::RequestError, /response code was 400/)
|
24
23
|
end
|
25
24
|
end
|
26
25
|
|
27
26
|
context 'unparseable JSON 5xx' do
|
28
|
-
let(:path) { 'unparseable_response' }
|
29
|
-
|
30
27
|
it 'raises a server error' do
|
31
|
-
|
28
|
+
path = 'unparseable_response'
|
29
|
+
|
30
|
+
expect { resource.get(path: path, payload: payload) }.
|
32
31
|
to raise_error(Onfido::ServerError, /response code was 504/)
|
33
32
|
end
|
34
33
|
end
|
@@ -41,7 +40,7 @@ describe Onfido::Resource do
|
|
41
40
|
end
|
42
41
|
|
43
42
|
it 'raises a ConnectionError' do
|
44
|
-
expect { resource.get(
|
43
|
+
expect { resource.get(path: Onfido.endpoint, payload: payload) }.
|
45
44
|
to raise_error(Onfido::ConnectionError, /Could not connect/)
|
46
45
|
end
|
47
46
|
end
|
@@ -54,7 +53,7 @@ describe Onfido::Resource do
|
|
54
53
|
end
|
55
54
|
|
56
55
|
it 'raises a ConnectionError' do
|
57
|
-
expect { resource.get(
|
56
|
+
expect { resource.get(path: Onfido.endpoint, payload: payload) }.
|
58
57
|
to raise_error(Onfido::ConnectionError, /connection to the server/)
|
59
58
|
end
|
60
59
|
end
|
@@ -67,7 +66,7 @@ describe Onfido::Resource do
|
|
67
66
|
end
|
68
67
|
|
69
68
|
it 'raises a ConnectionError' do
|
70
|
-
expect { resource.get(
|
69
|
+
expect { resource.get(path: Onfido.endpoint, payload: payload) }.
|
71
70
|
to raise_error(Onfido::ConnectionError, /SSL certificate/)
|
72
71
|
end
|
73
72
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'tempfile'
|
2
|
+
|
3
|
+
describe Onfido::Extraction do
|
4
|
+
subject(:extraction) { described_class.new }
|
5
|
+
|
6
|
+
describe '#create' do
|
7
|
+
let(:params) do
|
8
|
+
{
|
9
|
+
document_id: '7568415-123123-123123'
|
10
|
+
}
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'creates a new extraction' do
|
14
|
+
response = extraction.create(params)
|
15
|
+
|
16
|
+
expect(response['document_id']).to eq('7568415-123123-123123')
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -4,7 +4,7 @@ describe Onfido::LivePhoto do
|
|
4
4
|
subject(:live_photo) { described_class.new }
|
5
5
|
|
6
6
|
describe '#create' do
|
7
|
-
let(:params) { { file: file } }
|
7
|
+
let(:params) { { applicant_id: '123456', file: file } }
|
8
8
|
|
9
9
|
context 'with a File-like object to upload' do
|
10
10
|
let(:file) { Tempfile.new(['passport', '.jpg']) }
|
@@ -15,7 +15,8 @@ describe Onfido::LivePhoto do
|
|
15
15
|
end
|
16
16
|
|
17
17
|
it 'creates a new photo' do
|
18
|
-
response = live_photo.create(
|
18
|
+
response = live_photo.create(**params)
|
19
|
+
|
19
20
|
expect(response['id']).not_to be_nil
|
20
21
|
end
|
21
22
|
end
|
@@ -24,37 +25,35 @@ describe Onfido::LivePhoto do
|
|
24
25
|
let(:file) { 'https://onfido.com/images/photo.jpg' }
|
25
26
|
|
26
27
|
it 'raises an ArgumentError' do
|
27
|
-
expect { live_photo.create(
|
28
|
+
expect { live_photo.create(**params) }.
|
28
29
|
to raise_error(ArgumentError, /must be a `File`-like object/)
|
29
30
|
end
|
30
31
|
end
|
31
32
|
end
|
32
33
|
|
33
34
|
describe '#find' do
|
34
|
-
let(:applicant_id) { '1030303-123123-123123' }
|
35
|
-
let(:live_photo_id) { '3538c8f6-fdce-4745-9d34-fc246bc05aa1' }
|
36
|
-
|
37
35
|
it 'returns the expected live photo' do
|
38
|
-
|
36
|
+
live_photo_id = '3538c8f6-fdce-4745-9d34-fc246bc05aa1'
|
37
|
+
response = live_photo.find(live_photo_id)
|
38
|
+
|
39
39
|
expect(response['id']).to eq(live_photo_id)
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
43
|
describe '#all' do
|
44
|
-
let(:applicant_id) { '1030303-123123-123123' }
|
45
|
-
|
46
44
|
it 'returns list of documents' do
|
45
|
+
applicant_id = '1030303-123123-123123'
|
47
46
|
response = live_photo.all(applicant_id)
|
47
|
+
|
48
48
|
expect(response['live_photos']).not_to be_empty
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
52
|
describe '#download' do
|
53
|
-
let(:applicant_id) { '1030303-123123-123123' }
|
54
|
-
let(:live_photo_id) { '3538c8f6-fdce-4745-9d34-fc246bc05aa1' }
|
55
|
-
|
56
53
|
it 'returns the file data' do
|
57
|
-
|
54
|
+
live_photo_id = '3538c8f6-fdce-4745-9d34-fc246bc05aa1'
|
55
|
+
response = live_photo.download(live_photo_id)
|
56
|
+
|
58
57
|
expect(response).not_to be_nil
|
59
58
|
end
|
60
59
|
end
|
@@ -2,32 +2,29 @@ require 'tempfile'
|
|
2
2
|
|
3
3
|
describe Onfido::LiveVideo do
|
4
4
|
subject(:live_video) { described_class.new }
|
5
|
+
let(:live_video_id) { 'c9701e9b-83aa-442f-995b-20320ee8fb01' }
|
5
6
|
|
6
7
|
describe '#find' do
|
7
|
-
let(:applicant_id) { '1030303-123123-123123' }
|
8
|
-
let(:live_video_id) { 'c9701e9b-83aa-442f-995b-20320ee8fb01' }
|
9
|
-
|
10
8
|
it 'returns the expected live photo' do
|
11
|
-
response = live_video.find(
|
9
|
+
response = live_video.find(live_video_id)
|
10
|
+
|
12
11
|
expect(response['id']).to eq(live_video_id)
|
13
12
|
end
|
14
13
|
end
|
15
14
|
|
16
15
|
describe '#all' do
|
17
|
-
let(:applicant_id) { '1030303-123123-123123' }
|
18
|
-
|
19
16
|
it 'returns list of documents' do
|
17
|
+
applicant_id = '1030303-123123-123123'
|
20
18
|
response = live_video.all(applicant_id)
|
19
|
+
|
21
20
|
expect(response['live_videos']).not_to be_empty
|
22
21
|
end
|
23
22
|
end
|
24
23
|
|
25
24
|
describe '#download' do
|
26
|
-
let(:applicant_id) { '1030303-123123-123123' }
|
27
|
-
let(:live_video_id) { 'c9701e9b-83aa-442f-995b-20320ee8fb01' }
|
28
|
-
|
29
25
|
it 'returns the file data' do
|
30
|
-
response = live_video.download(
|
26
|
+
response = live_video.download(live_video_id)
|
27
|
+
|
31
28
|
expect(response).not_to be_nil
|
32
29
|
end
|
33
30
|
end
|
@@ -1,38 +1,36 @@
|
|
1
1
|
describe Onfido::Report do
|
2
2
|
subject(:report) { described_class.new }
|
3
|
-
let(:check_id) { '8546921-123123-123123' }
|
4
|
-
|
5
3
|
describe '#find' do
|
6
|
-
let(:report_id) { '6951786-123123-422221' }
|
7
|
-
|
8
4
|
it 'returns a report for an existing check' do
|
9
|
-
|
5
|
+
report_id = '6951786-123123-422221'
|
6
|
+
response = report.find(report_id)
|
7
|
+
|
10
8
|
expect(response['id']).to eq(report_id)
|
11
9
|
end
|
12
10
|
end
|
13
11
|
|
14
12
|
describe '#all' do
|
15
13
|
it 'lists all reports for an existing check' do
|
14
|
+
check_id = '8546921-123123-123123'
|
16
15
|
response = report.all(check_id)
|
16
|
+
|
17
17
|
expect(response['reports'].count).to eq(2)
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
21
|
describe '#resume' do
|
22
|
-
let(:report_id) { '6951786-123123-422221' }
|
23
|
-
let(:check_id) { '1212121-123123-422221' }
|
24
|
-
|
25
22
|
it 'returns a success response' do
|
26
|
-
|
23
|
+
report_id = '6951786-123123-422221'
|
24
|
+
|
25
|
+
expect { report.resume(report_id) }.not_to raise_error
|
27
26
|
end
|
28
27
|
end
|
29
28
|
|
30
29
|
describe '#cancel' do
|
31
|
-
let(:report_id) { '6951786-123123-422221' }
|
32
|
-
let(:check_id) { '1212121-123123-422221' }
|
33
|
-
|
34
30
|
it 'returns a success response' do
|
35
|
-
|
31
|
+
report_id = '6951786-123123-422221'
|
32
|
+
|
33
|
+
expect { report.cancel(report_id) }.not_to raise_error
|
36
34
|
end
|
37
35
|
end
|
38
36
|
end
|
@@ -1,13 +1,13 @@
|
|
1
1
|
describe Onfido::SdkToken do
|
2
2
|
subject(:sdk_token) { described_class.new }
|
3
|
-
let(:applicant_id) { '61f659cb-c90b-4067-808a-6136b5c01351' }
|
4
|
-
let(:referrer) { 'http://*.mywebsite.com/*' }
|
5
3
|
|
6
4
|
describe '#create' do
|
7
|
-
let(:params) { { applicant_id: applicant_id, referrer: referrer } }
|
8
|
-
|
9
5
|
it 'creates a new SDK token for the applicant' do
|
10
|
-
|
6
|
+
applicant_id = '61f659cb-c90b-4067-808a-6136b5c01351'
|
7
|
+
referrer = 'http://*.mywebsite.com/*'
|
8
|
+
|
9
|
+
response = sdk_token.create(applicant_id: applicant_id, referrer: referrer)
|
10
|
+
|
11
11
|
expect(response['token']).not_to be_nil
|
12
12
|
end
|
13
13
|
end
|
@@ -1,47 +1,58 @@
|
|
1
1
|
describe Onfido::Webhook do
|
2
2
|
subject(:webhook) { described_class.new }
|
3
|
-
let(:params) do
|
4
|
-
{
|
5
|
-
"url" => "https://webhookendpoint.url",
|
6
|
-
"enabled" => true,
|
7
|
-
"events" => [
|
8
|
-
"report completion",
|
9
|
-
"report withdrawal",
|
10
|
-
"check completion",
|
11
|
-
"check in progress"
|
12
|
-
]
|
13
|
-
}
|
14
|
-
end
|
15
3
|
|
16
4
|
describe "#create" do
|
17
|
-
|
18
|
-
|
5
|
+
let(:params) do
|
6
|
+
{
|
7
|
+
url: "https://webhookendpoint.url",
|
8
|
+
enabled: true,
|
9
|
+
events: [
|
10
|
+
"report.completed",
|
11
|
+
"check.completed"
|
12
|
+
]
|
13
|
+
}
|
14
|
+
end
|
15
|
+
|
16
|
+
it "creates the webhook" do
|
17
|
+
response = webhook.create(**params)
|
18
|
+
|
19
19
|
expect(response['id']).to_not be_nil
|
20
20
|
end
|
21
21
|
|
22
22
|
it "responds with the right url" do
|
23
|
-
response = webhook.create(params)
|
24
|
-
|
23
|
+
response = webhook.create(**params)
|
24
|
+
|
25
|
+
expect(response["url"]).to eq params[:url]
|
25
26
|
end
|
26
27
|
end
|
27
28
|
|
28
29
|
describe '#find' do
|
29
|
-
let(:webhook_id) { 'fcb73186-0733-4f6f-9c57-d9d5ef979443' }
|
30
|
-
|
31
30
|
it 'returns the webhook' do
|
31
|
+
webhook_id = 'fcb73186-0733-4f6f-9c57-d9d5ef979443'
|
32
|
+
|
32
33
|
response = webhook.find(webhook_id)
|
34
|
+
|
33
35
|
expect(response['id']).to eq(webhook_id)
|
34
36
|
end
|
35
37
|
end
|
36
38
|
|
39
|
+
describe "#destroy" do
|
40
|
+
it "removes the webhook" do
|
41
|
+
webhook_id = 'fcb73186-0733-4f6f-9c57-d9d5ef979443'
|
42
|
+
expect { webhook.destroy(webhook_id) }.not_to raise_error
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
37
46
|
describe "#all" do
|
38
47
|
it "returns all the registered webhooks" do
|
39
48
|
response = webhook.all
|
49
|
+
|
40
50
|
expect(response["webhooks"].count).to eq 2
|
41
51
|
end
|
42
52
|
|
43
53
|
it "returns with id" do
|
44
54
|
response = webhook.all
|
55
|
+
|
45
56
|
expect(response["webhooks"][0]["id"]).to_not be_nil
|
46
57
|
expect(response["webhooks"][1]["id"]).to_not be_nil
|
47
58
|
end
|
@@ -53,13 +64,17 @@ describe Onfido::Webhook do
|
|
53
64
|
end
|
54
65
|
|
55
66
|
let(:request_body) { '{"foo":"bar"}' }
|
56
|
-
let(:request_signature)
|
67
|
+
let(:request_signature) do
|
68
|
+
'89e60408fec20bfb26bb0f993d5e88307818982f50f23b361a00d679bae8b1dc'
|
69
|
+
end
|
57
70
|
let(:token) { 'very_secret_token' }
|
58
71
|
|
59
72
|
it { is_expected.to be(true) }
|
60
73
|
|
61
74
|
context "with an invalid signature" do
|
62
|
-
let(:request_signature)
|
75
|
+
let(:request_signature) do
|
76
|
+
's21fd54ew2w1f5d15642132f3d7727ff9a32a7c87072ce514df1f6d3228bec'
|
77
|
+
end
|
63
78
|
it { is_expected.to be(false) }
|
64
79
|
end
|
65
80
|
|