finapps 5.0.9 → 5.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/finapps/rest/plaid/plaid_consumer_institutions.rb +9 -2
- data/lib/finapps/version.rb +1 -1
- data/spec/rest/api_request.rb +17 -0
- data/spec/rest/plaid/plaid_consumer_institutions_spec.rb +16 -17
- data/spec/rest/plaid/plaid_webhooks_spec.rb +2 -8
- data/spec/support/fake_api.rb +3 -0
- data/spec/support/fixtures/plaid/institution/consumer/show_accounts.json +57 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0b9775ed8bdf1598984b13c5f799b2a9740dde8dbfcc518b96b900f47278a98
|
4
|
+
data.tar.gz: bb130677424e512cd13b134e59b0e7eb5d262d1f111ad42642bea1e07a4c592b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2501b741c714fb24f001d5fcca0252b99a87e71cb57514e0ecc0358eaf6628413e8aacbbbe83da8ab06acb5c9e312884b3d88f8fadb7e0e10d727d28586aeeae
|
7
|
+
data.tar.gz: 5365f4532836f489dce0d8b35f647ca93df1a34a285e09df6240ad57dd9744502231ec2bed6bd7559bfa4c4d5d945293c17ff80bda41aa8fda2d700e377b924f
|
@@ -7,8 +7,15 @@ module FinApps
|
|
7
7
|
super(params, 'p/institution/consumer')
|
8
8
|
end
|
9
9
|
|
10
|
-
def show(id)
|
11
|
-
super
|
10
|
+
def show(id, options = { show_accounts: false })
|
11
|
+
results, error_messages = super(nil, "p/institution/consumer/#{id}")
|
12
|
+
|
13
|
+
if error_messages.empty? && options[:show_accounts]
|
14
|
+
account_results, error_messages = super(nil, "p/institution/consumer/#{id}/account")
|
15
|
+
results[:accounts] = account_results if error_messages.empty?
|
16
|
+
end
|
17
|
+
|
18
|
+
[results, error_messages]
|
12
19
|
end
|
13
20
|
|
14
21
|
def list
|
data/lib/finapps/version.rb
CHANGED
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
RSpec.shared_examples 'an API request' do |_parameter|
|
4
|
+
it do
|
5
|
+
expect do
|
6
|
+
# noinspection RubyBlockToMethodReference
|
7
|
+
subject
|
8
|
+
end.not_to raise_error
|
9
|
+
end
|
10
|
+
it('returns an array') { expect(subject).to be_a(Array) }
|
11
|
+
end
|
12
|
+
|
13
|
+
RSpec.shared_examples 'a successful request' do |_parameter|
|
14
|
+
it('returns no error messages') do
|
15
|
+
expect(subject[ERROR_MESSAGES]).to be_empty
|
16
|
+
end
|
17
|
+
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'spec_helpers/client'
|
4
|
+
require 'rest/api_request'
|
4
5
|
|
5
6
|
RSpec.describe FinApps::REST::PlaidConsumerInstitutions do
|
6
7
|
include SpecHelpers::Client
|
@@ -8,25 +9,9 @@ RSpec.describe FinApps::REST::PlaidConsumerInstitutions do
|
|
8
9
|
# noinspection RubyBlockToMethodReference
|
9
10
|
let(:api_client) { client }
|
10
11
|
|
11
|
-
RSpec.shared_examples 'an API request' do |_parameter|
|
12
|
-
it do
|
13
|
-
expect do
|
14
|
-
# noinspection RubyBlockToMethodReference
|
15
|
-
subject
|
16
|
-
end.not_to raise_error
|
17
|
-
end
|
18
|
-
it('returns an array') { expect(subject).to be_a(Array) }
|
19
|
-
end
|
20
|
-
|
21
|
-
RSpec.shared_examples 'a successful request' do |_parameter|
|
22
|
-
it('returns no error messages') do
|
23
|
-
expect(subject[ERROR_MESSAGES]).to be_empty
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
12
|
RSpec.shared_examples 'a request that returns institution data' do |_parameter|
|
28
13
|
it('returns institution data') do
|
29
|
-
expect(subject[RESULTS]).to have_key(:
|
14
|
+
expect(subject[RESULTS]).to have_key(:plaid_institution_id)
|
30
15
|
end
|
31
16
|
end
|
32
17
|
|
@@ -52,6 +37,20 @@ RSpec.describe FinApps::REST::PlaidConsumerInstitutions do
|
|
52
37
|
it_behaves_like 'an API request'
|
53
38
|
it_behaves_like 'a successful request'
|
54
39
|
it_behaves_like 'a request that returns institution data'
|
40
|
+
context 'when requesting accounts information' do
|
41
|
+
subject(:show) do
|
42
|
+
FinApps::REST::PlaidConsumerInstitutions.new(api_client).show(
|
43
|
+
:consumer_institution_id, show_accounts: true
|
44
|
+
)
|
45
|
+
end
|
46
|
+
|
47
|
+
it_behaves_like 'an API request'
|
48
|
+
it_behaves_like 'a successful request'
|
49
|
+
it_behaves_like 'a request that returns institution data'
|
50
|
+
it('returns institution account data') do
|
51
|
+
expect(subject[RESULTS]).to have_key(:accounts)
|
52
|
+
end
|
53
|
+
end
|
55
54
|
end
|
56
55
|
|
57
56
|
describe '#list' do
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'spec_helpers/client'
|
4
|
+
require 'rest/api_request'
|
4
5
|
|
5
6
|
RSpec.describe FinApps::REST::PlaidWebhooks do
|
6
7
|
include SpecHelpers::Client
|
@@ -9,20 +10,13 @@ RSpec.describe FinApps::REST::PlaidWebhooks do
|
|
9
10
|
subject(:show) { FinApps::REST::PlaidWebhooks.new(api_client).show }
|
10
11
|
|
11
12
|
describe '#show' do
|
12
|
-
RSpec.shared_examples 'an API request' do |_parameter|
|
13
|
-
it { expect { show }.not_to raise_error }
|
14
|
-
it('returns an array') { expect(show).to be_a(Array) }
|
15
|
-
end
|
16
|
-
|
17
13
|
context 'when valid tenant token is provided' do
|
18
14
|
it_behaves_like 'an API request'
|
15
|
+
it_behaves_like 'a successful request'
|
19
16
|
|
20
17
|
it('performs a post and returns the webhook url') do
|
21
18
|
expect(show[RESULTS]).to have_key(:url)
|
22
19
|
end
|
23
|
-
it('returns no error messages') do
|
24
|
-
expect(show[ERROR_MESSAGES]).to be_empty
|
25
|
-
end
|
26
20
|
end
|
27
21
|
|
28
22
|
context 'when invalid tenant token is provided' do
|
data/spec/support/fake_api.rb
CHANGED
@@ -29,6 +29,9 @@ class FakeApi < Sinatra::Base
|
|
29
29
|
get("/#{version}/p/institution/consumer/:consumer_institution_id") do
|
30
30
|
json_response 200, 'plaid/institution/consumer/show.json'
|
31
31
|
end
|
32
|
+
get("/#{version}/p/institution/consumer/:consumer_institution_id/account") do
|
33
|
+
json_response 200, 'plaid/institution/consumer/show_accounts.json'
|
34
|
+
end
|
32
35
|
get("/#{version}/p/institution/consumer") do
|
33
36
|
tenant_token = request.env['HTTP_X_TENANT_TOKEN']
|
34
37
|
if tenant_token == 'invalid_tenant_token'
|
@@ -0,0 +1,57 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"_id": "ObjectId(\"507f1f77bcf86cd799439012\")",
|
4
|
+
"consumer_institution_id": "ObjectId(\"507f1f77bcf86cd799439011\")",
|
5
|
+
"plaid_account_id": "vzeNDwK7KQIm4yEog683uElbp9GRLEFXGK98D",
|
6
|
+
"balances": {
|
7
|
+
"available": 100,
|
8
|
+
"current": 110,
|
9
|
+
"limit": null,
|
10
|
+
"iso_currency_code": "USD",
|
11
|
+
"unofficial_currency_code": null
|
12
|
+
},
|
13
|
+
"mask": "0000",
|
14
|
+
"name": "Plaid Checking",
|
15
|
+
"official_name": "Plaid Gold Checking",
|
16
|
+
"subtype": "checking",
|
17
|
+
"type": "depository",
|
18
|
+
"identifiers": {
|
19
|
+
"wire_routing": "123456789",
|
20
|
+
"routing": "123456789",
|
21
|
+
"account": "987654321"
|
22
|
+
},
|
23
|
+
"identities": [
|
24
|
+
{
|
25
|
+
"names": [
|
26
|
+
{
|
27
|
+
"data": "John Doe"
|
28
|
+
}
|
29
|
+
],
|
30
|
+
"emails": [
|
31
|
+
{
|
32
|
+
"data": "johndoe@ardanlabs.com",
|
33
|
+
"type": "primary",
|
34
|
+
"primary": true
|
35
|
+
}
|
36
|
+
],
|
37
|
+
"phone_numbers": [
|
38
|
+
{
|
39
|
+
"data": "13165551234",
|
40
|
+
"type": "primary",
|
41
|
+
"primary": true
|
42
|
+
}
|
43
|
+
],
|
44
|
+
"addresses": [
|
45
|
+
{
|
46
|
+
"city": "Wichita",
|
47
|
+
"region": "KS",
|
48
|
+
"street": "123 Foobar Ave",
|
49
|
+
"postal_code": "67002",
|
50
|
+
"country": "US",
|
51
|
+
"primary": true
|
52
|
+
}
|
53
|
+
]
|
54
|
+
}
|
55
|
+
]
|
56
|
+
}
|
57
|
+
]
|
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: 5.0.
|
4
|
+
version: 5.0.10
|
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-08-
|
11
|
+
date: 2019-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: finapps_core
|
@@ -331,6 +331,7 @@ files:
|
|
331
331
|
- lib/tasks/releaser.rake
|
332
332
|
- spec/rest/alert_definitions_spec.rb
|
333
333
|
- spec/rest/alert_occurrences_spec.rb
|
334
|
+
- spec/rest/api_request.rb
|
334
335
|
- spec/rest/client_spec.rb
|
335
336
|
- spec/rest/consumers_portfolios_spec.rb
|
336
337
|
- spec/rest/consumers_spec.rb
|
@@ -386,6 +387,7 @@ files:
|
|
386
387
|
- spec/support/fixtures/plaid/institution/consumer/add.json
|
387
388
|
- spec/support/fixtures/plaid/institution/consumer/list.json
|
388
389
|
- spec/support/fixtures/plaid/institution/consumer/show.json
|
390
|
+
- spec/support/fixtures/plaid/institution/consumer/show_accounts.json
|
389
391
|
- spec/support/fixtures/plaid/webhook.json
|
390
392
|
- spec/support/fixtures/portfolio.json
|
391
393
|
- spec/support/fixtures/portfolio_reports.json
|
@@ -449,6 +451,7 @@ test_files:
|
|
449
451
|
- spec/rest/operators_spec.rb
|
450
452
|
- spec/rest/client_spec.rb
|
451
453
|
- spec/rest/tenant_settings_spec.rb
|
454
|
+
- spec/rest/api_request.rb
|
452
455
|
- spec/rest/alert_occurrences_spec.rb
|
453
456
|
- spec/rest/password_resets_spec.rb
|
454
457
|
- spec/rest/order_reports_spec.rb
|