finapps 4.0.8 → 4.0.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7994e8d00aaefc207b65d91618b558e7823f78b76e0342d8cb5ae25a36713f38
4
- data.tar.gz: 926962457c678a7d834b5291af57136e1b8aa7b12c7d30dafddacf1e13ff2d43
3
+ metadata.gz: 37f393e38b809f2a8bfb01469e68235fcf15464fd7eec0ad500c3c78f7d12599
4
+ data.tar.gz: 91301f530b515f31f30e43b7f094e065f96e43d7b4c4751cf7b2a94fee8ab016
5
5
  SHA512:
6
- metadata.gz: d242df6e75bb1fa17edefcac319d0c68459ad48b20c71dcac686d6bb8e848868213ae9ae50f06b54ef5bb8d049997cd4f4263290f0a99c230a54e0790e66582c
7
- data.tar.gz: e4a9280650d805a54d374b07e5239d183ee797986c3785922d0726f205d560284f72b96ae7b617976173be71d2c7962f045a87a75c1df3a62669c950d5a5017b
6
+ metadata.gz: 93da2560854c2ecf2182bc166925f5b087470e96be627ccad9dd344a191ce8f40ee92df1ddaaaff0222be6f221ff1cf07f28bf5045e0c9f300dbc67355be19a3
7
+ data.tar.gz: 7d508c4d15c85151a2c5cdf9cf23f5402bfeea97eedabc1f70709eba1faea2c6619de266adcb1260e67ee8f8da2d75c41cd3fdcee559e18a9f9bc8eaf8bc94f6
data/lib/finapps.rb CHANGED
@@ -7,6 +7,7 @@ require 'finapps_core'
7
7
  require 'finapps/rest/version'
8
8
  require 'finapps/rest/consumers'
9
9
  require 'finapps/rest/consumer_institution_refreshes'
10
+ require 'finapps/rest/consumer_institution_refresh'
10
11
  require 'finapps/rest/sessions'
11
12
  require 'finapps/rest/order_tokens'
12
13
  require 'finapps/rest/orders'
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module FinApps
4
+ module REST
5
+ class ConsumerInstitutionRefresh < FinAppsCore::REST::Resources
6
+ def update(id, params = {})
7
+ not_blank(id, :id)
8
+
9
+ path = "institutions/consumer/#{ERB::Util.url_encode(id)}/refresh"
10
+ super params, path
11
+ end
12
+ end
13
+ end
14
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FinApps
4
- VERSION = '4.0.9'
4
+ VERSION = '4.0.10'
5
5
  end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helpers/client'
4
+
5
+ RSpec.describe FinApps::REST::ConsumerInstitutionRefresh, 'initialized with valid FinApps::Client object' do
6
+ include SpecHelpers::Client
7
+ let(:refresh) { FinApps::REST::ConsumerInstitutionRefresh.new client }
8
+
9
+ describe '#update' do
10
+ let(:valid_params) { { token: 'valid_token' } }
11
+ let(:invalid_params) { { token: 'invalid_token' } }
12
+
13
+ context 'when missing id' do
14
+ it { expect { refresh.update(nil) }.to raise_error(FinAppsCore::MissingArgumentsError) }
15
+ end
16
+
17
+ context 'when invalid id is provided' do
18
+ subject { refresh.update(:invalid_consumer_institution_id) }
19
+
20
+ it { expect { subject }.not_to raise_error }
21
+ it('results is nil') { expect(subject[0]).to be_nil }
22
+ it('error messages array is populated') { expect(subject[1]).not_to be_nil }
23
+ end
24
+
25
+ context 'when invalid params are provided' do
26
+ subject { refresh.update(:valid_consumer_institution_id, invalid_params) }
27
+
28
+ it { expect { subject }.not_to raise_error }
29
+ it('results is nil') { expect(subject[0]).to be_nil }
30
+ it('error messages array is populated') { expect(subject[1]).not_to be_nil }
31
+ end
32
+
33
+ context 'when valid id is provided' do
34
+ subject { refresh.update(:valid_consumer_institution_id) }
35
+
36
+ it { expect { subject }.not_to raise_error }
37
+ it('returns an array') { expect(subject).to be_a(Array) }
38
+ it('performs a PUT and returns the response') do
39
+ expect(subject[0]).to respond_to(:consumer_institution)
40
+ end
41
+ it('returns no error messages') { expect(subject[1]).to be_empty }
42
+ end
43
+ end
44
+ end
@@ -95,6 +95,15 @@ class FakeApi < Sinatra::Base
95
95
  get('/v3/institutions/consumer/valid_id/form') { json_response 200, 'institution_login_form.json' }
96
96
  get('/v3/institutions/consumer/invalid_id/form') { json_response 400, 'invalid_institution_id.json' }
97
97
  put('/v3/institutions/refresh') { json_response 200, 'user_institution_refresh.json' }
98
+ put('/v3/institutions/consumer/valid_consumer_institution_id/refresh') do
99
+ request.body.rewind
100
+ request_payload = JSON.parse request.body.read
101
+ if request_payload['token'] == 'invalid_token'
102
+ json_response(400, 'refresh_invalid_mfa.json')
103
+ else
104
+ json_response(200, 'refresh_queued.json')
105
+ end
106
+ end
98
107
 
99
108
  # consumers
100
109
  get('/v3/consumers/valid_public_id') { json_response 200, 'user.json' }
@@ -0,0 +1,12 @@
1
+ {
2
+ "messages": [
3
+ "there was a timeout error trying to access the institution"
4
+ ],
5
+ "status": 13,
6
+ "status_message": "timeout error during communication",
7
+ "user_action": {
8
+ "code": 1,
9
+ "message": "request_timed_out"
10
+ }
11
+ }
12
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "messages": [
3
+ "invalid credentials specified for institution"
4
+ ],
5
+ "status": 6,
6
+ "status_message": "login failure",
7
+ "user_action": {
8
+ "code": 1,
9
+ "message": "wrong_credentials"
10
+ }
11
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "consumer_institution": {
3
+ "_id": "5ca354c6ee35e00001481105",
4
+ "institution_id": 0,
5
+ "institution_name": "Dag Site SecurityQA (US)",
6
+ "mfa_type": 0,
7
+ "status": 15,
8
+ "status_message": "not refreshed - recently refreshed",
9
+ "last_refreshed": "2019-04-02T12:26:00Z"
10
+ }
11
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "consumer_institution": {
3
+ "_id": "5ca3778d2fbfd8000130e02c",
4
+ "account_id": 10455542,
5
+ "institution_id": 16445,
6
+ "institution_name": "Dag Site TokenFMPA (US)",
7
+ "mfa_type": 1,
8
+ "status": 14,
9
+ "status_message": "pending mfa information",
10
+ "last_refreshed": "2019-04-02T14:54:14Z"
11
+ },
12
+ "mfa": "<div class=\"mfa\"><div class=\"mfaField\"><label class=\"mfaFieldLabel\">Security Key</label><input class=\"mfaFieldInput\" type=\"text\" name=\"userResponse.token\" value=\"\" max=\"6\" ><input class=\"mfaFieldInput\" type=\"hidden\" name=\"userResponse.objectInstanceType\" value=\"com.yodlee.core.mfarefresh.MFATokenResponse\" ></div></div>"
13
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "consumer_institution": {
3
+ "_id": "5ca354c6ee35e00001481105",
4
+ "account_id": 10455527,
5
+ "institution_id": 16486,
6
+ "institution_name": "Dag Site SecurityQA (US)",
7
+ "mfa_type": 4,
8
+ "status": 3,
9
+ "status_message": "queued",
10
+ "last_refreshed": "2019-04-02T12:26:00Z"
11
+ }
12
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: finapps
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.8
4
+ version: 4.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erich Quintero
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-20 00:00:00.000000000 Z
11
+ date: 2019-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: finapps_core
@@ -237,6 +237,7 @@ files:
237
237
  - lib/finapps/rest/alert_definitions.rb
238
238
  - lib/finapps/rest/alert_occurrences.rb
239
239
  - lib/finapps/rest/client.rb
240
+ - lib/finapps/rest/consumer_institution_refresh.rb
240
241
  - lib/finapps/rest/consumer_institution_refreshes.rb
241
242
  - lib/finapps/rest/consumers.rb
242
243
  - lib/finapps/rest/consumers_portfolios.rb
@@ -272,6 +273,7 @@ files:
272
273
  - spec/rest/alert_definitions_spec.rb
273
274
  - spec/rest/alert_occurrences_spec.rb
274
275
  - spec/rest/client_spec.rb
276
+ - spec/rest/consumer_institution_refresh_spec.rb
275
277
  - spec/rest/consumer_institution_refreshes_spec.rb
276
278
  - spec/rest/consumers_portfolios_spec.rb
277
279
  - spec/rest/consumers_spec.rb
@@ -317,6 +319,7 @@ files:
317
319
  - spec/support/fixtures/invalid_request_body.json
318
320
  - spec/support/fixtures/invalid_user_id.json
319
321
  - spec/support/fixtures/invalid_user_institution_id.json
322
+ - spec/support/fixtures/mfa_timeout.json
320
323
  - spec/support/fixtures/multiple_consumer_subscribe_error.json
321
324
  - spec/support/fixtures/operator.json
322
325
  - spec/support/fixtures/operator_forgot_password.json
@@ -335,6 +338,10 @@ files:
335
338
  - spec/support/fixtures/portfolios_available_consumers.json
336
339
  - spec/support/fixtures/portfolios_consumers.json
337
340
  - spec/support/fixtures/products.json
341
+ - spec/support/fixtures/refresh_invalid_mfa.json
342
+ - spec/support/fixtures/refresh_not_refreshed.json
343
+ - spec/support/fixtures/refresh_pending_mfa.json
344
+ - spec/support/fixtures/refresh_queued.json
338
345
  - spec/support/fixtures/resource.json
339
346
  - spec/support/fixtures/resource_not_found.json
340
347
  - spec/support/fixtures/resources.json
@@ -409,6 +416,7 @@ test_files:
409
416
  - spec/rest/order_refreshes_spec.rb
410
417
  - spec/rest/order_notifications_spec.rb
411
418
  - spec/rest/portfolios_alerts_spec.rb
419
+ - spec/rest/consumer_institution_refresh_spec.rb
412
420
  - spec/rest/order_assignments_spec.rb
413
421
  - spec/rest/sessions_spec.rb
414
422
  - spec/rest/portfolio_reports_spec.rb