dscf-credit 0.1.1 → 0.1.3
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 +4 -4
- data/app/controllers/concerns/dscf/core/authenticatable.rb +81 -0
- data/app/controllers/concerns/dscf/core/common.rb +200 -0
- data/app/controllers/concerns/dscf/core/filterable.rb +12 -0
- data/app/controllers/concerns/dscf/core/json_response.rb +77 -0
- data/app/controllers/concerns/dscf/core/pagination.rb +71 -0
- data/app/controllers/concerns/dscf/core/token_authenticatable.rb +53 -0
- data/app/controllers/concerns/dscf/credit/reviewable.rb +112 -0
- data/app/controllers/dscf/credit/categories_controller.rb +6 -5
- data/app/controllers/dscf/credit/credit_limit_calculations_controller.rb +50 -0
- data/app/controllers/dscf/credit/credit_line_specs_controller.rb +2 -1
- data/app/controllers/dscf/credit/credit_lines_controller.rb +11 -38
- data/app/controllers/dscf/credit/disbursements_controller.rb +55 -0
- data/app/controllers/dscf/credit/eligible_credit_lines_controller.rb +50 -0
- data/app/controllers/dscf/credit/facilitators_controller.rb +39 -150
- data/app/controllers/dscf/credit/loan_profiles_controller.rb +138 -0
- data/app/controllers/dscf/credit/payment_requests_controller.rb +54 -5
- data/app/controllers/dscf/credit/repayments_controller.rb +53 -0
- data/app/controllers/dscf/credit/scoring_param_types_controller.rb +31 -0
- data/app/controllers/dscf/credit/scoring_parameters_controller.rb +13 -8
- data/app/controllers/dscf/credit/scoring_tables_controller.rb +8 -8
- data/app/controllers/dscf/credit/system_configs_controller.rb +10 -7
- data/app/models/dscf/credit/bank_branch.rb +2 -1
- data/app/models/dscf/credit/category.rb +4 -2
- data/app/models/dscf/credit/credit_line.rb +9 -6
- data/app/models/dscf/credit/credit_line_spec.rb +3 -3
- data/app/models/dscf/credit/eligible_credit_line.rb +28 -0
- data/app/models/dscf/credit/facilitator.rb +5 -4
- data/app/models/dscf/credit/facilitator_performance.rb +1 -2
- data/app/models/dscf/credit/loan_profile.rb +8 -4
- data/app/models/dscf/credit/loan_profile_scoring_spec.rb +4 -6
- data/app/models/dscf/credit/scoring_param_type.rb +17 -0
- data/app/models/dscf/credit/scoring_parameter.rb +8 -7
- data/app/models/dscf/credit/scoring_table.rb +4 -4
- data/app/models/dscf/credit/system_config.rb +5 -4
- data/app/serializers/dscf/credit/bank_branch_serializer.rb +1 -0
- data/app/serializers/dscf/credit/category_serializer.rb +3 -1
- data/app/serializers/dscf/credit/credit_line_serializer.rb +4 -2
- data/app/serializers/dscf/credit/credit_line_spec_serializer.rb +1 -1
- data/app/serializers/dscf/credit/daily_routine_transaction_serializer.rb +8 -0
- data/app/serializers/dscf/credit/eligible_credit_line_serializer.rb +8 -0
- data/app/serializers/dscf/credit/facilitator_performance_serializer.rb +1 -1
- data/app/serializers/dscf/credit/facilitator_serializer.rb +2 -2
- data/app/serializers/dscf/credit/loan_profile_scoring_spec_serializer.rb +8 -0
- data/app/serializers/dscf/credit/loan_profile_serializer.rb +15 -0
- data/app/serializers/dscf/credit/loan_serializer.rb +12 -0
- data/app/serializers/dscf/credit/loan_transaction_serializer.rb +8 -0
- data/app/serializers/dscf/credit/payment_request_serializer.rb +10 -0
- data/app/serializers/dscf/credit/payment_serializer.rb +8 -0
- data/app/serializers/dscf/credit/scoring_param_type_serializer.rb +7 -0
- data/app/serializers/dscf/credit/scoring_parameter_serializer.rb +6 -3
- data/app/serializers/dscf/credit/scoring_table_serializer.rb +1 -1
- data/app/serializers/dscf/credit/system_config_serializer.rb +2 -2
- data/app/services/dscf/credit/credit_limit_calculation_service.rb +153 -0
- data/app/services/dscf/credit/disbursement_service.rb +180 -0
- data/app/services/dscf/credit/facilitator_approval_service.rb +4 -3
- data/app/services/dscf/credit/facilitator_creation_service.rb +157 -0
- data/app/services/dscf/credit/repayment_service.rb +216 -0
- data/app/services/dscf/credit/risk_application_service.rb +27 -0
- data/app/services/dscf/credit/scoring_service.rb +297 -0
- data/config/locales/en.yml +125 -8
- data/config/routes.rb +42 -11
- data/db/migrate/20250822091011_create_dscf_credit_categories.rb +2 -0
- data/db/migrate/20250822091131_create_dscf_credit_credit_lines.rb +7 -4
- data/db/migrate/20250822091527_create_dscf_credit_credit_line_specs.rb +1 -0
- data/db/migrate/20250822091820_create_dscf_credit_system_configs.rb +5 -2
- data/db/migrate/20250822092040_create_dscf_credit_scoring_param_types.rb +12 -0
- data/db/migrate/20250822092050_create_dscf_credit_scoring_parameters.rb +11 -6
- data/db/migrate/20250822092246_create_dscf_credit_loan_profiles.rb +6 -3
- data/db/migrate/20250822092417_create_dscf_credit_loan_profile_scoring_specs.rb +5 -7
- data/db/migrate/20250822092436_create_dscf_credit_facilitators.rb +5 -2
- data/db/migrate/20250822092528_create_dscf_credit_facilitator_performances.rb +0 -3
- data/db/migrate/20250901172842_create_dscf_credit_scoring_tables.rb +2 -2
- data/db/migrate/20250917120000_create_dscf_credit_eligible_credit_lines.rb +18 -0
- data/db/seeds.rb +134 -40
- data/lib/dscf/credit/version.rb +1 -1
- data/spec/factories/dscf/credit/categories.rb +1 -0
- data/spec/factories/dscf/credit/credit_line_specs.rb +1 -0
- data/spec/factories/dscf/credit/credit_lines.rb +9 -7
- data/spec/factories/dscf/credit/eligible_credit_lines.rb +33 -0
- data/spec/factories/dscf/credit/facilitator_performances.rb +0 -5
- data/spec/factories/dscf/credit/facilitators.rb +6 -1
- data/spec/factories/dscf/credit/loan_profile_scoring_specs.rb +1 -7
- data/spec/factories/dscf/credit/loan_profiles.rb +11 -6
- data/spec/factories/dscf/credit/scoring_param_types.rb +31 -0
- data/spec/factories/dscf/credit/scoring_parameters.rb +26 -4
- data/spec/factories/dscf/credit/scoring_tables.rb +1 -1
- data/spec/factories/dscf/credit/system_configs.rb +8 -2
- metadata +50 -2
data/config/locales/en.yml
CHANGED
@@ -41,20 +41,61 @@ en:
|
|
41
41
|
update: "Failed to update bank staff"
|
42
42
|
destroy: "Failed to remove bank staff"
|
43
43
|
|
44
|
+
scoring_param_type:
|
45
|
+
success:
|
46
|
+
index: "Scoring parameter types retrieved successfully"
|
47
|
+
show: "Scoring parameter type details retrieved successfully"
|
48
|
+
create: "Scoring parameter type created successfully"
|
49
|
+
update: "Scoring parameter type updated successfully"
|
50
|
+
destroy: "Scoring parameter type deleted successfully"
|
51
|
+
errors:
|
52
|
+
index: "Failed to retrieve scoring parameter types"
|
53
|
+
show: "Failed to retrieve scoring parameter type details"
|
54
|
+
create: "Failed to create scoring parameter type"
|
55
|
+
update: "Failed to update scoring parameter type"
|
56
|
+
destroy: "Failed to delete scoring parameter type"
|
57
|
+
|
44
58
|
scoring_parameter:
|
45
59
|
success:
|
46
60
|
index: "Scoring parameters retrieved successfully"
|
47
61
|
show: "Scoring parameter details retrieved successfully"
|
48
62
|
create: "Scoring parameter created successfully"
|
49
63
|
update: "Scoring parameter updated successfully"
|
64
|
+
approve: "Scoring parameter approved successfully"
|
65
|
+
reject: "Scoring parameter rejected successfully"
|
66
|
+
request_modification: "Modification requested for scoring parameter successfully"
|
67
|
+
resubmit: "Scoring parameter resubmitted successfully"
|
50
68
|
destroy: "Scoring parameter deleted successfully"
|
51
69
|
errors:
|
52
70
|
index: "Failed to retrieve scoring parameters"
|
53
71
|
show: "Failed to retrieve scoring parameter details"
|
54
72
|
create: "Failed to create scoring parameter"
|
55
73
|
update: "Failed to update scoring parameter"
|
74
|
+
approve: "Failed to approve scoring parameter"
|
75
|
+
reject: "Failed to reject scoring parameter"
|
76
|
+
request_modification: "Failed to request modification for scoring parameter"
|
77
|
+
resubmit: "Failed to resubmit scoring parameter"
|
56
78
|
destroy: "Failed to delete scoring parameter"
|
57
79
|
|
80
|
+
loan_profile:
|
81
|
+
success:
|
82
|
+
index: "Loan profiles retrieved successfully"
|
83
|
+
show: "Loan profile details retrieved successfully"
|
84
|
+
create: "Loan profile created successfully"
|
85
|
+
update: "Loan profile updated successfully"
|
86
|
+
approve: "Loan profile approved successfully"
|
87
|
+
reject: "Loan profile rejected successfully"
|
88
|
+
calculate_score: "Credit score calculated successfully"
|
89
|
+
errors:
|
90
|
+
index: "Failed to retrieve loan profiles"
|
91
|
+
show: "Failed to retrieve loan profile details"
|
92
|
+
create: "Failed to create loan profile"
|
93
|
+
update: "Failed to update loan profile"
|
94
|
+
approve: "Failed to approve loan profile"
|
95
|
+
reject: "Failed to reject loan profile"
|
96
|
+
calculate_score: "Failed to calculate credit score"
|
97
|
+
not_found: "Loan profile not found"
|
98
|
+
|
58
99
|
parameter_normalizer:
|
59
100
|
success:
|
60
101
|
index: "Parameter normalizers retrieved successfully"
|
@@ -75,20 +116,24 @@ en:
|
|
75
116
|
show: "Facilitator details retrieved successfully"
|
76
117
|
create: "Facilitator created successfully"
|
77
118
|
update: "Facilitator updated successfully"
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
119
|
+
approve: "Facilitator approved successfully"
|
120
|
+
reject: "Facilitator rejected successfully"
|
121
|
+
set_limit: "Facilitator limit updated successfully"
|
122
|
+
submit_additional_info: "Additional information submitted successfully"
|
123
|
+
request_modification: "Modification requested for facilitator successfully"
|
124
|
+
resubmit: "Facilitator resubmitted successfully"
|
82
125
|
batch_created_all: "All facilitators created successfully"
|
83
126
|
batch_created_partial: "Batch processing completed with partial success"
|
84
127
|
errors:
|
85
128
|
create: "Failed to create facilitator"
|
86
129
|
update: "Failed to update facilitator"
|
87
130
|
show: "Failed to retrieve facilitator details"
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
131
|
+
approve: "Failed to approve facilitator"
|
132
|
+
reject: "Failed to reject facilitator"
|
133
|
+
set_limit: "Failed to update facilitator limit"
|
134
|
+
submit_additional_info: "Failed to submit additional information"
|
135
|
+
request_modification: "Failed to request modification for facilitator"
|
136
|
+
resubmit: "Failed to resubmit facilitator"
|
92
137
|
no_business: "User must have a business associated to become a facilitator"
|
93
138
|
invalid_batch_format: "Invalid batch format"
|
94
139
|
empty_batch: "Empty batch provided"
|
@@ -118,6 +163,8 @@ en:
|
|
118
163
|
approve: "Credit line approved successfully"
|
119
164
|
reject: "Credit line rejected successfully"
|
120
165
|
destroy: "Credit line deleted successfully"
|
166
|
+
request_modification: "Modification requested successfully"
|
167
|
+
resubmit: "Credit line resubmitted successfully"
|
121
168
|
errors:
|
122
169
|
index: "Failed to retrieve credit lines"
|
123
170
|
show: "Failed to retrieve credit line details"
|
@@ -126,6 +173,22 @@ en:
|
|
126
173
|
approve: "Failed to approve credit line"
|
127
174
|
reject: "Failed to reject credit line"
|
128
175
|
destroy: "Failed to delete credit line"
|
176
|
+
request_modification: "Failed to request modification"
|
177
|
+
resubmit: "Failed to resubmit credit line"
|
178
|
+
|
179
|
+
eligible_credit_line:
|
180
|
+
success:
|
181
|
+
index: "Eligible credit lines retrieved successfully"
|
182
|
+
show: "Eligible credit line details retrieved successfully"
|
183
|
+
create: "Eligible credit line created successfully"
|
184
|
+
update: "Eligible credit line updated successfully"
|
185
|
+
apply_risk: "Risk applied successfully"
|
186
|
+
errors:
|
187
|
+
index: "Failed to retrieve eligible credit lines"
|
188
|
+
show: "Failed to retrieve eligible credit line details"
|
189
|
+
create: "Failed to create eligible credit line"
|
190
|
+
update: "Failed to update eligible credit line"
|
191
|
+
apply_risk: "Failed to apply risk"
|
129
192
|
|
130
193
|
system_config_definition:
|
131
194
|
success:
|
@@ -147,12 +210,20 @@ en:
|
|
147
210
|
show: "System config details retrieved successfully"
|
148
211
|
create: "System config created successfully"
|
149
212
|
update: "System config updated successfully"
|
213
|
+
approve: "System config approved successfully"
|
214
|
+
reject: "System config rejected successfully"
|
215
|
+
request_modification: "Modification requested for system config successfully"
|
216
|
+
resubmit: "System config resubmitted successfully"
|
150
217
|
destroy: "System config deleted successfully"
|
151
218
|
errors:
|
152
219
|
index: "Failed to retrieve system configs"
|
153
220
|
show: "Failed to retrieve system config details"
|
154
221
|
create: "Failed to create system config"
|
155
222
|
update: "Failed to update system config"
|
223
|
+
approve: "Failed to approve system config"
|
224
|
+
reject: "Failed to reject system config"
|
225
|
+
request_modification: "Failed to request modification for system config"
|
226
|
+
resubmit: "Failed to resubmit system config"
|
156
227
|
destroy: "Failed to delete system config"
|
157
228
|
|
158
229
|
category:
|
@@ -187,6 +258,24 @@ en:
|
|
187
258
|
deactivate: "Failed to deactivate scoring table"
|
188
259
|
destroy: "Failed to delete scoring table"
|
189
260
|
|
261
|
+
payment_request:
|
262
|
+
success:
|
263
|
+
index: "Payment requests retrieved successfully"
|
264
|
+
show: "Payment request details retrieved successfully"
|
265
|
+
create: "Payment request created successfully"
|
266
|
+
update: "Payment request updated successfully"
|
267
|
+
approve: "Payment request approved successfully"
|
268
|
+
eligible_credit_lines: "Eligible credit lines retrieved successfully"
|
269
|
+
destroy: "Payment request deleted successfully"
|
270
|
+
errors:
|
271
|
+
index: "Failed to retrieve payment requests"
|
272
|
+
show: "Failed to retrieve payment request details"
|
273
|
+
create: "Failed to create payment request"
|
274
|
+
update: "Failed to update payment request"
|
275
|
+
approve: "Failed to approve payment request"
|
276
|
+
eligible_credit_lines: "Failed to retrieve eligible credit lines"
|
277
|
+
destroy: "Failed to delete payment request"
|
278
|
+
|
190
279
|
# Global messages
|
191
280
|
operations:
|
192
281
|
success:
|
@@ -196,6 +285,34 @@ en:
|
|
196
285
|
failed: "Operation failed"
|
197
286
|
not_found: "Resource not found"
|
198
287
|
|
288
|
+
loan_profile:
|
289
|
+
success:
|
290
|
+
calculate_score: "Credit score calculated successfully"
|
291
|
+
errors:
|
292
|
+
calculate_score: "Failed to calculate credit score"
|
293
|
+
not_found: "Loan profile not found"
|
294
|
+
|
295
|
+
credit_limit_calculation:
|
296
|
+
success:
|
297
|
+
create: "Credit limits calculated successfully"
|
298
|
+
errors:
|
299
|
+
create: "Failed to calculate credit limits"
|
300
|
+
not_found: "Loan profile or category not found"
|
301
|
+
|
302
|
+
disbursement:
|
303
|
+
success:
|
304
|
+
create: "Disbursement processed successfully"
|
305
|
+
errors:
|
306
|
+
create: "Failed to process disbursement"
|
307
|
+
not_found: "Credit line or payment request not found"
|
308
|
+
|
309
|
+
repayment:
|
310
|
+
success:
|
311
|
+
create: "Repayment processed successfully"
|
312
|
+
errors:
|
313
|
+
create: "Failed to process repayment"
|
314
|
+
not_found: "Loan not found"
|
315
|
+
|
199
316
|
errors:
|
200
317
|
validation_failed: "Validation failed"
|
201
318
|
access_denied: "Access denied"
|
data/config/routes.rb
CHANGED
@@ -4,39 +4,66 @@ Dscf::Credit::Engine.routes.draw do
|
|
4
4
|
resources :bank_branches
|
5
5
|
resources :payments, only: [ :index, :show, :create, :update, :destroy ]
|
6
6
|
resources :loans, only: [ :index, :show, :create, :update, :destroy ]
|
7
|
+
resources :scoring_param_types
|
7
8
|
|
8
9
|
resources :facilitators, only: [ :index, :show, :create, :update, :destroy ] do
|
9
10
|
collection do
|
10
11
|
post "batch_create", to: "facilitators#batch_create"
|
12
|
+
post "additional_info", to: "facilitators#submit_additional_info"
|
11
13
|
end
|
12
14
|
member do
|
13
15
|
patch "approve", to: "facilitators#approve"
|
14
16
|
patch "reject", to: "facilitators#reject"
|
17
|
+
patch "request_modification", to: "facilitators#request_modification"
|
15
18
|
patch "set_limit", to: "facilitators#set_limit"
|
16
19
|
end
|
17
20
|
end
|
18
21
|
|
19
|
-
|
20
|
-
|
21
|
-
resources :loan_profiles, only: [ :index, :show, :create, :update, :destroy ] do
|
22
|
+
resources :loan_profiles do
|
22
23
|
member do
|
23
|
-
|
24
|
-
patch "
|
24
|
+
patch "approve"
|
25
|
+
patch "reject"
|
26
|
+
post "calculate_score"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
resources :payment_requests do
|
30
|
+
member do
|
31
|
+
patch "approve"
|
32
|
+
get "eligible_credit_lines"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
resources :scoring_parameters do
|
36
|
+
member do
|
37
|
+
patch "approve"
|
38
|
+
patch "reject"
|
39
|
+
patch "request_modification"
|
40
|
+
patch "resubmit"
|
25
41
|
end
|
26
42
|
end
|
27
|
-
|
28
|
-
resources :payment_requests
|
29
|
-
resources :scoring_parameters
|
30
43
|
resources :parameter_normalizers
|
31
|
-
resources :system_configs
|
44
|
+
resources :system_configs do
|
45
|
+
member do
|
46
|
+
patch "approve"
|
47
|
+
patch "reject"
|
48
|
+
patch "request_modification"
|
49
|
+
patch "resubmit"
|
50
|
+
end
|
51
|
+
end
|
32
52
|
resources :system_config_definitions
|
33
53
|
resources :credit_lines do
|
34
54
|
member do
|
35
|
-
patch "approve"
|
36
|
-
patch "reject"
|
55
|
+
patch "approve"
|
56
|
+
patch "reject"
|
57
|
+
patch "request_modification"
|
58
|
+
patch "resubmit"
|
37
59
|
end
|
38
60
|
end
|
39
61
|
resources :credit_line_specs
|
62
|
+
resources :eligible_credit_lines do
|
63
|
+
member do
|
64
|
+
patch "apply_risk", to: "eligible_credit_lines#apply_risk"
|
65
|
+
end
|
66
|
+
end
|
40
67
|
resources :categories
|
41
68
|
resources :scoring_tables do
|
42
69
|
member do
|
@@ -47,4 +74,8 @@ Dscf::Credit::Engine.routes.draw do
|
|
47
74
|
resources :users
|
48
75
|
resources :kyc_reviews, only: [ :index, :show ]
|
49
76
|
resources :bank_staffs
|
77
|
+
|
78
|
+
resources :credit_limit_calculations, only: [ :create ]
|
79
|
+
resources :disbursements, only: [ :create ]
|
80
|
+
resources :repayments, only: [ :create ]
|
50
81
|
end
|
@@ -4,12 +4,14 @@ class CreateDscfCreditCategories < ActiveRecord::Migration[8.0]
|
|
4
4
|
t.string :type, null: false
|
5
5
|
t.string :name, null: false
|
6
6
|
t.text :description
|
7
|
+
t.string :document_reference
|
7
8
|
|
8
9
|
t.timestamps
|
9
10
|
end
|
10
11
|
|
11
12
|
add_index :dscf_credit_categories, :type
|
12
13
|
add_index :dscf_credit_categories, :name
|
14
|
+
add_index :dscf_credit_categories, :document_reference
|
13
15
|
add_index :dscf_credit_categories, [ :type, :name ], unique: true
|
14
16
|
end
|
15
17
|
end
|
@@ -8,8 +8,10 @@ class CreateDscfCreditCreditLines < ActiveRecord::Migration[8.0]
|
|
8
8
|
t.text :description
|
9
9
|
t.string :status, default: 'pending'
|
10
10
|
t.references :created_by, polymorphic: true, null: false
|
11
|
-
t.references :
|
12
|
-
t.datetime :
|
11
|
+
t.references :reviewed_by, polymorphic: true, null: true
|
12
|
+
t.datetime :review_date
|
13
|
+
t.jsonb :review_feedback, default: {}
|
14
|
+
t.string :document_reference
|
13
15
|
|
14
16
|
t.timestamps
|
15
17
|
end
|
@@ -18,8 +20,9 @@ class CreateDscfCreditCreditLines < ActiveRecord::Migration[8.0]
|
|
18
20
|
add_index :dscf_credit_credit_lines, :code
|
19
21
|
add_index :dscf_credit_credit_lines, :status
|
20
22
|
add_index :dscf_credit_credit_lines, [ :created_by_type, :created_by_id ]
|
21
|
-
add_index :dscf_credit_credit_lines, [ :
|
22
|
-
add_index :dscf_credit_credit_lines, :
|
23
|
+
add_index :dscf_credit_credit_lines, [ :reviewed_by_type, :reviewed_by_id ]
|
24
|
+
add_index :dscf_credit_credit_lines, :review_date
|
25
|
+
add_index :dscf_credit_credit_lines, :document_reference
|
23
26
|
add_index :dscf_credit_credit_lines, [ :bank_id, :code ], unique: true
|
24
27
|
end
|
25
28
|
end
|
@@ -8,6 +8,7 @@ class CreateDscfCreditCreditLineSpecs < ActiveRecord::Migration[8.0]
|
|
8
8
|
t.decimal :penalty_rate, precision: 5, scale: 4, null: false
|
9
9
|
t.decimal :facilitation_fee_rate, precision: 5, scale: 4, null: false
|
10
10
|
t.decimal :tax_rate, precision: 5, scale: 4, null: false
|
11
|
+
t.decimal :credit_line_multiplier, precision: 5, scale: 2, null: false, default: 30.0
|
11
12
|
t.integer :max_penalty_days, null: false
|
12
13
|
t.integer :loan_duration, null: false
|
13
14
|
t.string :interest_frequency, null: false
|
@@ -5,13 +5,16 @@ class CreateDscfCreditSystemConfigs < ActiveRecord::Migration[8.0]
|
|
5
5
|
t.text :config_value, null: false
|
6
6
|
t.string :status, default: 'pending'
|
7
7
|
t.references :last_updated_by, polymorphic: true, null: false
|
8
|
-
t.references :
|
8
|
+
t.references :reviewed_by, polymorphic: true, null: false
|
9
|
+
t.datetime :review_date
|
10
|
+
t.jsonb :review_feedback, default: {}
|
9
11
|
|
10
12
|
t.timestamps
|
11
13
|
end
|
12
14
|
|
13
15
|
add_index :dscf_credit_system_configs, [ :last_updated_by_type, :last_updated_by_id ]
|
14
|
-
add_index :dscf_credit_system_configs, [ :
|
16
|
+
add_index :dscf_credit_system_configs, [ :reviewed_by_type, :reviewed_by_id ]
|
15
17
|
add_index :dscf_credit_system_configs, :status
|
18
|
+
add_index :dscf_credit_system_configs, :review_date
|
16
19
|
end
|
17
20
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class CreateDscfCreditScoringParamTypes < ActiveRecord::Migration[8.0]
|
2
|
+
def change
|
3
|
+
create_table :dscf_credit_scoring_param_types do |t|
|
4
|
+
t.string :name, null: false
|
5
|
+
t.text :description
|
6
|
+
|
7
|
+
t.timestamps
|
8
|
+
end
|
9
|
+
|
10
|
+
add_index :dscf_credit_scoring_param_types, :name, unique: true
|
11
|
+
end
|
12
|
+
end
|
@@ -5,26 +5,31 @@ class CreateDscfCreditScoringParameters < ActiveRecord::Migration[8.0]
|
|
5
5
|
t.string :name, null: false
|
6
6
|
t.text :description
|
7
7
|
t.string :data_type, null: false
|
8
|
-
t.string :type, null: false
|
9
8
|
t.decimal :weight, precision: 5, scale: 4, null: false
|
10
9
|
t.decimal :min_value, precision: 15, scale: 2
|
11
10
|
t.decimal :max_value, precision: 15, scale: 2
|
12
11
|
t.boolean :active, default: true
|
13
12
|
t.references :previous_version, foreign_key: { to_table: :dscf_credit_scoring_parameters }, null: true
|
14
13
|
t.references :created_by, polymorphic: true, null: false
|
15
|
-
t.references :
|
16
|
-
t.datetime :
|
14
|
+
t.references :reviewed_by, polymorphic: true, null: false
|
15
|
+
t.datetime :review_date
|
16
|
+
t.jsonb :review_feedback, default: {}
|
17
|
+
t.string :source
|
18
|
+
t.references :scoring_param_type, null: false, foreign_key: { to_table: :dscf_credit_scoring_param_types }
|
19
|
+
t.string :document_reference
|
20
|
+
t.string :status, default: 'pending'
|
17
21
|
|
18
22
|
t.timestamps
|
19
23
|
end
|
20
24
|
|
21
25
|
add_index :dscf_credit_scoring_parameters, :name
|
22
26
|
add_index :dscf_credit_scoring_parameters, :data_type
|
23
|
-
add_index :dscf_credit_scoring_parameters, :type
|
24
27
|
add_index :dscf_credit_scoring_parameters, :active
|
25
28
|
add_index :dscf_credit_scoring_parameters, [ :created_by_type, :created_by_id ]
|
26
|
-
add_index :dscf_credit_scoring_parameters, [ :
|
27
|
-
add_index :dscf_credit_scoring_parameters, :
|
29
|
+
add_index :dscf_credit_scoring_parameters, [ :reviewed_by_type, :reviewed_by_id ]
|
30
|
+
add_index :dscf_credit_scoring_parameters, :review_date
|
31
|
+
add_index :dscf_credit_scoring_parameters, :source
|
32
|
+
add_index :dscf_credit_scoring_parameters, :document_reference
|
28
33
|
add_index :dscf_credit_scoring_parameters, [ :bank_id, :name, :active ]
|
29
34
|
end
|
30
35
|
end
|
@@ -7,8 +7,10 @@ class CreateDscfCreditLoanProfiles < ActiveRecord::Migration[8.0]
|
|
7
7
|
t.string :status, default: 'pending'
|
8
8
|
t.decimal :total_amount, precision: 15, scale: 2, default: 0
|
9
9
|
t.decimal :available_amount, precision: 15, scale: 2, default: 0
|
10
|
-
t.references :
|
11
|
-
t.
|
10
|
+
t.references :reviewed_by, polymorphic: true
|
11
|
+
t.datetime :review_date
|
12
|
+
t.jsonb :review_feedback, default: {}
|
13
|
+
t.references :review_branch, null: true, foreign_key: { to_table: :dscf_credit_bank_branches }
|
12
14
|
|
13
15
|
t.timestamps
|
14
16
|
end
|
@@ -17,7 +19,8 @@ class CreateDscfCreditLoanProfiles < ActiveRecord::Migration[8.0]
|
|
17
19
|
add_index :dscf_credit_loan_profiles, :total_amount
|
18
20
|
add_index :dscf_credit_loan_profiles, :available_amount
|
19
21
|
add_index :dscf_credit_loan_profiles, [ :backer_type, :backer_id ]
|
20
|
-
add_index :dscf_credit_loan_profiles, [ :
|
22
|
+
add_index :dscf_credit_loan_profiles, [ :reviewed_by_type, :reviewed_by_id ]
|
23
|
+
add_index :dscf_credit_loan_profiles, :review_date
|
21
24
|
add_index :dscf_credit_loan_profiles, [ :bank_id, :user_id, :status ]
|
22
25
|
add_index :dscf_credit_loan_profiles, [ :user_id, :status ]
|
23
26
|
add_index :dscf_credit_loan_profiles, [ :total_amount, :available_amount ]
|
@@ -2,21 +2,19 @@ class CreateDscfCreditLoanProfileScoringSpecs < ActiveRecord::Migration[8.0]
|
|
2
2
|
def change
|
3
3
|
create_table :dscf_credit_loan_profile_scoring_specs do |t|
|
4
4
|
t.references :loan_profile, null: false, foreign_key: { to_table: :dscf_credit_loan_profiles }
|
5
|
-
t.jsonb :scoring_input_data
|
6
|
-
t.decimal :score, precision: 5, scale: 2
|
5
|
+
t.jsonb :scoring_input_data
|
6
|
+
t.decimal :score, precision: 5, scale: 2
|
7
|
+
t.decimal :total_limit, precision: 15, scale: 2
|
7
8
|
t.boolean :active, default: true
|
8
|
-
t.references :created_by, polymorphic: true
|
9
|
-
t.references :approved_by, polymorphic: true, null: false
|
10
|
-
t.datetime :expires_at
|
9
|
+
t.references :created_by, polymorphic: true
|
11
10
|
|
12
11
|
t.timestamps
|
13
12
|
end
|
14
13
|
|
15
14
|
add_index :dscf_credit_loan_profile_scoring_specs, :score
|
15
|
+
add_index :dscf_credit_loan_profile_scoring_specs, :total_limit
|
16
16
|
add_index :dscf_credit_loan_profile_scoring_specs, :active
|
17
17
|
add_index :dscf_credit_loan_profile_scoring_specs, [ :created_by_type, :created_by_id ]
|
18
|
-
add_index :dscf_credit_loan_profile_scoring_specs, [ :approved_by_type, :approved_by_id ]
|
19
|
-
add_index :dscf_credit_loan_profile_scoring_specs, :expires_at
|
20
18
|
add_index :dscf_credit_loan_profile_scoring_specs, :scoring_input_data, using: :gin
|
21
19
|
add_index :dscf_credit_loan_profile_scoring_specs, [ :loan_profile_id, :active ]
|
22
20
|
end
|
@@ -7,7 +7,9 @@ class CreateDscfCreditFacilitators < ActiveRecord::Migration[8.0]
|
|
7
7
|
t.string :type, null: false
|
8
8
|
t.decimal :total_limit, precision: 15, scale: 2
|
9
9
|
t.string :kyc_status, default: 'pending'
|
10
|
-
t.references :
|
10
|
+
t.references :kyc_reviewed_by, polymorphic: true, null: false
|
11
|
+
t.datetime :kyc_review_date
|
12
|
+
t.jsonb :review_feedback, default: {}
|
11
13
|
|
12
14
|
t.timestamps
|
13
15
|
end
|
@@ -15,7 +17,8 @@ class CreateDscfCreditFacilitators < ActiveRecord::Migration[8.0]
|
|
15
17
|
add_index :dscf_credit_facilitators, :name
|
16
18
|
add_index :dscf_credit_facilitators, :type
|
17
19
|
add_index :dscf_credit_facilitators, :kyc_status
|
18
|
-
add_index :dscf_credit_facilitators, [ :
|
20
|
+
add_index :dscf_credit_facilitators, [ :kyc_reviewed_by_type, :kyc_reviewed_by_id ]
|
21
|
+
add_index :dscf_credit_facilitators, :kyc_review_date
|
19
22
|
add_index :dscf_credit_facilitators, [ :bank_id, :user_id ], unique: true
|
20
23
|
add_index :dscf_credit_facilitators, [ :user_id, :kyc_status ]
|
21
24
|
end
|
@@ -9,7 +9,6 @@ class CreateDscfCreditFacilitatorPerformances < ActiveRecord::Migration[8.0]
|
|
9
9
|
t.integer :previous_performance_id
|
10
10
|
t.jsonb :input_data
|
11
11
|
t.references :created_by, polymorphic: true, null: false
|
12
|
-
t.datetime :expires_at
|
13
12
|
|
14
13
|
t.timestamps
|
15
14
|
end
|
@@ -19,8 +18,6 @@ class CreateDscfCreditFacilitatorPerformances < ActiveRecord::Migration[8.0]
|
|
19
18
|
add_index :dscf_credit_facilitator_performances, :total_outstanding_amount
|
20
19
|
add_index :dscf_credit_facilitator_performances, :approval_required
|
21
20
|
add_index :dscf_credit_facilitator_performances, [ :created_by_type, :created_by_id ]
|
22
|
-
add_index :dscf_credit_facilitator_performances, :expires_at
|
23
21
|
add_index :dscf_credit_facilitator_performances, :input_data, using: :gin
|
24
|
-
add_index :dscf_credit_facilitator_performances, [ :facilitator_id, :expires_at ]
|
25
22
|
end
|
26
23
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
class CreateDscfCreditScoringTables < ActiveRecord::Migration[8.0]
|
2
2
|
def change
|
3
3
|
create_table :dscf_credit_scoring_tables do |t|
|
4
|
-
t.references :
|
4
|
+
t.references :category, null: false, foreign_key: { to_table: :dscf_credit_categories }
|
5
5
|
t.references :scoring_parameter, null: false, foreign_key: { to_table: :dscf_credit_scoring_parameters }
|
6
6
|
t.decimal :weight, precision: 5, scale: 4, null: false
|
7
7
|
t.boolean :active, default: true
|
@@ -13,6 +13,6 @@ class CreateDscfCreditScoringTables < ActiveRecord::Migration[8.0]
|
|
13
13
|
add_index :dscf_credit_scoring_tables, :weight
|
14
14
|
add_index :dscf_credit_scoring_tables, :active
|
15
15
|
add_index :dscf_credit_scoring_tables, [ :created_by_type, :created_by_id ]
|
16
|
-
add_index :dscf_credit_scoring_tables, [ :
|
16
|
+
add_index :dscf_credit_scoring_tables, [ :category_id, :scoring_parameter_id ], unique: true, name: 'index_scoring_tables_on_category_and_scoring_parameter'
|
17
17
|
end
|
18
18
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class CreateDscfCreditEligibleCreditLines < ActiveRecord::Migration[8.0]
|
2
|
+
def change
|
3
|
+
create_table :dscf_credit_eligible_credit_lines do |t|
|
4
|
+
t.references :loan_profile, null: false, foreign_key: { to_table: :dscf_credit_loan_profiles }
|
5
|
+
t.references :credit_line, null: false, foreign_key: { to_table: :dscf_credit_credit_lines }
|
6
|
+
t.decimal :credit_limit, precision: 15, scale: 2, null: false
|
7
|
+
t.decimal :available_limit, precision: 15, scale: 2, null: false
|
8
|
+
t.decimal :risk, precision: 5, scale: 4, null: true
|
9
|
+
|
10
|
+
t.timestamps
|
11
|
+
end
|
12
|
+
|
13
|
+
add_index :dscf_credit_eligible_credit_lines, [ :loan_profile_id, :credit_line_id ]
|
14
|
+
add_index :dscf_credit_eligible_credit_lines, :credit_limit
|
15
|
+
add_index :dscf_credit_eligible_credit_lines, :available_limit
|
16
|
+
add_index :dscf_credit_eligible_credit_lines, :risk
|
17
|
+
end
|
18
|
+
end
|