finapps 5.0.28 → 5.0.33
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/.rubocop.yml +134 -61
- data/.rubocop_todo.yml +120 -0
- data/.tmuxinator.yml +1 -0
- data/.travis.yml +3 -1
- data/RELEASES.md +42 -0
- data/finapps.gemspec +3 -3
- data/lib/finapps.rb +4 -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 +12 -8
- data/lib/finapps/rest/consumers.rb +22 -6
- data/lib/finapps/rest/consumers_portfolios.rb +1 -1
- data/lib/finapps/rest/documents_orders.rb +105 -0
- data/lib/finapps/rest/documents_orders_notifications.rb +14 -0
- data/lib/finapps/rest/esign_templates.rb +11 -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 +349 -0
- data/spec/rest/esign_templates_spec.rb +21 -0
- 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 +64 -1
- data/spec/support/fixtures/documents_order.json +75 -0
- data/spec/support/fixtures/documents_orders.json +32 -0
- data/spec/support/fixtures/documents_orders_none.json +6 -0
- data/spec/support/fixtures/esign_templates.json +6 -0
- data/spec/support/fixtures/invalid_order_id.json +5 -0
- data/spec/support/fixtures/invalid_signature_id.json +5 -0
- data/spec/support/fixtures/sign_url.json +4 -0
- data/spec/support/fixtures/signed_document.pdf +0 -0
- data/spec/utils/query_builder_spec.rb +40 -14
- metadata +81 -60
@@ -8,7 +8,7 @@ module FinApps
|
|
8
8
|
|
9
9
|
def list(params = nil)
|
10
10
|
return super END_POINT if params.nil?
|
11
|
-
|
11
|
+
fail FinAppsCore::InvalidArgumentsError, 'Invalid argument: params' unless params.is_a? Hash
|
12
12
|
|
13
13
|
super build_query_path(END_POINT, params)
|
14
14
|
end
|
@@ -8,7 +8,7 @@ module FinApps
|
|
8
8
|
|
9
9
|
def list(params = nil)
|
10
10
|
return super END_POINT if params.nil?
|
11
|
-
|
11
|
+
fail FinAppsCore::InvalidArgumentsError, 'Invalid argument: params' unless params.is_a? Hash
|
12
12
|
|
13
13
|
super build_query_path(END_POINT, params)
|
14
14
|
end
|
data/lib/finapps/rest/client.rb
CHANGED
@@ -9,7 +9,11 @@ module FinApps
|
|
9
9
|
RESOURCES = %i[
|
10
10
|
alert_definitions
|
11
11
|
alert_occurrences
|
12
|
+
consumers
|
12
13
|
consumers_portfolios
|
14
|
+
documents_orders
|
15
|
+
documents_orders_notifications
|
16
|
+
esign_templates
|
13
17
|
orders
|
14
18
|
order_assignments
|
15
19
|
order_notifications
|
@@ -20,26 +24,26 @@ module FinApps
|
|
20
24
|
operators
|
21
25
|
operators_password_resets
|
22
26
|
password_resets
|
23
|
-
|
27
|
+
plaid_webhooks
|
28
|
+
plaid_consumer_institutions
|
29
|
+
plaid_accounts
|
30
|
+
plaid_account_permissions
|
31
|
+
plaid_institution_logos
|
24
32
|
portfolios
|
25
33
|
portfolios_alerts
|
26
34
|
portfolios_available_consumers
|
27
35
|
portfolios_consumers
|
28
36
|
portfolio_reports
|
37
|
+
products
|
29
38
|
sessions
|
30
|
-
|
39
|
+
signed_documents_downloads
|
31
40
|
tenant_settings
|
32
41
|
tenant_app_settings
|
33
|
-
version
|
34
|
-
plaid_webhooks
|
35
|
-
plaid_consumer_institutions
|
36
|
-
plaid_accounts
|
37
|
-
plaid_account_permissions
|
38
|
-
plaid_institution_logos
|
39
42
|
verix_metadata
|
40
43
|
verix_records
|
41
44
|
verix_pdf_documents
|
42
45
|
verix_documents
|
46
|
+
version
|
43
47
|
].freeze
|
44
48
|
|
45
49
|
# @param [String] tenant_token
|
@@ -15,7 +15,7 @@ module FinApps
|
|
15
15
|
|
16
16
|
def list(params = nil)
|
17
17
|
return super if params.nil?
|
18
|
-
|
18
|
+
fail FinAppsCore::InvalidArgumentsError, 'Invalid argument: params' unless params.is_a? Hash
|
19
19
|
|
20
20
|
super build_query_path(end_point, params)
|
21
21
|
end
|
@@ -54,14 +54,30 @@ module FinApps
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def search_query(term)
|
57
|
+
query = with_space_search(term).concat(name_search(term))
|
57
58
|
{
|
58
|
-
"$or":
|
59
|
-
{ "email": term },
|
60
|
-
{ "first_name": term },
|
61
|
-
{ "last_name": term }
|
62
|
-
]
|
59
|
+
"$or": query
|
63
60
|
}
|
64
61
|
end
|
62
|
+
|
63
|
+
def with_space_search(term)
|
64
|
+
[
|
65
|
+
{"email": term},
|
66
|
+
{"first_name": term},
|
67
|
+
{"last_name": term}
|
68
|
+
]
|
69
|
+
end
|
70
|
+
|
71
|
+
def name_search(term)
|
72
|
+
search_arr = []
|
73
|
+
if /\s/.match?(term)
|
74
|
+
term.split.each do |t|
|
75
|
+
search_arr.append("first_name": t)
|
76
|
+
search_arr.append("last_name": t)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
search_arr
|
80
|
+
end
|
65
81
|
end
|
66
82
|
end
|
67
83
|
end
|
@@ -11,7 +11,7 @@ module FinApps
|
|
11
11
|
path = "consumers/#{ERB::Util.url_encode(id)}/portfolios"
|
12
12
|
return super path if params.nil?
|
13
13
|
|
14
|
-
|
14
|
+
fail FinAppsCore::InvalidArgumentsError, 'Invalid argument: params' unless params.is_a? Hash
|
15
15
|
|
16
16
|
super build_query_path(path, params)
|
17
17
|
end
|
@@ -0,0 +1,105 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../utils/query_builder'
|
4
|
+
|
5
|
+
module FinApps
|
6
|
+
module REST
|
7
|
+
class DocumentsOrders < FinAppsCore::REST::Resources
|
8
|
+
include FinApps::Utils::QueryBuilder
|
9
|
+
|
10
|
+
def list(params = nil)
|
11
|
+
path = 'documents/orders'
|
12
|
+
return super(path) if params.nil?
|
13
|
+
fail FinAppsCore::InvalidArgumentsError, 'Invalid argument: params' unless params.is_a? Hash
|
14
|
+
|
15
|
+
super build_query_path(path, params)
|
16
|
+
end
|
17
|
+
|
18
|
+
def show(id)
|
19
|
+
not_blank(id, :order_id)
|
20
|
+
super(id, "documents/orders/#{id}")
|
21
|
+
end
|
22
|
+
|
23
|
+
def create(params)
|
24
|
+
not_blank(params, :params)
|
25
|
+
super(params, 'documents/orders')
|
26
|
+
end
|
27
|
+
|
28
|
+
def update(id, params = nil)
|
29
|
+
not_blank(id, :order_id)
|
30
|
+
not_blank(params, :params)
|
31
|
+
super(params, "documents/orders/#{id}")
|
32
|
+
end
|
33
|
+
|
34
|
+
def destroy(id)
|
35
|
+
not_blank(id, :order_id)
|
36
|
+
super(id, "documents/orders/#{id}")
|
37
|
+
end
|
38
|
+
|
39
|
+
def show_signing_url(order_id, signature_id)
|
40
|
+
not_blank(order_id, :order_id)
|
41
|
+
not_blank(signature_id, :signature_id)
|
42
|
+
path = "documents/orders/#{order_id}/sign_url/#{signature_id}"
|
43
|
+
send_request path, :get
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
def build_filter(params)
|
49
|
+
search_query(params[:searchTerm])
|
50
|
+
.merge(consumer_query(params[:consumer]))
|
51
|
+
.merge(tag_query(params[:tag]))
|
52
|
+
.merge(status_query(params[:status]))
|
53
|
+
end
|
54
|
+
|
55
|
+
def search_query(term)
|
56
|
+
return {} unless term
|
57
|
+
|
58
|
+
query = with_space_search(term).concat(name_search(term))
|
59
|
+
{"$or": query}
|
60
|
+
end
|
61
|
+
|
62
|
+
def name_search(term)
|
63
|
+
search_arr = []
|
64
|
+
if /\s/.match?(term)
|
65
|
+
term.split.each do |t|
|
66
|
+
search_arr.append("applicant.first_name": t)
|
67
|
+
search_arr.append("applicant.last_name": t)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
search_arr
|
71
|
+
end
|
72
|
+
|
73
|
+
def with_space_search(term)
|
74
|
+
[
|
75
|
+
{"applicant.email": term},
|
76
|
+
{"applicant.first_name": term},
|
77
|
+
{"applicant.last_name": term},
|
78
|
+
{
|
79
|
+
"reference_no": {
|
80
|
+
"$regex": "^#{term}", "$options": 'i'
|
81
|
+
}
|
82
|
+
}
|
83
|
+
]
|
84
|
+
end
|
85
|
+
|
86
|
+
def tag_query(tag)
|
87
|
+
return {} unless tag
|
88
|
+
|
89
|
+
{"tag": tag.empty? ? nil : tag}
|
90
|
+
end
|
91
|
+
|
92
|
+
def status_query(status)
|
93
|
+
return {} unless status
|
94
|
+
|
95
|
+
{status: status}
|
96
|
+
end
|
97
|
+
|
98
|
+
def consumer_query(consumer)
|
99
|
+
return {} unless consumer
|
100
|
+
|
101
|
+
{"consumer_id": consumer.empty? ? nil : consumer}
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module FinApps
|
4
|
+
module REST
|
5
|
+
class DocumentsOrdersNotifications < FinAppsCore::REST::Resources
|
6
|
+
def create(id)
|
7
|
+
not_blank(id, :id)
|
8
|
+
|
9
|
+
path = "documents/orders/#{ERB::Util.url_encode(id)}/notify"
|
10
|
+
super nil, path
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -9,7 +9,7 @@ module FinApps
|
|
9
9
|
|
10
10
|
def list(params = nil)
|
11
11
|
return super if params.nil?
|
12
|
-
|
12
|
+
fail FinAppsCore::InvalidArgumentsError, 'Invalid argument: params' unless params.is_a? Hash
|
13
13
|
|
14
14
|
super build_query_path(end_point, params)
|
15
15
|
end
|
@@ -36,7 +36,7 @@ module FinApps
|
|
36
36
|
def update_password(params)
|
37
37
|
# update password for current operator, need authorization session in header
|
38
38
|
not_blank(params, :params)
|
39
|
-
|
39
|
+
fail FinAppsCore::InvalidArgumentsError, 'Invalid argument: params.' unless validates params
|
40
40
|
|
41
41
|
path = "#{end_point}/password/change"
|
42
42
|
|
@@ -64,14 +64,14 @@ module FinApps
|
|
64
64
|
end
|
65
65
|
|
66
66
|
def search_query(term)
|
67
|
-
{
|
67
|
+
{"last_name": term}
|
68
68
|
end
|
69
69
|
|
70
70
|
def role_query(role)
|
71
71
|
if role.is_a?(Array)
|
72
|
-
{
|
72
|
+
{"role": {"$in": role.map(&:to_i)}}
|
73
73
|
else
|
74
|
-
{
|
74
|
+
{"role": role.to_i}
|
75
75
|
end
|
76
76
|
end
|
77
77
|
end
|
@@ -22,7 +22,7 @@ module FinApps
|
|
22
22
|
private
|
23
23
|
|
24
24
|
def validates_email(params)
|
25
|
-
|
25
|
+
fail FinAppsCore::InvalidArgumentsError, 'Invalid argument: params.' unless email_exists? params
|
26
26
|
end
|
27
27
|
|
28
28
|
def email_exists?(params)
|
@@ -6,7 +6,7 @@ module FinApps
|
|
6
6
|
def update(id, orders_array)
|
7
7
|
not_blank(id, :operator_id)
|
8
8
|
not_blank(orders_array, :params)
|
9
|
-
|
9
|
+
fail FinAppsCore::InvalidArgumentsError, 'Invalid argument: params' unless orders_array.is_a? Array
|
10
10
|
|
11
11
|
path = "operators/#{ERB::Util.url_encode(id)}/assign"
|
12
12
|
super orders_array, path
|
@@ -6,7 +6,7 @@ module FinApps
|
|
6
6
|
def show(id, format)
|
7
7
|
not_blank(id, :id)
|
8
8
|
not_blank(format, :format)
|
9
|
-
|
9
|
+
fail FinAppsCore::InvalidArgumentsError, 'Invalid argument: format' unless accepted_format?(format)
|
10
10
|
|
11
11
|
path =
|
12
12
|
"orders/#{ERB::Util.url_encode(id)}/report.#{ERB::Util.url_encode(format)}"
|
data/lib/finapps/rest/orders.rb
CHANGED
@@ -28,7 +28,7 @@ module FinApps
|
|
28
28
|
#
|
29
29
|
def list(params = nil)
|
30
30
|
return super if params.nil?
|
31
|
-
|
31
|
+
fail FinAppsCore::InvalidArgumentsError, 'Invalid argument: params' unless params.is_a? Hash
|
32
32
|
|
33
33
|
super build_query_path(end_point, params)
|
34
34
|
end
|
@@ -66,9 +66,9 @@ module FinApps
|
|
66
66
|
if term
|
67
67
|
{
|
68
68
|
"$or": [
|
69
|
-
{
|
70
|
-
{
|
71
|
-
{
|
69
|
+
{"public_id": {"$regex": "^#{term}", "$options": 'i'}},
|
70
|
+
{"applicant.last_name": term},
|
71
|
+
{"assignment.last_name": term},
|
72
72
|
{
|
73
73
|
"requestor.reference_no": {
|
74
74
|
"$regex": "^#{term}", "$options": 'i'
|
@@ -84,9 +84,9 @@ module FinApps
|
|
84
84
|
def status_query(status)
|
85
85
|
if status
|
86
86
|
if status.is_a?(Array)
|
87
|
-
{
|
87
|
+
{"status": {"$in": status.map(&:to_i)}}
|
88
88
|
else
|
89
|
-
{
|
89
|
+
{"status": status.to_i}
|
90
90
|
end
|
91
91
|
else
|
92
92
|
{}
|
@@ -96,7 +96,7 @@ module FinApps
|
|
96
96
|
def assignment_query(assignment)
|
97
97
|
# translate "" to null assignment
|
98
98
|
if assignment
|
99
|
-
{
|
99
|
+
{"assignment.operator_id": assignment.empty? ? nil : assignment}
|
100
100
|
else
|
101
101
|
{}
|
102
102
|
end
|
@@ -104,7 +104,7 @@ module FinApps
|
|
104
104
|
|
105
105
|
def consumer_query(consumer)
|
106
106
|
if consumer
|
107
|
-
{
|
107
|
+
{"consumer_id": consumer.empty? ? nil : consumer}
|
108
108
|
else
|
109
109
|
{}
|
110
110
|
end
|
@@ -114,8 +114,8 @@ module FinApps
|
|
114
114
|
if !search_term && !nil_or_empty?(relation)
|
115
115
|
{
|
116
116
|
"$or": [
|
117
|
-
{
|
118
|
-
{
|
117
|
+
{"public_id": {"$in": relation}},
|
118
|
+
{"original_order_id": {"$in": relation}}
|
119
119
|
]
|
120
120
|
}
|
121
121
|
else
|
@@ -9,7 +9,7 @@ module FinApps
|
|
9
9
|
super(params, 'p/institution/consumer')
|
10
10
|
end
|
11
11
|
|
12
|
-
def show(id, options = {
|
12
|
+
def show(id, options = {show_accounts: false})
|
13
13
|
results, error_messages = super(nil, "p/institution/consumer/#{id}")
|
14
14
|
|
15
15
|
if error_messages.empty? && options[:show_accounts]
|
@@ -9,7 +9,7 @@ module FinApps
|
|
9
9
|
path = 'portfolio/reports'
|
10
10
|
|
11
11
|
return super path if params.nil?
|
12
|
-
|
12
|
+
fail FinAppsCore::InvalidArgumentsError, 'Invalid argument: params' unless params.is_a? Hash
|
13
13
|
|
14
14
|
super build_query_path(path, params)
|
15
15
|
end
|
@@ -7,7 +7,7 @@ module FinApps
|
|
7
7
|
|
8
8
|
def list(params = nil)
|
9
9
|
return super if params.nil?
|
10
|
-
|
10
|
+
fail FinAppsCore::InvalidArgumentsError, 'Invalid argument: params' unless params.is_a? Hash
|
11
11
|
|
12
12
|
super build_query_path(end_point, params)
|
13
13
|
end
|
@@ -12,7 +12,7 @@ module FinApps
|
|
12
12
|
"portfolios/#{ERB::Util.url_encode(portfolio_id)}/consumers/available"
|
13
13
|
return super path if params.nil?
|
14
14
|
|
15
|
-
|
15
|
+
fail FinAppsCore::InvalidArgumentsError, 'Invalid argument: params' unless params.is_a? Hash
|
16
16
|
|
17
17
|
super build_query_path(path, params)
|
18
18
|
end
|
@@ -11,7 +11,7 @@ module FinApps
|
|
11
11
|
path = build_path(portfolio_id)
|
12
12
|
return super path if params.nil?
|
13
13
|
|
14
|
-
|
14
|
+
fail FinAppsCore::InvalidArgumentsError, 'Invalid argument: params' unless params.is_a? Hash
|
15
15
|
|
16
16
|
super build_query_path(path, params)
|
17
17
|
end
|
@@ -8,7 +8,7 @@ module FinApps
|
|
8
8
|
|
9
9
|
def create(params, path = nil)
|
10
10
|
return super nil, path if path == LOGOUT
|
11
|
-
|
11
|
+
fail FinAppsCore::InvalidArgumentsError, 'Invalid argument: params.' unless validates params
|
12
12
|
|
13
13
|
path ||= CONSUMER_LOGIN
|
14
14
|
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module FinApps
|
4
|
+
module REST
|
5
|
+
class SignedDocumentsDownloads < FinAppsCore::REST::Resources
|
6
|
+
def show(consumer_id, signature_request_id)
|
7
|
+
not_blank(consumer_id, :consumer_id)
|
8
|
+
not_blank(signature_request_id, :signature_request_id)
|
9
|
+
|
10
|
+
path =
|
11
|
+
"consumers/#{ERB::Util.url_encode(consumer_id)}/"\
|
12
|
+
"documents/#{ERB::Util.url_encode(signature_request_id)}"
|
13
|
+
super(nil, path)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|