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,87 @@
|
|
1
|
+
module Finicity::V1
|
2
|
+
module Request
|
3
|
+
class DiscoverAccountsWithMfa
|
4
|
+
include ::Finicity::Logger
|
5
|
+
extend ::HTTPClient::IncludeClient
|
6
|
+
include_http_client do |client|
|
7
|
+
client.cookie_manager = nil
|
8
|
+
end
|
9
|
+
|
10
|
+
##
|
11
|
+
# Attributes
|
12
|
+
#
|
13
|
+
attr_accessor :customer_id,
|
14
|
+
:institution_id,
|
15
|
+
:login_credentials,
|
16
|
+
:mfa_credentials,
|
17
|
+
:mfa_session,
|
18
|
+
:token
|
19
|
+
|
20
|
+
##
|
21
|
+
# Instance Methods
|
22
|
+
#
|
23
|
+
def initialize(token, mfa_session, customer_id, institution_id, login_credentials, mfa_credentials)
|
24
|
+
@customer_id = customer_id
|
25
|
+
@institution_id = institution_id
|
26
|
+
@login_credentials = login_credentials
|
27
|
+
@mfa_credentials = mfa_credentials
|
28
|
+
@mfa_session = mfa_session
|
29
|
+
@token = token
|
30
|
+
end
|
31
|
+
|
32
|
+
def discover_accounts_with_mfa
|
33
|
+
http_client.post(url, body, headers)
|
34
|
+
end
|
35
|
+
|
36
|
+
def body
|
37
|
+
builder = ::Nokogiri::XML::Builder.new do |xml|
|
38
|
+
xml.accounts {
|
39
|
+
xml.credentials {
|
40
|
+
login_credentials.each do |login_credential|
|
41
|
+
xml.loginField {
|
42
|
+
xml.id(login_credential[:id])
|
43
|
+
xml.name(login_credential[:name])
|
44
|
+
xml.value(login_credential[:value])
|
45
|
+
}
|
46
|
+
end
|
47
|
+
}
|
48
|
+
xml.mfaChallenges {
|
49
|
+
xml.questions {
|
50
|
+
mfa_credentials.each do |mfa_credential|
|
51
|
+
xml.question {
|
52
|
+
xml.text_(mfa_credential[:text])
|
53
|
+
xml.answer(mfa_credential[:answer])
|
54
|
+
}
|
55
|
+
end
|
56
|
+
}
|
57
|
+
}
|
58
|
+
}
|
59
|
+
end
|
60
|
+
|
61
|
+
builder.to_xml
|
62
|
+
end
|
63
|
+
|
64
|
+
def headers
|
65
|
+
{
|
66
|
+
'Finicity-App-Key' => ::Finicity.config.app_key,
|
67
|
+
'Finicity-App-Token' => token,
|
68
|
+
'MFA-Session' => mfa_session,
|
69
|
+
'Content-Type' => 'application/xml'
|
70
|
+
}
|
71
|
+
end
|
72
|
+
|
73
|
+
def url
|
74
|
+
::URI.join(
|
75
|
+
::Finicity.config.base_url,
|
76
|
+
'v1/',
|
77
|
+
'customers/',
|
78
|
+
"#{customer_id}/",
|
79
|
+
'institutions/',
|
80
|
+
"#{institution_id}/",
|
81
|
+
'accounts/',
|
82
|
+
'mfa'
|
83
|
+
)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module Finicity::V1
|
2
|
+
module Request
|
3
|
+
class GetAccounts
|
4
|
+
include ::Finicity::Logger
|
5
|
+
extend ::HTTPClient::IncludeClient
|
6
|
+
include_http_client do |client|
|
7
|
+
client.cookie_manager = nil
|
8
|
+
end
|
9
|
+
|
10
|
+
##
|
11
|
+
# Attributes
|
12
|
+
#
|
13
|
+
attr_accessor :customer_id,
|
14
|
+
:institution_id,
|
15
|
+
:token
|
16
|
+
|
17
|
+
##
|
18
|
+
# Instance Methods
|
19
|
+
#
|
20
|
+
def initialize(token, customer_id, institution_id)
|
21
|
+
@customer_id = customer_id
|
22
|
+
@institution_id = institution_id
|
23
|
+
@token = token
|
24
|
+
end
|
25
|
+
|
26
|
+
def get_accounts
|
27
|
+
http_client.get(url, nil, headers)
|
28
|
+
end
|
29
|
+
|
30
|
+
def headers
|
31
|
+
{
|
32
|
+
'Finicity-App-Key' => ::Finicity.config.app_key,
|
33
|
+
'Finicity-App-Token' => token
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
def url
|
38
|
+
::URI.join(
|
39
|
+
::Finicity.config.base_url,
|
40
|
+
'v1/',
|
41
|
+
'customers/',
|
42
|
+
"#{customer_id}/",
|
43
|
+
'institutions/',
|
44
|
+
"#{institution_id}/",
|
45
|
+
'accounts'
|
46
|
+
)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Finicity::V1
|
2
|
+
module Request
|
3
|
+
class GetCustomers
|
4
|
+
include ::Finicity::Logger
|
5
|
+
extend ::HTTPClient::IncludeClient
|
6
|
+
include_http_client do |client|
|
7
|
+
client.cookie_manager = nil
|
8
|
+
end
|
9
|
+
|
10
|
+
##
|
11
|
+
# Attributes
|
12
|
+
#
|
13
|
+
attr_accessor :token
|
14
|
+
|
15
|
+
##
|
16
|
+
# Instance Methods
|
17
|
+
#
|
18
|
+
def initialize(token)
|
19
|
+
@token = token
|
20
|
+
end
|
21
|
+
|
22
|
+
def get_customers(start, limit)
|
23
|
+
query = { :start => start, :limit => limit }
|
24
|
+
http_client.get(url, query, headers)
|
25
|
+
end
|
26
|
+
|
27
|
+
def headers
|
28
|
+
{
|
29
|
+
'Finicity-App-Key' => ::Finicity.config.app_key,
|
30
|
+
'Finicity-App-Token' => token
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
def url
|
35
|
+
::URI.join(
|
36
|
+
::Finicity.config.base_url,
|
37
|
+
'v1/',
|
38
|
+
'customers'
|
39
|
+
)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module Finicity::V1
|
2
|
+
module Request
|
3
|
+
class GetCustomersByUsername
|
4
|
+
include ::Finicity::Logger
|
5
|
+
extend ::HTTPClient::IncludeClient
|
6
|
+
include_http_client do |client|
|
7
|
+
client.cookie_manager = nil
|
8
|
+
end
|
9
|
+
|
10
|
+
##
|
11
|
+
# Attributes
|
12
|
+
#
|
13
|
+
attr_accessor :limit,
|
14
|
+
:start,
|
15
|
+
:token,
|
16
|
+
:username
|
17
|
+
|
18
|
+
##
|
19
|
+
# Instance Methods
|
20
|
+
#
|
21
|
+
def initialize(token, username, start, limit)
|
22
|
+
@limit = limit
|
23
|
+
@start = start
|
24
|
+
@token = token
|
25
|
+
@username = username
|
26
|
+
end
|
27
|
+
|
28
|
+
def get_customers_by_username
|
29
|
+
http_client.get(url, query, headers)
|
30
|
+
end
|
31
|
+
|
32
|
+
def headers
|
33
|
+
{
|
34
|
+
'Finicity-App-Key' => ::Finicity.config.app_key,
|
35
|
+
'Finicity-App-Token' => token
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
def query
|
40
|
+
{ :search => username, :start => start, :limit => limit }
|
41
|
+
end
|
42
|
+
|
43
|
+
def url
|
44
|
+
::URI.join(
|
45
|
+
::Finicity.config.base_url,
|
46
|
+
'v1/',
|
47
|
+
'customers'
|
48
|
+
)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module Finicity::V1
|
2
|
+
module Request
|
3
|
+
class GetInstitution
|
4
|
+
include ::Finicity::Logger
|
5
|
+
extend ::HTTPClient::IncludeClient
|
6
|
+
include_http_client do |client|
|
7
|
+
client.cookie_manager = nil
|
8
|
+
end
|
9
|
+
|
10
|
+
##
|
11
|
+
# Attributes
|
12
|
+
#
|
13
|
+
attr_accessor :institution_id,
|
14
|
+
:token
|
15
|
+
|
16
|
+
##
|
17
|
+
# Instance Methods
|
18
|
+
#
|
19
|
+
def initialize(token, institution_id)
|
20
|
+
@institution_id = institution_id
|
21
|
+
@token = token
|
22
|
+
end
|
23
|
+
|
24
|
+
def get_institution
|
25
|
+
http_client.get(url, nil, headers)
|
26
|
+
end
|
27
|
+
|
28
|
+
def headers
|
29
|
+
{
|
30
|
+
'Finicity-App-Key' => ::Finicity.config.app_key,
|
31
|
+
'Finicity-App-Token' => token
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
def url
|
36
|
+
::URI.join(
|
37
|
+
::Finicity.config.base_url,
|
38
|
+
'v1/',
|
39
|
+
'institutions/',
|
40
|
+
institution_id.to_s
|
41
|
+
)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module Finicity::V1
|
2
|
+
module Request
|
3
|
+
class GetInstitutions
|
4
|
+
include ::Finicity::Logger
|
5
|
+
extend ::HTTPClient::IncludeClient
|
6
|
+
include_http_client do |client|
|
7
|
+
client.cookie_manager = nil
|
8
|
+
end
|
9
|
+
|
10
|
+
##
|
11
|
+
# Attributes
|
12
|
+
#
|
13
|
+
attr_accessor :institution_name,
|
14
|
+
:token
|
15
|
+
|
16
|
+
##
|
17
|
+
# Instance Methods
|
18
|
+
#
|
19
|
+
def initialize(token, institution_name)
|
20
|
+
@institution_name = institution_name
|
21
|
+
@token = token
|
22
|
+
end
|
23
|
+
|
24
|
+
def get_institutions(start, limit)
|
25
|
+
query = { :start => start, :limit => limit, :search => institution_name }
|
26
|
+
http_client.get(url, query, headers)
|
27
|
+
end
|
28
|
+
|
29
|
+
def headers
|
30
|
+
{
|
31
|
+
'Finicity-App-Key' => ::Finicity.config.app_key,
|
32
|
+
'Finicity-App-Token' => token
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
def url
|
37
|
+
::URI.join(
|
38
|
+
::Finicity.config.base_url,
|
39
|
+
'v1/',
|
40
|
+
'institutions'
|
41
|
+
)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Finicity::V1
|
2
|
+
module Request
|
3
|
+
class GetLoginForm
|
4
|
+
include ::Finicity::Logger
|
5
|
+
extend ::HTTPClient::IncludeClient
|
6
|
+
include_http_client do |client|
|
7
|
+
client.cookie_manager = nil
|
8
|
+
end
|
9
|
+
|
10
|
+
##
|
11
|
+
# Attributes
|
12
|
+
#
|
13
|
+
attr_accessor :institution_id,
|
14
|
+
:token
|
15
|
+
|
16
|
+
##
|
17
|
+
# Instance Methods
|
18
|
+
#
|
19
|
+
def initialize(token, institution_id)
|
20
|
+
@institution_id = institution_id
|
21
|
+
@token = token
|
22
|
+
end
|
23
|
+
|
24
|
+
def get_login_form
|
25
|
+
http_client.get(url, nil, headers)
|
26
|
+
end
|
27
|
+
|
28
|
+
def headers
|
29
|
+
{
|
30
|
+
'Finicity-App-Key' => ::Finicity.config.app_key,
|
31
|
+
'Finicity-App-Token' => token
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
def url
|
36
|
+
::URI.join(
|
37
|
+
::Finicity.config.base_url,
|
38
|
+
'v1/',
|
39
|
+
'institutions/',
|
40
|
+
"#{institution_id}/",
|
41
|
+
'loginForm'
|
42
|
+
)
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module Finicity::V1
|
2
|
+
module Request
|
3
|
+
class GetTransactions
|
4
|
+
include ::Finicity::Logger
|
5
|
+
extend ::HTTPClient::IncludeClient
|
6
|
+
include_http_client do |client|
|
7
|
+
client.cookie_manager = nil
|
8
|
+
end
|
9
|
+
|
10
|
+
##
|
11
|
+
# Attributes
|
12
|
+
#
|
13
|
+
attr_accessor :account_id,
|
14
|
+
:customer_id,
|
15
|
+
:from_date,
|
16
|
+
:to_date,
|
17
|
+
:token
|
18
|
+
|
19
|
+
##
|
20
|
+
# Instance Methods
|
21
|
+
#
|
22
|
+
def initialize(token, customer_id, account_id, from_date, to_date)
|
23
|
+
@account_id = account_id
|
24
|
+
@customer_id = customer_id
|
25
|
+
@from_date = from_date
|
26
|
+
@to_date = to_date
|
27
|
+
@token = token
|
28
|
+
end
|
29
|
+
|
30
|
+
def get_transactions
|
31
|
+
http_client.get(url, query, headers)
|
32
|
+
end
|
33
|
+
|
34
|
+
def headers
|
35
|
+
{
|
36
|
+
'Finicity-App-Key' => ::Finicity.config.app_key,
|
37
|
+
'Finicity-App-Token' => token,
|
38
|
+
'Content-Type' => 'application/xml'
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
def query
|
43
|
+
{ :fromDate => from_date, :toDate => to_date }
|
44
|
+
end
|
45
|
+
|
46
|
+
def url
|
47
|
+
::URI.join(
|
48
|
+
::Finicity.config.base_url,
|
49
|
+
'v1/',
|
50
|
+
'customers/',
|
51
|
+
"#{customer_id}/",
|
52
|
+
'accounts/',
|
53
|
+
"#{account_id}/",
|
54
|
+
'transactions'
|
55
|
+
)
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module Finicity::V1
|
2
|
+
module Request
|
3
|
+
class InteractiveRefreshAccount
|
4
|
+
include ::Finicity::Logger
|
5
|
+
extend ::HTTPClient::IncludeClient
|
6
|
+
include_http_client do |client|
|
7
|
+
client.cookie_manager = nil
|
8
|
+
end
|
9
|
+
|
10
|
+
##
|
11
|
+
# Attributes
|
12
|
+
#
|
13
|
+
attr_accessor :account_id,
|
14
|
+
:customer_id,
|
15
|
+
:token
|
16
|
+
|
17
|
+
##
|
18
|
+
# Instance Methods
|
19
|
+
#
|
20
|
+
def initialize(token, customer_id, account_id)
|
21
|
+
@account_id = account_id
|
22
|
+
@customer_id = customer_id
|
23
|
+
@token = token
|
24
|
+
end
|
25
|
+
|
26
|
+
def interactive_refresh_account
|
27
|
+
http_client.post(url, nil, headers)
|
28
|
+
end
|
29
|
+
|
30
|
+
def headers
|
31
|
+
{
|
32
|
+
'Finicity-App-Key' => ::Finicity.config.app_key,
|
33
|
+
'Finicity-App-Token' => token,
|
34
|
+
'Content-Type' => 'application/xml'
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
def url
|
39
|
+
::URI.join(
|
40
|
+
::Finicity.config.base_url,
|
41
|
+
'v1/',
|
42
|
+
'customers/',
|
43
|
+
"#{customer_id}/",
|
44
|
+
'accounts/',
|
45
|
+
"#{account_id}"
|
46
|
+
)
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|