finapps 5.0.29 → 5.0.34
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +2 -1
- data/.github/workflows/main.yaml +43 -0
- data/.rubocop.yml +134 -61
- data/.rubocop_todo.yml +120 -0
- data/.tmuxinator.yml +1 -0
- data/.travis.yml +3 -1
- data/RELEASES.md +31 -0
- data/finapps.gemspec +4 -4
- data/lib/finapps.rb +2 -0
- data/lib/finapps/rest/alert_definitions.rb +1 -1
- data/lib/finapps/rest/alert_occurrences.rb +1 -1
- data/lib/finapps/rest/client.rb +2 -0
- data/lib/finapps/rest/consumers.rb +22 -6
- data/lib/finapps/rest/consumers_portfolios.rb +1 -1
- data/lib/finapps/rest/documents_orders.rb +43 -25
- data/lib/finapps/rest/documents_orders_notifications.rb +14 -0
- data/lib/finapps/rest/operators.rb +5 -5
- data/lib/finapps/rest/operators_password_resets.rb +1 -1
- data/lib/finapps/rest/order_assignments.rb +1 -1
- data/lib/finapps/rest/order_reports.rb +1 -1
- data/lib/finapps/rest/orders.rb +10 -10
- data/lib/finapps/rest/plaid/plaid_consumer_institutions.rb +1 -1
- data/lib/finapps/rest/portfolio_reports.rb +1 -1
- data/lib/finapps/rest/portfolios.rb +1 -1
- data/lib/finapps/rest/portfolios_available_consumers.rb +1 -1
- data/lib/finapps/rest/portfolios_consumers.rb +1 -1
- data/lib/finapps/rest/sessions.rb +1 -1
- data/lib/finapps/rest/signed_documents_downloads.rb +17 -0
- data/lib/finapps/version.rb +1 -1
- data/spec/rest/alert_definitions_spec.rb +10 -2
- data/spec/rest/alert_occurrences_spec.rb +6 -1
- data/spec/rest/api_request.rb +1 -0
- data/spec/rest/client_spec.rb +2 -2
- data/spec/rest/consumers_portfolios_spec.rb +7 -2
- data/spec/rest/consumers_spec.rb +54 -7
- data/spec/rest/documents_orders_notifications_spec.rb +42 -0
- data/spec/rest/documents_orders_spec.rb +95 -17
- data/spec/rest/esign_templates_spec.rb +2 -1
- data/spec/rest/operators_password_resets_spec.rb +6 -1
- data/spec/rest/operators_spec.rb +22 -2
- data/spec/rest/order_assignments_spec.rb +6 -1
- data/spec/rest/order_notifications_spec.rb +3 -1
- data/spec/rest/order_refreshes_spec.rb +7 -1
- data/spec/rest/order_reports_spec.rb +7 -1
- data/spec/rest/order_statuses_spec.rb +7 -3
- data/spec/rest/order_tokens_spec.rb +7 -1
- data/spec/rest/orders_spec.rb +63 -29
- data/spec/rest/password_resets_spec.rb +20 -10
- data/spec/rest/plaid/plaid_account_permissions_spec.rb +5 -4
- data/spec/rest/plaid/plaid_accounts_spec.rb +9 -4
- data/spec/rest/plaid/plaid_consumer_institutions_spec.rb +10 -10
- data/spec/rest/plaid/plaid_institution_logos_spec.rb +1 -1
- data/spec/rest/plaid/plaid_webhooks_spec.rb +3 -1
- data/spec/rest/portfolio_reports_spec.rb +7 -2
- data/spec/rest/portfolios_alerts_spec.rb +6 -1
- data/spec/rest/portfolios_available_consumers_spec.rb +7 -2
- data/spec/rest/portfolios_consumers_spec.rb +13 -2
- data/spec/rest/portfolios_spec.rb +20 -5
- data/spec/rest/products_spec.rb +3 -1
- data/spec/rest/sessions_spec.rb +8 -4
- data/spec/rest/signed_documents_downloads_spec.rb +35 -0
- data/spec/rest/tenant_app_settings_spec.rb +9 -3
- data/spec/rest/tenant_settings_spec.rb +9 -3
- data/spec/rest/verix/verix_documents_spec.rb +13 -20
- data/spec/rest/verix/verix_metadata_spec.rb +1 -1
- data/spec/rest/verix/verix_pdf_documents_spec.rb +14 -19
- data/spec/rest/verix/verix_records_spec.rb +31 -10
- data/spec/rest/version_spec.rb +3 -1
- data/spec/spec_helper.rb +2 -2
- data/spec/support/fake_api.rb +20 -3
- data/spec/support/fixtures/documents_orders_none.json +6 -0
- data/spec/support/fixtures/signed_document.pdf +0 -0
- data/spec/utils/query_builder_spec.rb +40 -14
- metadata +26 -16
@@ -4,7 +4,7 @@ require 'spec_helpers/client'
|
|
4
4
|
|
5
5
|
RSpec.describe FinApps::REST::AlertOccurrences do
|
6
6
|
include SpecHelpers::Client
|
7
|
-
subject {
|
7
|
+
subject { described_class.new(client) }
|
8
8
|
|
9
9
|
describe '#list' do
|
10
10
|
let(:list) { subject.list(params) }
|
@@ -16,9 +16,11 @@ RSpec.describe FinApps::REST::AlertOccurrences do
|
|
16
16
|
|
17
17
|
it { expect { list }.not_to raise_error }
|
18
18
|
it('returns an array') { expect(list).to be_a(Array) }
|
19
|
+
|
19
20
|
it('performs a get and returns the response') do
|
20
21
|
expect(results).to have_key(:records)
|
21
22
|
end
|
23
|
+
|
22
24
|
it('returns no error messages') { expect(errors).to be_empty }
|
23
25
|
end
|
24
26
|
|
@@ -40,10 +42,13 @@ RSpec.describe FinApps::REST::AlertOccurrences do
|
|
40
42
|
|
41
43
|
it { expect { list }.not_to raise_error }
|
42
44
|
it('returns an array') { expect(list).to be_a(Array) }
|
45
|
+
|
43
46
|
it('performs a get and returns the response') do
|
44
47
|
expect(results).to have_key(:records)
|
45
48
|
end
|
49
|
+
|
46
50
|
it('returns no error messages') { expect(errors).to be_empty }
|
51
|
+
|
47
52
|
it 'builds query and sends proper request' do
|
48
53
|
list
|
49
54
|
url =
|
data/spec/rest/api_request.rb
CHANGED
data/spec/rest/client_spec.rb
CHANGED
@@ -3,14 +3,14 @@
|
|
3
3
|
RSpec.describe FinApps::REST::Client do
|
4
4
|
describe '#new' do
|
5
5
|
it 'raises for missing company_token' do
|
6
|
-
expect {
|
6
|
+
expect { described_class.new nil }.to raise_error(
|
7
7
|
FinAppsCore::MissingArgumentsError
|
8
8
|
)
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
12
|
context 'an instance of Client' do
|
13
|
-
subject {
|
13
|
+
subject { described_class.new(:company_token) }
|
14
14
|
|
15
15
|
FinApps::REST::Client::RESOURCES.each do |method|
|
16
16
|
it("responds to #{method}") { expect(subject).to respond_to(method) }
|
@@ -4,7 +4,7 @@ require 'spec_helpers/client'
|
|
4
4
|
|
5
5
|
RSpec.describe FinApps::REST::ConsumersPortfolios do
|
6
6
|
include SpecHelpers::Client
|
7
|
-
subject {
|
7
|
+
subject { described_class.new(client) }
|
8
8
|
|
9
9
|
describe '#list' do
|
10
10
|
let(:list) { subject.list(id, params) }
|
@@ -24,9 +24,11 @@ RSpec.describe FinApps::REST::ConsumersPortfolios do
|
|
24
24
|
|
25
25
|
it { expect { list }.not_to raise_error }
|
26
26
|
it('returns an array') { expect(list).to be_a(Array) }
|
27
|
+
|
27
28
|
it('performs a get and returns the response') do
|
28
29
|
expect(results).to have_key(:records)
|
29
30
|
end
|
31
|
+
|
30
32
|
it('returns no error messages') { expect(errors).to be_empty }
|
31
33
|
end
|
32
34
|
|
@@ -39,14 +41,17 @@ RSpec.describe FinApps::REST::ConsumersPortfolios do
|
|
39
41
|
|
40
42
|
context 'when including valid params' do
|
41
43
|
let(:id) { 'valid_id' }
|
42
|
-
let(:params) { {
|
44
|
+
let(:params) { {page: 2, sort: '-created_date', requested: 25} }
|
43
45
|
|
44
46
|
it { expect { list }.not_to raise_error }
|
45
47
|
it('returns an array') { expect(list).to be_a(Array) }
|
48
|
+
|
46
49
|
it('performs a get and returns the response') do
|
47
50
|
expect(results).to have_key(:records)
|
48
51
|
end
|
52
|
+
|
49
53
|
it('returns no error messages') { expect(errors).to be_empty }
|
54
|
+
|
50
55
|
it 'builds query and sends proper request' do
|
51
56
|
list
|
52
57
|
url =
|
data/spec/rest/consumers_spec.rb
CHANGED
@@ -4,7 +4,8 @@ require 'spec_helpers/client'
|
|
4
4
|
RSpec.describe FinApps::REST::Consumers,
|
5
5
|
'initialized with valid FinApps::Client object' do
|
6
6
|
include SpecHelpers::Client
|
7
|
-
subject(:users) {
|
7
|
+
subject(:users) { described_class.new(client) }
|
8
|
+
|
8
9
|
missing_public_id = ': public_id'
|
9
10
|
|
10
11
|
describe '#create' do
|
@@ -24,9 +25,11 @@ RSpec.describe FinApps::REST::Consumers,
|
|
24
25
|
|
25
26
|
it { expect { create }.not_to raise_error }
|
26
27
|
it('results is a Hash') { expect(results).to be_a(Hash) }
|
28
|
+
|
27
29
|
it('performs a post and returns the response') do
|
28
30
|
expect(results).to have_key(:public_id)
|
29
31
|
end
|
32
|
+
|
30
33
|
it('error_messages array is empty') { expect(error_messages).to eq([]) }
|
31
34
|
end
|
32
35
|
|
@@ -35,6 +38,7 @@ RSpec.describe FinApps::REST::Consumers,
|
|
35
38
|
|
36
39
|
it { expect { create }.not_to raise_error }
|
37
40
|
it('results is nil') { expect(results).to be_nil }
|
41
|
+
|
38
42
|
it('error messages array is populated') do
|
39
43
|
expect(error_messages.first.downcase).to eq('invalid request body')
|
40
44
|
end
|
@@ -48,10 +52,13 @@ RSpec.describe FinApps::REST::Consumers,
|
|
48
52
|
|
49
53
|
context 'when missing params' do
|
50
54
|
let(:params) { nil }
|
51
|
-
|
55
|
+
|
56
|
+
it { expect { list }.not_to raise_error }
|
57
|
+
|
52
58
|
it('performs a get and returns the response') do
|
53
59
|
expect(results).to have_key(:records)
|
54
60
|
end
|
61
|
+
|
55
62
|
it('returns an array of records') { expect(results[:records]).to be_a(Array) }
|
56
63
|
it('returns no error messages') { expect(error_messages).to be_empty }
|
57
64
|
end
|
@@ -70,14 +77,17 @@ RSpec.describe FinApps::REST::Consumers,
|
|
70
77
|
}
|
71
78
|
end
|
72
79
|
|
73
|
-
it { expect { list }.
|
80
|
+
it { expect { list }.not_to raise_error }
|
74
81
|
it('returns an array') { expect(list).to be_a(Array) }
|
82
|
+
|
75
83
|
it('performs a get and returns the response') do
|
76
84
|
expect(results).to have_key(:records)
|
77
85
|
end
|
86
|
+
|
78
87
|
it('returns no error messages') do
|
79
88
|
expect(error_messages).to be_empty
|
80
89
|
end
|
90
|
+
|
81
91
|
it 'builds query and sends proper request' do
|
82
92
|
list
|
83
93
|
url = "#{versioned_api_path}/consumers?page=3&requested=19"
|
@@ -95,21 +105,49 @@ RSpec.describe FinApps::REST::Consumers,
|
|
95
105
|
}
|
96
106
|
end
|
97
107
|
|
98
|
-
it { expect { list }.
|
108
|
+
it { expect { list }.not_to raise_error }
|
99
109
|
it('returns an array') { expect(list).to be_a(Array) }
|
110
|
+
|
100
111
|
it('performs a get and returns the response') do
|
101
112
|
expect(results).to have_key(:records)
|
102
113
|
end
|
114
|
+
|
103
115
|
it('returns no error messages') do
|
104
116
|
expect(error_messages).to be_empty
|
105
117
|
end
|
118
|
+
|
106
119
|
it 'builds query and sends proper request' do
|
107
120
|
list
|
108
|
-
url = "#{versioned_api_path}/consumers?
|
109
|
-
|
110
|
-
|
121
|
+
url = "#{versioned_api_path}/consumers?"\
|
122
|
+
'filter=%7B%22$or%22:%5B%7B%22email%22:%22term%22%7D,' \
|
123
|
+
'%7B%22first_name%22:%22term%22%7D,'\
|
124
|
+
'%7B%22last_name%22:%22term%22%7D%5D%7D&page=2&requested=25' \
|
125
|
+
'&sort=date_created'
|
111
126
|
expect(WebMock).to have_requested(:get, url)
|
112
127
|
end
|
128
|
+
|
129
|
+
context 'when search term contains a space' do
|
130
|
+
let(:params) do
|
131
|
+
{
|
132
|
+
page: 2,
|
133
|
+
sort: 'date_created',
|
134
|
+
requested: 25,
|
135
|
+
searchTerm: 'Two terms'
|
136
|
+
}
|
137
|
+
end
|
138
|
+
|
139
|
+
it 'treats space as start of a new query for first and last name' do
|
140
|
+
list
|
141
|
+
url = "#{versioned_api_path}/consumers?"\
|
142
|
+
'filter=%7B%22$or%22:%5B%7B%22email%22:%22Two%20terms%22%7D,'\
|
143
|
+
'%7B%22first_name%22:%22Two%20terms%22%7D,'\
|
144
|
+
'%7B%22last_name%22:%22Two%20terms%22%7D,%7B%22first_name%22:'\
|
145
|
+
'%22Two%22%7D,%7B%22last_name%22:%22Two%22%7D,'\
|
146
|
+
'%7B%22first_name%22:%22terms%22%7D,%7B%22last_name%22:'\
|
147
|
+
'%22terms%22%7D%5D%7D&page=2&requested=25&sort=date_created'
|
148
|
+
expect(WebMock).to have_requested(:get, url)
|
149
|
+
end
|
150
|
+
end
|
113
151
|
end
|
114
152
|
end
|
115
153
|
|
@@ -130,9 +168,11 @@ RSpec.describe FinApps::REST::Consumers,
|
|
130
168
|
|
131
169
|
it { expect { show }.not_to raise_error }
|
132
170
|
it('results is a Hash') { expect(results).to be_a(Hash) }
|
171
|
+
|
133
172
|
it('performs a get and returns the response') do
|
134
173
|
expect(results).to have_key(:public_id)
|
135
174
|
end
|
175
|
+
|
136
176
|
it('error_messages array is empty') { expect(error_messages).to eq([]) }
|
137
177
|
end
|
138
178
|
|
@@ -143,6 +183,7 @@ RSpec.describe FinApps::REST::Consumers,
|
|
143
183
|
|
144
184
|
it { expect { show }.not_to raise_error }
|
145
185
|
it('results is nil') { expect(results).to be_nil }
|
186
|
+
|
146
187
|
it('error messages array is populated') do
|
147
188
|
expect(error_messages.first.downcase).to eq('resource not found')
|
148
189
|
end
|
@@ -179,6 +220,7 @@ RSpec.describe FinApps::REST::Consumers,
|
|
179
220
|
|
180
221
|
it { expect { update }.not_to raise_error }
|
181
222
|
it('results is nil') { expect(results).to be_nil }
|
223
|
+
|
182
224
|
it('error messages array is populated') do
|
183
225
|
expect(error_messages.first.downcase).to eq(
|
184
226
|
'invalid user id specified.'
|
@@ -200,12 +242,15 @@ RSpec.describe FinApps::REST::Consumers,
|
|
200
242
|
|
201
243
|
it { expect { update }.not_to raise_error }
|
202
244
|
it('results is a Hash') { expect(results).to be_a(Hash) }
|
245
|
+
|
203
246
|
it('the public_id is on the results') do
|
204
247
|
expect(results).to have_key(:public_id)
|
205
248
|
end
|
249
|
+
|
206
250
|
it('the new token is on the results') do
|
207
251
|
expect(results).to have_key(:token)
|
208
252
|
end
|
253
|
+
|
209
254
|
it('error_messages array is empty') { expect(error_messages).to eq([]) }
|
210
255
|
end
|
211
256
|
|
@@ -221,6 +266,7 @@ RSpec.describe FinApps::REST::Consumers,
|
|
221
266
|
|
222
267
|
it { expect { update }.not_to raise_error }
|
223
268
|
it('results is nil') { expect(results).to be_nil }
|
269
|
+
|
224
270
|
it('error messages array is populated') do
|
225
271
|
expect(error_messages.first.downcase).to eq('resource not found')
|
226
272
|
end
|
@@ -254,6 +300,7 @@ RSpec.describe FinApps::REST::Consumers,
|
|
254
300
|
|
255
301
|
it { expect { destroy }.not_to raise_error }
|
256
302
|
it('results is nil') { expect(results).to be_nil }
|
303
|
+
|
257
304
|
it('error messages array is populated') do
|
258
305
|
expect(error_messages.first.downcase).to eq('resource not found')
|
259
306
|
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helpers/client'
|
4
|
+
|
5
|
+
RSpec.describe FinApps::REST::DocumentsOrdersNotifications do
|
6
|
+
include SpecHelpers::Client
|
7
|
+
|
8
|
+
describe '#create' do
|
9
|
+
subject(:notifications) { described_class.new(client) }
|
10
|
+
|
11
|
+
context 'when missing id' do
|
12
|
+
let(:create) { subject.create(nil) }
|
13
|
+
|
14
|
+
it('returns missing argument error') do
|
15
|
+
expect { create }.to raise_error(FinAppsCore::MissingArgumentsError)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
context 'when invalid id is provided' do
|
20
|
+
let(:create) { subject.create(:invalid_id) }
|
21
|
+
let(:results) { create[RESULTS] }
|
22
|
+
let(:error_messages) { create[ERROR_MESSAGES] }
|
23
|
+
|
24
|
+
it { expect { create }.not_to raise_error }
|
25
|
+
it('results is nil') { expect(results).to be_nil }
|
26
|
+
|
27
|
+
it('error messages array is populated') do
|
28
|
+
expect(error_messages.first.downcase).to eq('order id is invalid')
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context 'for valid id' do
|
33
|
+
let(:create) { subject.create(:valid_id) }
|
34
|
+
let(:results) { create[RESULTS] }
|
35
|
+
let(:error_messages) { create[ERROR_MESSAGES] }
|
36
|
+
|
37
|
+
it { expect { create }.not_to raise_error }
|
38
|
+
it('results is nil') { expect(results).to be_nil }
|
39
|
+
it('error_messages array is empty') { expect(error_messages).to eq([]) }
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -15,7 +15,8 @@ RSpec.describe FinApps::REST::DocumentsOrders do
|
|
15
15
|
end
|
16
16
|
|
17
17
|
describe '#list' do
|
18
|
-
subject(:list) {
|
18
|
+
subject(:list) { described_class.new(client).list(params) }
|
19
|
+
|
19
20
|
let(:results) { list[0] }
|
20
21
|
let(:error_messages) { list[1] }
|
21
22
|
|
@@ -31,12 +32,14 @@ RSpec.describe FinApps::REST::DocumentsOrders do
|
|
31
32
|
end
|
32
33
|
|
33
34
|
context 'without searchTerm' do
|
34
|
-
let(:params) { {
|
35
|
+
let(:params) { {searchTerm: nil, page: 2} }
|
36
|
+
|
35
37
|
it_behaves_like 'an API request'
|
36
38
|
it_behaves_like 'a successful request'
|
37
39
|
it 'performs a get and returns the response' do
|
38
40
|
expect(results).to have_key(:records)
|
39
41
|
end
|
42
|
+
|
40
43
|
it 'builds query and sends proper request' do
|
41
44
|
list
|
42
45
|
url = "#{versioned_api_path}/documents/orders?page=2"
|
@@ -50,25 +53,72 @@ RSpec.describe FinApps::REST::DocumentsOrders do
|
|
50
53
|
it 'performs a get and returns the response' do
|
51
54
|
expect(results).to have_key(:records)
|
52
55
|
end
|
56
|
+
|
53
57
|
it 'builds query and sends proper request' do
|
54
58
|
list
|
55
59
|
url =
|
56
|
-
"#{versioned_api_path}/documents/orders?
|
57
|
-
'%22
|
58
|
-
'%
|
59
|
-
'%
|
60
|
+
"#{versioned_api_path}/documents/orders?"\
|
61
|
+
'filter=%7B%22$or%22:%5B%7B%22applicant.email%22:'\
|
62
|
+
'%22term%22%7D,%7B%22applicant.first_name%22:%22term%22%7D,'\
|
63
|
+
'%7B%22applicant.last_name%22:'\
|
64
|
+
'%22term%22%7D,%7B%22reference_no%22:%7B%22$regex%22:%22%5Eterm%22,'\
|
65
|
+
'%22$options%22:%22i%22%7D%7D%5D,'\
|
66
|
+
'%22consumer_id%22:%22valid_consumer_id%22%7D&'\
|
67
|
+
'page=2&requested=25&sort=tag '
|
68
|
+
|
60
69
|
expect(WebMock).to have_requested(:get, url)
|
61
70
|
end
|
71
|
+
|
72
|
+
context 'with search term containing spaces' do
|
73
|
+
let(:params) { {"searchTerm": 'Blue Jay', "page": 2} }
|
74
|
+
|
75
|
+
it 'builds query and sends proper request' do
|
76
|
+
list
|
77
|
+
url =
|
78
|
+
"#{versioned_api_path}/documents/orders?"\
|
79
|
+
'filter=%7B%22$or%22:%5B%7B%22applicant.email%22:'\
|
80
|
+
'%22Blue%20Jay%22%7D,'\
|
81
|
+
'%7B%22applicant.first_name%22:%22Blue%20Jay%22%7D,'\
|
82
|
+
'%7B%22applicant.last_name%22:'\
|
83
|
+
'%22Blue%20Jay%22%7D,'\
|
84
|
+
'%7B%22reference_no%22:%7B%22$regex%22:%22%5EBlue%20Jay%22,'\
|
85
|
+
'%22$options%22:'\
|
86
|
+
'%22i%22%7D%7D,%7B%22applicant.first_name%22:%22Blue%22%7D,'\
|
87
|
+
'%7B%22applicant.last_name%22:%22Blue%22%7D,'\
|
88
|
+
'%7B%22applicant.first_name%22:%22Jay%22%7D,'\
|
89
|
+
'%7B%22applicant.last_name%22:%22Jay%22%7D%5D%7D&page=2'
|
90
|
+
|
91
|
+
expect(WebMock).to have_requested(:get, url)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
context 'when filtering by open status ordes' do
|
97
|
+
let(:params) { {status: 1} }
|
98
|
+
|
99
|
+
it_behaves_like 'an API request'
|
100
|
+
it_behaves_like 'a successful request'
|
101
|
+
it { expect(subject.first[:records]).not_to be_empty }
|
102
|
+
end
|
103
|
+
|
104
|
+
context 'when filtering by closed status ordes' do
|
105
|
+
let(:params) { {status: 2, searchTerm: 'term'} }
|
106
|
+
|
107
|
+
it_behaves_like 'an API request'
|
108
|
+
it_behaves_like 'a successful request'
|
109
|
+
it { expect(results[:records]).to be_empty }
|
62
110
|
end
|
63
111
|
end
|
64
112
|
|
65
113
|
context 'with invalid params' do
|
66
114
|
let(:params) { ['invalid array'] }
|
115
|
+
|
67
116
|
it { expect { list }.to raise_error(FinAppsCore::InvalidArgumentsError) }
|
68
117
|
end
|
69
118
|
|
70
119
|
context 'with missing params' do
|
71
120
|
let(:params) { nil }
|
121
|
+
|
72
122
|
it_behaves_like 'an API request'
|
73
123
|
it_behaves_like 'a successful request'
|
74
124
|
it('performs a get and returns the response') do
|
@@ -78,15 +128,18 @@ RSpec.describe FinApps::REST::DocumentsOrders do
|
|
78
128
|
end
|
79
129
|
|
80
130
|
describe '#show' do
|
81
|
-
subject(:show) {
|
131
|
+
subject(:show) { described_class.new(client).show(id) }
|
132
|
+
|
82
133
|
let(:results) { show[0] }
|
83
134
|
let(:error_messages) { show[1] }
|
84
135
|
|
85
136
|
context 'with valid id' do
|
86
137
|
let(:id) { :valid_order_id }
|
138
|
+
|
87
139
|
it_behaves_like 'an API request'
|
88
140
|
it_behaves_like 'a successful request'
|
89
141
|
it('results is a Hash') { expect(results).to be_a(Hash) }
|
142
|
+
|
90
143
|
it('performs a get and returns the response') do
|
91
144
|
expect(results).to have_key(:order_id)
|
92
145
|
end
|
@@ -94,18 +147,21 @@ RSpec.describe FinApps::REST::DocumentsOrders do
|
|
94
147
|
|
95
148
|
context 'with invalid id' do
|
96
149
|
let(:id) { :invalid_order_id }
|
150
|
+
|
97
151
|
it { expect(results).to be_nil }
|
98
|
-
it { expect(error_messages).
|
152
|
+
it { expect(error_messages).not_to be_empty }
|
99
153
|
end
|
100
154
|
|
101
155
|
context 'when missing id' do
|
102
156
|
let(:id) { nil }
|
157
|
+
|
103
158
|
it_behaves_like 'a request that raises an error'
|
104
159
|
end
|
105
160
|
end
|
106
161
|
|
107
162
|
describe '#create' do
|
108
|
-
subject(:create) {
|
163
|
+
subject(:create) { described_class.new(client).create(params) }
|
164
|
+
|
109
165
|
let(:results) { create[0] }
|
110
166
|
let(:error_messages) { create[1] }
|
111
167
|
|
@@ -125,9 +181,11 @@ RSpec.describe FinApps::REST::DocumentsOrders do
|
|
125
181
|
"tag": 'new'
|
126
182
|
}
|
127
183
|
end
|
184
|
+
|
128
185
|
it_behaves_like 'an API request'
|
129
186
|
it_behaves_like 'a successful request'
|
130
187
|
it('results is a Hash') { expect(results).to be_a(Hash) }
|
188
|
+
|
131
189
|
it('performs a post and returns the response') do
|
132
190
|
expect(results).to have_key(:order_id)
|
133
191
|
end
|
@@ -145,8 +203,10 @@ RSpec.describe FinApps::REST::DocumentsOrders do
|
|
145
203
|
"reference_no": 'REFNO'
|
146
204
|
}
|
147
205
|
end
|
206
|
+
|
148
207
|
it { expect { create }.not_to raise_error }
|
149
208
|
it('results is nil') { expect(results).to be_nil }
|
209
|
+
|
150
210
|
it('error messages array is populated') do
|
151
211
|
expect(error_messages.first.downcase).to eq('invalid request body')
|
152
212
|
end
|
@@ -154,12 +214,14 @@ RSpec.describe FinApps::REST::DocumentsOrders do
|
|
154
214
|
|
155
215
|
context 'with missing params' do
|
156
216
|
let(:params) { nil }
|
217
|
+
|
157
218
|
it_behaves_like 'a request that raises an error'
|
158
219
|
end
|
159
220
|
end
|
160
221
|
|
161
222
|
describe '#update' do
|
162
|
-
subject(:update) {
|
223
|
+
subject(:update) { described_class.new(client).update(id, params) }
|
224
|
+
|
163
225
|
let(:params) { {} }
|
164
226
|
let(:results) { update[0] }
|
165
227
|
let(:error_messages) { update[1] }
|
@@ -168,16 +230,19 @@ RSpec.describe FinApps::REST::DocumentsOrders do
|
|
168
230
|
let(:id) { :valid_order_id }
|
169
231
|
|
170
232
|
context 'with valid params' do
|
171
|
-
let(:params) { {
|
233
|
+
let(:params) { {"tag": 'pending'} }
|
234
|
+
|
172
235
|
it_behaves_like 'an API request'
|
173
236
|
it_behaves_like 'a successful request'
|
174
237
|
it('results is nil') { expect(results).to be_nil }
|
175
238
|
end
|
176
239
|
|
177
240
|
context 'with invalid params' do
|
178
|
-
let(:params) { {
|
241
|
+
let(:params) { {"tag": 'invalid'} }
|
242
|
+
|
179
243
|
it_behaves_like 'an API request'
|
180
244
|
it('results is nil') { expect(results).to be_nil }
|
245
|
+
|
181
246
|
it('error messages array is populated') do
|
182
247
|
expect(error_messages.first.downcase).to eq('invalid request body')
|
183
248
|
end
|
@@ -186,9 +251,11 @@ RSpec.describe FinApps::REST::DocumentsOrders do
|
|
186
251
|
|
187
252
|
context 'with invalid id' do
|
188
253
|
let(:id) { :invalid_order_id }
|
189
|
-
let(:params) { {
|
254
|
+
let(:params) { {applicant: {first_name: 'Quasar'}} }
|
255
|
+
|
190
256
|
it_behaves_like 'an API request'
|
191
257
|
it('results is nil') { expect(results).to be_nil }
|
258
|
+
|
192
259
|
it('error messages array is populated') do
|
193
260
|
expect(error_messages.first.downcase).to eq(
|
194
261
|
'order id is invalid'
|
@@ -198,17 +265,20 @@ RSpec.describe FinApps::REST::DocumentsOrders do
|
|
198
265
|
|
199
266
|
context 'with missing id' do
|
200
267
|
let(:id) { nil }
|
268
|
+
|
201
269
|
it_behaves_like 'a request that raises an error'
|
202
270
|
end
|
203
271
|
end
|
204
272
|
|
205
273
|
describe '#destroy' do
|
206
|
-
subject(:destroy) {
|
274
|
+
subject(:destroy) { described_class.new(client).destroy(id) }
|
275
|
+
|
207
276
|
let(:results) { destroy[0] }
|
208
277
|
let(:error_messages) { destroy[1] }
|
209
278
|
|
210
279
|
context 'with valid id' do
|
211
280
|
let(:id) { :valid_order_id }
|
281
|
+
|
212
282
|
it_behaves_like 'an API request'
|
213
283
|
it_behaves_like 'a successful request'
|
214
284
|
it('results is nil') { expect(results).to be_nil }
|
@@ -216,8 +286,10 @@ RSpec.describe FinApps::REST::DocumentsOrders do
|
|
216
286
|
|
217
287
|
context 'with invalid id' do
|
218
288
|
let(:id) { :invalid_order_id }
|
289
|
+
|
219
290
|
it_behaves_like 'an API request'
|
220
291
|
it('results is nil') { expect(results).to be_nil }
|
292
|
+
|
221
293
|
it('error messages array is populated') do
|
222
294
|
expect(error_messages.first.downcase).to eq('resource not found')
|
223
295
|
end
|
@@ -225,12 +297,14 @@ RSpec.describe FinApps::REST::DocumentsOrders do
|
|
225
297
|
|
226
298
|
context 'with missing id' do
|
227
299
|
let(:id) { nil }
|
300
|
+
|
228
301
|
it_behaves_like 'a request that raises an error'
|
229
302
|
end
|
230
303
|
end
|
231
304
|
|
232
305
|
describe '#show_signing_url' do
|
233
|
-
subject(:sign_url) {
|
306
|
+
subject(:sign_url) { described_class.new(client).show_signing_url(order_id, signature_id) }
|
307
|
+
|
234
308
|
let(:results) { sign_url[0] }
|
235
309
|
let(:error_messages) { sign_url[1] }
|
236
310
|
let(:order_id) { :valid_order_id }
|
@@ -247,24 +321,28 @@ RSpec.describe FinApps::REST::DocumentsOrders do
|
|
247
321
|
|
248
322
|
context 'with invalid signature id' do
|
249
323
|
let(:signature_id) { :invalid_signature_id }
|
324
|
+
|
250
325
|
it { expect(results).to be_nil }
|
251
|
-
it { expect(error_messages).
|
326
|
+
it { expect(error_messages).not_to be_empty }
|
252
327
|
end
|
253
328
|
end
|
254
329
|
|
255
330
|
context 'with invalid order id' do
|
256
331
|
let(:order_id) { :invalid_order_id }
|
332
|
+
|
257
333
|
it { expect(results).to be_nil }
|
258
|
-
it { expect(error_messages).
|
334
|
+
it { expect(error_messages).not_to be_empty }
|
259
335
|
end
|
260
336
|
|
261
337
|
context 'with missing order id' do
|
262
338
|
let(:order_id) { nil }
|
339
|
+
|
263
340
|
it_behaves_like 'a request that raises an error'
|
264
341
|
end
|
265
342
|
|
266
343
|
context 'with missing signature id' do
|
267
344
|
let(:signature_id) { nil }
|
345
|
+
|
268
346
|
it_behaves_like 'a request that raises an error'
|
269
347
|
end
|
270
348
|
end
|