finicity 0.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 +7 -0
- data/.gitignore +23 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +69 -0
- data/Rakefile +10 -0
- data/finicity.gemspec +31 -0
- data/lib/finicity.rb +42 -0
- data/lib/finicity/client.rb +350 -0
- data/lib/finicity/configuration.rb +13 -0
- data/lib/finicity/errors.rb +62 -0
- data/lib/finicity/logger.rb +19 -0
- data/lib/finicity/railtie.rb +22 -0
- data/lib/finicity/v1.rb +29 -0
- data/lib/finicity/v1/request/activate_accounts.rb +73 -0
- data/lib/finicity/v1/request/activate_accounts_with_mfa.rb +88 -0
- data/lib/finicity/v1/request/add_customer.rb +54 -0
- data/lib/finicity/v1/request/delete_customer.rb +45 -0
- data/lib/finicity/v1/request/discover_accounts.rb +71 -0
- data/lib/finicity/v1/request/discover_accounts_with_mfa.rb +87 -0
- data/lib/finicity/v1/request/get_accounts.rb +50 -0
- data/lib/finicity/v1/request/get_customers.rb +43 -0
- data/lib/finicity/v1/request/get_customers_by_username.rb +52 -0
- data/lib/finicity/v1/request/get_institution.rb +45 -0
- data/lib/finicity/v1/request/get_institutions.rb +45 -0
- data/lib/finicity/v1/request/get_login_form.rb +47 -0
- data/lib/finicity/v1/request/get_transactions.rb +60 -0
- data/lib/finicity/v1/request/interactive_refresh_account.rb +51 -0
- data/lib/finicity/v1/request/interactive_refresh_account_with_mfa.rb +74 -0
- data/lib/finicity/v1/request/refresh_accounts.rb +47 -0
- data/lib/finicity/v1/response/accounts.rb +75 -0
- data/lib/finicity/v1/response/customers.rb +36 -0
- data/lib/finicity/v1/response/error.rb +13 -0
- data/lib/finicity/v1/response/institutions.rb +38 -0
- data/lib/finicity/v1/response/login_form.rb +29 -0
- data/lib/finicity/v1/response/mfa.rb +22 -0
- data/lib/finicity/v1/response/transactions.rb +28 -0
- data/lib/finicity/v2.rb +7 -0
- data/lib/finicity/v2/request/partner_authentication.rb +39 -0
- data/lib/finicity/v2/response/partner_authentication.rb +12 -0
- data/lib/finicity/version.rb +3 -0
- data/spec/finicity/client_spec.rb +527 -0
- data/spec/finicity/v1/request/activate_accounts_spec.rb +49 -0
- data/spec/finicity/v1/request/activate_accounts_with_mfa_spec.rb +64 -0
- data/spec/finicity/v1/request/add_customer_spec.rb +37 -0
- data/spec/finicity/v1/request/delete_customer_spec.rb +18 -0
- data/spec/finicity/v1/request/discover_accounts_spec.rb +42 -0
- data/spec/finicity/v1/request/discover_accounts_with_mfa_spec.rb +59 -0
- data/spec/finicity/v1/request/get_accounts_spec.rb +18 -0
- data/spec/finicity/v1/request/get_customers_by_username_spec.rb +18 -0
- data/spec/finicity/v1/request/get_customers_spec.rb +18 -0
- data/spec/finicity/v1/request/get_institution_spec.rb +18 -0
- data/spec/finicity/v1/request/get_institutions_spec.rb +18 -0
- data/spec/finicity/v1/request/get_login_form_spec.rb +18 -0
- data/spec/finicity/v1/request/get_transactions_spec.rb +19 -0
- data/spec/finicity/v1/request/interactive_refresh_account_spec.rb +19 -0
- data/spec/finicity/v1/request/interactive_refresh_account_with_mfa_spec.rb +38 -0
- data/spec/finicity/v1/request/refresh_accounts_spec.rb +18 -0
- data/spec/finicity/v1/response/accounts_spec.rb +39 -0
- data/spec/finicity/v1/response/customers_spec.rb +19 -0
- data/spec/finicity/v1/response/error_spec.rb +19 -0
- data/spec/finicity/v1/response/institutions_spec.rb +19 -0
- data/spec/finicity/v1/response/login_form_spec.rb +31 -0
- data/spec/finicity/v1/response/mfa_spec.rb +23 -0
- data/spec/finicity/v1/response/transactions_spec.rb +47 -0
- data/spec/finicity/v2/request/partner_authentication_spec.rb +21 -0
- data/spec/finicity/v2/response/partner_authentication_spec.rb +15 -0
- data/spec/spec_helper.rb +36 -0
- metadata +265 -0
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ::Finicity::V1::Request::ActivateAccounts do
|
4
|
+
let(:account) {
|
5
|
+
instance_double(
|
6
|
+
::Finicity::V1::Response::Account,
|
7
|
+
:id => 1,
|
8
|
+
:number => 1234,
|
9
|
+
:name => 'Account 1',
|
10
|
+
:type => 'checking'
|
11
|
+
)
|
12
|
+
}
|
13
|
+
let(:accounts) { [account] }
|
14
|
+
|
15
|
+
subject { described_class.new("token-123", 1, 2, accounts) }
|
16
|
+
|
17
|
+
describe "#headers" do
|
18
|
+
it "has correct headers" do
|
19
|
+
subject.headers.should have_key('Finicity-App-Key')
|
20
|
+
subject.headers.should have_key('Finicity-App-Token')
|
21
|
+
subject.headers.should have_key('Content-Type')
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "#body" do
|
26
|
+
|
27
|
+
it "forms the correct id" do
|
28
|
+
subject.body.should include("<id>1</id>")
|
29
|
+
end
|
30
|
+
|
31
|
+
it "forms the correct number" do
|
32
|
+
subject.body.should include("<number>1234</number>")
|
33
|
+
end
|
34
|
+
|
35
|
+
it "forms the correct name" do
|
36
|
+
subject.body.should include("<name>Account 1</name>")
|
37
|
+
end
|
38
|
+
|
39
|
+
it "forms the correct type" do
|
40
|
+
subject.body.should include("<type>checking</type>")
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe "#url" do
|
45
|
+
it "has a correct url" do
|
46
|
+
subject.url.to_s.should include('customers/1/institutions/2/accounts')
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ::Finicity::V1::Request::ActivateAccountsWithMfa do
|
4
|
+
let(:account) {
|
5
|
+
instance_double(
|
6
|
+
::Finicity::V1::Response::Account,
|
7
|
+
:id => 1,
|
8
|
+
:number => 1234,
|
9
|
+
:name => 'Account 1',
|
10
|
+
:type => 'checking'
|
11
|
+
)
|
12
|
+
}
|
13
|
+
let(:accounts) { [account] }
|
14
|
+
let(:mfa_credential) {
|
15
|
+
{
|
16
|
+
:text => 'What is your birthday?',
|
17
|
+
:answer => '1985-01-01'
|
18
|
+
}
|
19
|
+
}
|
20
|
+
let(:mfa_credentials) { [mfa_credential] }
|
21
|
+
|
22
|
+
subject { described_class.new("token-123", "mfa_session-123", 1, 2, accounts, mfa_credentials) }
|
23
|
+
|
24
|
+
describe "#headers" do
|
25
|
+
it "has correct headers" do
|
26
|
+
subject.headers.should have_key('Finicity-App-Key')
|
27
|
+
subject.headers.should have_key('Finicity-App-Token')
|
28
|
+
subject.headers.should have_key('Content-Type')
|
29
|
+
subject.headers.should have_key('MFA-Session')
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe "#body" do
|
34
|
+
it "forms the correct id" do
|
35
|
+
subject.body.should include("<id>1</id>")
|
36
|
+
end
|
37
|
+
|
38
|
+
it "forms the correct number" do
|
39
|
+
subject.body.should include("<number>1234</number>")
|
40
|
+
end
|
41
|
+
|
42
|
+
it "forms the correct name" do
|
43
|
+
subject.body.should include("<name>Account 1</name>")
|
44
|
+
end
|
45
|
+
|
46
|
+
it "forms the correct type" do
|
47
|
+
subject.body.should include("<type>checking</type>")
|
48
|
+
end
|
49
|
+
|
50
|
+
it "forms the mfa text" do
|
51
|
+
subject.body.should include("<text>What is your birthday?</text>")
|
52
|
+
end
|
53
|
+
|
54
|
+
it "forms the mfa answer" do
|
55
|
+
subject.body.should include("<answer>1985-01-01</answer>")
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
describe "#url" do
|
60
|
+
it "has a correct url" do
|
61
|
+
subject.url.to_s.should include('customers/1/institutions/2/accounts/mfa')
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ::Finicity::V1::Request::AddCustomer do
|
4
|
+
subject { described_class.new("token-123", "USR-123") }
|
5
|
+
|
6
|
+
describe "#headers" do
|
7
|
+
it "has correct headers" do
|
8
|
+
subject.headers.should have_key('Finicity-App-Key')
|
9
|
+
subject.headers.should have_key('Finicity-App-Token')
|
10
|
+
subject.headers.should have_key('Content-Type')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "#body" do
|
15
|
+
it "includes username" do
|
16
|
+
subject.body.should include('<username>USR-123</username>')
|
17
|
+
end
|
18
|
+
|
19
|
+
it "includes email" do
|
20
|
+
subject.body.should include('<email>USR-123@mx.com</email>')
|
21
|
+
end
|
22
|
+
|
23
|
+
it "includes firstName" do
|
24
|
+
subject.body.should include('<firstName>USR-123</firstName>')
|
25
|
+
end
|
26
|
+
|
27
|
+
it "includes lastName" do
|
28
|
+
subject.body.should include('<lastName>USR-123</lastName>')
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe "#url" do
|
33
|
+
it "has a correct url" do
|
34
|
+
subject.url.to_s.should include('customers')
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ::Finicity::V1::Request::DeleteCustomer do
|
4
|
+
subject { described_class.new("token-123", 1) }
|
5
|
+
|
6
|
+
describe "#headers" do
|
7
|
+
it "has correct headers" do
|
8
|
+
subject.headers.should have_key('Finicity-App-Key')
|
9
|
+
subject.headers.should have_key('Finicity-App-Token')
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "#url" do
|
14
|
+
it "has a correct url" do
|
15
|
+
subject.url.to_s.should include('customers/1')
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ::Finicity::V1::Request::DiscoverAccounts do
|
4
|
+
let(:login_credential) {
|
5
|
+
{
|
6
|
+
:id => '1',
|
7
|
+
:name => 'username',
|
8
|
+
:value => 'test_user'
|
9
|
+
}
|
10
|
+
}
|
11
|
+
let(:login_credentials) { [login_credential] }
|
12
|
+
|
13
|
+
subject { described_class.new("token-123", 1, 2, login_credentials) }
|
14
|
+
|
15
|
+
describe "#headers" do
|
16
|
+
it "has correct headers" do
|
17
|
+
subject.headers.should have_key('Finicity-App-Key')
|
18
|
+
subject.headers.should have_key('Finicity-App-Token')
|
19
|
+
subject.headers.should have_key('Content-Type')
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "#body" do
|
24
|
+
it "forms the correct id" do
|
25
|
+
subject.body.should include("<id>1</id>")
|
26
|
+
end
|
27
|
+
|
28
|
+
it "forms the correct name" do
|
29
|
+
subject.body.should include("<name>username</name>")
|
30
|
+
end
|
31
|
+
|
32
|
+
it "forms the correct vale" do
|
33
|
+
subject.body.should include("<value>test_user</value>")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe "#url" do
|
38
|
+
it "has a correct url" do
|
39
|
+
subject.url.to_s.should include('customers/1/institutions/2/accounts')
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ::Finicity::V1::Request::DiscoverAccountsWithMfa do
|
4
|
+
let(:login_credential) {
|
5
|
+
{
|
6
|
+
:id => '1',
|
7
|
+
:name => 'username',
|
8
|
+
:value => 'test_user'
|
9
|
+
}
|
10
|
+
}
|
11
|
+
let(:mfa_credential) {
|
12
|
+
{
|
13
|
+
:text => 'What is your birthday?',
|
14
|
+
:answer => '1985-01-01'
|
15
|
+
}
|
16
|
+
}
|
17
|
+
let(:login_credentials) { [login_credential] }
|
18
|
+
let(:mfa_credentials) { [mfa_credential] }
|
19
|
+
|
20
|
+
subject { described_class.new("token-123", "mfa_session-123", 1, 2, login_credentials, mfa_credentials) }
|
21
|
+
|
22
|
+
describe "#headers" do
|
23
|
+
it "has correct headers" do
|
24
|
+
subject.headers.should have_key('Finicity-App-Key')
|
25
|
+
subject.headers.should have_key('Finicity-App-Token')
|
26
|
+
subject.headers.should have_key('Content-Type')
|
27
|
+
subject.headers.should have_key('MFA-Session')
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe "#body" do
|
32
|
+
|
33
|
+
it "forms the correct id" do
|
34
|
+
subject.body.should include("<id>1</id>")
|
35
|
+
end
|
36
|
+
|
37
|
+
it "forms the correct name" do
|
38
|
+
subject.body.should include("<name>username</name>")
|
39
|
+
end
|
40
|
+
|
41
|
+
it "forms the correct value" do
|
42
|
+
subject.body.should include("<value>test_user</value>")
|
43
|
+
end
|
44
|
+
|
45
|
+
it "forms the mfa question" do
|
46
|
+
subject.body.should include("<text>What is your birthday?</text>")
|
47
|
+
end
|
48
|
+
|
49
|
+
it "forms the mfa answer" do
|
50
|
+
subject.body.should include("<answer>1985-01-01</answer>")
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
describe "#url" do
|
55
|
+
it "has a correct url" do
|
56
|
+
subject.url.to_s.should include('customers/1/institutions/2/accounts/mfa')
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ::Finicity::V1::Request::GetAccounts do
|
4
|
+
subject { described_class.new("token-123", 1, 2) }
|
5
|
+
|
6
|
+
describe "#headers" do
|
7
|
+
it "has correct headers" do
|
8
|
+
subject.headers.should have_key('Finicity-App-Key')
|
9
|
+
subject.headers.should have_key('Finicity-App-Token')
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "#url" do
|
14
|
+
it "has a correct url" do
|
15
|
+
subject.url.to_s.should include('customers/1/institutions/2/accounts')
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ::Finicity::V1::Request::GetCustomersByUsername do
|
4
|
+
subject { described_class.new("token-123", "USR-123", 1, 25) }
|
5
|
+
|
6
|
+
describe "#headers" do
|
7
|
+
it "has correct headers" do
|
8
|
+
subject.headers.should have_key('Finicity-App-Key')
|
9
|
+
subject.headers.should have_key('Finicity-App-Token')
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "#url" do
|
14
|
+
it "has a correct url" do
|
15
|
+
subject.url.to_s.should include('customers')
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ::Finicity::V1::Request::GetCustomers do
|
4
|
+
subject { described_class.new("token-123") }
|
5
|
+
|
6
|
+
describe "#headers" do
|
7
|
+
it "has correct headers" do
|
8
|
+
subject.headers.should have_key('Finicity-App-Key')
|
9
|
+
subject.headers.should have_key('Finicity-App-Token')
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "#url" do
|
14
|
+
it "has a correct url" do
|
15
|
+
subject.url.to_s.should include('customers')
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ::Finicity::V1::Request::GetInstitution do
|
4
|
+
subject { described_class.new("token-123", 1) }
|
5
|
+
|
6
|
+
describe "#headers" do
|
7
|
+
it "has correct headers" do
|
8
|
+
subject.headers.should have_key('Finicity-App-Key')
|
9
|
+
subject.headers.should have_key('Finicity-App-Token')
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "#url" do
|
14
|
+
it "has a correct url" do
|
15
|
+
subject.url.to_s.should include('institutions/1')
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ::Finicity::V1::Request::GetInstitutions do
|
4
|
+
subject { described_class.new("token-123", "Chase") }
|
5
|
+
|
6
|
+
describe "#headers" do
|
7
|
+
it "has correct headers" do
|
8
|
+
subject.headers.should have_key('Finicity-App-Key')
|
9
|
+
subject.headers.should have_key('Finicity-App-Token')
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "#url" do
|
14
|
+
it "has a correct url" do
|
15
|
+
subject.url.to_s.should include('institutions')
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ::Finicity::V1::Request::GetLoginForm do
|
4
|
+
subject { described_class.new("token-123", "institution-123") }
|
5
|
+
|
6
|
+
describe "#headers" do
|
7
|
+
it "has correct headers" do
|
8
|
+
subject.headers.should have_key('Finicity-App-Key')
|
9
|
+
subject.headers.should have_key('Finicity-App-Token')
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "#url" do
|
14
|
+
it "has a correct url" do
|
15
|
+
subject.url.to_s.should include('institution-123')
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ::Finicity::V1::Request::GetTransactions do
|
4
|
+
subject { described_class.new("token-123", 1, 2, 100, 101) }
|
5
|
+
|
6
|
+
describe "#headers" do
|
7
|
+
it "has correct headers" do
|
8
|
+
subject.headers.should have_key('Finicity-App-Key')
|
9
|
+
subject.headers.should have_key('Finicity-App-Token')
|
10
|
+
subject.headers.should have_key('Content-Type')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "#url" do
|
15
|
+
it "has a correct url" do
|
16
|
+
subject.url.to_s.should include('customers/1/accounts/2/transactions')
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ::Finicity::V1::Request::InteractiveRefreshAccount do
|
4
|
+
subject { described_class.new("token-123", 1, 2) }
|
5
|
+
|
6
|
+
describe "#headers" do
|
7
|
+
it "has correct headers" do
|
8
|
+
subject.headers.should have_key('Finicity-App-Key')
|
9
|
+
subject.headers.should have_key('Finicity-App-Token')
|
10
|
+
subject.headers.should have_key('Content-Type')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "#url" do
|
15
|
+
it "has a correct url" do
|
16
|
+
subject.url.to_s.should include('customers/1/accounts/2')
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ::Finicity::V1::Request::InteractiveRefreshAccountWithMfa do
|
4
|
+
let(:mfa_credential) {
|
5
|
+
{
|
6
|
+
:text => 'What is your birthday?',
|
7
|
+
:answer => '1985-01-01'
|
8
|
+
}
|
9
|
+
}
|
10
|
+
let(:mfa_credentials) { [mfa_credential] }
|
11
|
+
|
12
|
+
subject { described_class.new("token-123", "mfa_session-123", 1, 2, mfa_credentials) }
|
13
|
+
|
14
|
+
describe "#headers" do
|
15
|
+
it "has correct headers" do
|
16
|
+
subject.headers.should have_key('Finicity-App-Key')
|
17
|
+
subject.headers.should have_key('Finicity-App-Token')
|
18
|
+
subject.headers.should have_key('Content-Type')
|
19
|
+
subject.headers.should have_key('MFA-Session')
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "#body" do
|
24
|
+
it "forms the mfa text" do
|
25
|
+
subject.body.should include("<text>What is your birthday?</text>")
|
26
|
+
end
|
27
|
+
|
28
|
+
it "forms the mfa answer" do
|
29
|
+
subject.body.should include("<answer>1985-01-01</answer>")
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe "#url" do
|
34
|
+
it "has a correct url" do
|
35
|
+
subject.url.to_s.should include('customers/1/accounts/2/mfa')
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|