dscf-credit 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/MIT-LICENSE +20 -0
- data/README.md +28 -0
- data/Rakefile +8 -0
- data/app/controllers/dscf/credit/application_controller.rb +8 -0
- data/app/controllers/dscf/credit/bank_branches_controller.rb +38 -0
- data/app/controllers/dscf/credit/bank_staffs_controller.rb +77 -0
- data/app/controllers/dscf/credit/banks_controller.rb +39 -0
- data/app/controllers/dscf/credit/categories_controller.rb +32 -0
- data/app/controllers/dscf/credit/credit_line_specs_controller.rb +72 -0
- data/app/controllers/dscf/credit/credit_lines_controller.rb +76 -0
- data/app/controllers/dscf/credit/facilitators_controller.rb +227 -0
- data/app/controllers/dscf/credit/loans_controller.rb +41 -0
- data/app/controllers/dscf/credit/parameter_normalizers_controller.rb +31 -0
- data/app/controllers/dscf/credit/payment_requests_controller.rb +38 -0
- data/app/controllers/dscf/credit/payments_controller.rb +36 -0
- data/app/controllers/dscf/credit/scoring_parameters_controller.rb +50 -0
- data/app/controllers/dscf/credit/scoring_tables_controller.rb +63 -0
- data/app/controllers/dscf/credit/system_config_definitions_controller.rb +34 -0
- data/app/controllers/dscf/credit/system_configs_controller.rb +49 -0
- data/app/controllers/dscf/credit/users_controller.rb +53 -0
- data/app/jobs/dscf/credit/application_job.rb +6 -0
- data/app/mailers/dscf/credit/application_mailer.rb +8 -0
- data/app/mailers/dscf/credit/bank_staff_welcome_mailer.rb +15 -0
- data/app/mailers/dscf/credit/facilitator_mailer.rb +54 -0
- data/app/models/dscf/credit/accounting_audit_request.rb +17 -0
- data/app/models/dscf/credit/accounting_entry.rb +15 -0
- data/app/models/dscf/credit/application_record.rb +7 -0
- data/app/models/dscf/credit/bank.rb +38 -0
- data/app/models/dscf/credit/bank_branch.rb +23 -0
- data/app/models/dscf/credit/bank_staff.rb +26 -0
- data/app/models/dscf/credit/category.rb +21 -0
- data/app/models/dscf/credit/credit_line.rb +30 -0
- data/app/models/dscf/credit/credit_line_spec.rb +37 -0
- data/app/models/dscf/credit/daily_routine_transaction.rb +18 -0
- data/app/models/dscf/credit/facilitator.rb +31 -0
- data/app/models/dscf/credit/facilitator_performance.rb +17 -0
- data/app/models/dscf/credit/failed_operations_log.rb +17 -0
- data/app/models/dscf/credit/loan.rb +33 -0
- data/app/models/dscf/credit/loan_profile.rb +43 -0
- data/app/models/dscf/credit/loan_profile_scoring_spec.rb +23 -0
- data/app/models/dscf/credit/loan_transaction.rb +17 -0
- data/app/models/dscf/credit/parameter_normalizer.rb +11 -0
- data/app/models/dscf/credit/payment.rb +22 -0
- data/app/models/dscf/credit/payment_request.rb +29 -0
- data/app/models/dscf/credit/scoring_parameter.rb +30 -0
- data/app/models/dscf/credit/scoring_table.rb +24 -0
- data/app/models/dscf/credit/system_config.rb +25 -0
- data/app/models/dscf/credit/system_config_definition.rb +25 -0
- data/app/serializers/dscf/core/business_serializer.rb +9 -0
- data/app/serializers/dscf/core/business_type_serializer.rb +7 -0
- data/app/serializers/dscf/core/role_serializer.rb +7 -0
- data/app/serializers/dscf/core/user_profile_serializer.rb +13 -0
- data/app/serializers/dscf/core/user_role_serializer.rb +16 -0
- data/app/serializers/dscf/core/user_serializer.rb +17 -0
- data/app/serializers/dscf/credit/bank_branch_serializer.rb +9 -0
- data/app/serializers/dscf/credit/bank_serializer.rb +9 -0
- data/app/serializers/dscf/credit/bank_staff_serializer.rb +8 -0
- data/app/serializers/dscf/credit/category_serializer.rb +7 -0
- data/app/serializers/dscf/credit/credit_line_serializer.rb +12 -0
- data/app/serializers/dscf/credit/credit_line_spec_serializer.rb +12 -0
- data/app/serializers/dscf/credit/parameter_normalizer_serializer.rb +8 -0
- data/app/serializers/dscf/credit/scoring_parameter_serializer.rb +12 -0
- data/app/serializers/dscf/credit/scoring_table_serializer.rb +9 -0
- data/app/serializers/dscf/credit/system_config_definition_serializer.rb +9 -0
- data/app/serializers/dscf/credit/system_config_serializer.rb +18 -0
- data/app/services/dscf/credit/bank_staff_creation_service.rb +99 -0
- data/app/services/dscf/credit/facilitator_additional_info_service.rb +62 -0
- data/app/services/dscf/credit/facilitator_approval_service.rb +88 -0
- data/app/views/dscf/credit/bank_staff_welcome_mailer/welcome_email.html.erb +116 -0
- data/app/views/dscf/credit/bank_staff_welcome_mailer/welcome_email.text.erb +40 -0
- data/app/views/dscf/credit/facilitator_mailer/additional_info_received.html.erb +39 -0
- data/app/views/dscf/credit/facilitator_mailer/additional_info_received.text.erb +17 -0
- data/app/views/dscf/credit/facilitator_mailer/approval_notification.html.erb +59 -0
- data/app/views/dscf/credit/facilitator_mailer/approval_notification.text.erb +26 -0
- data/app/views/dscf/credit/facilitator_mailer/limit_update_notification.html.erb +39 -0
- data/app/views/dscf/credit/facilitator_mailer/limit_update_notification.text.erb +17 -0
- data/app/views/dscf/credit/facilitator_mailer/rejection_notification.html.erb +41 -0
- data/app/views/dscf/credit/facilitator_mailer/rejection_notification.text.erb +19 -0
- data/app/views/layouts/mailer.html.erb +125 -0
- data/app/views/layouts/mailer.text.erb +12 -0
- data/config/locales/en.yml +208 -0
- data/config/routes.rb +50 -0
- data/db/migrate/20250822091011_create_dscf_credit_categories.rb +15 -0
- data/db/migrate/20250822091015_create_dscf_credit_banks.rb +23 -0
- data/db/migrate/20250822091055_create_dscf_credit_bank_branches.rb +23 -0
- data/db/migrate/20250822091131_create_dscf_credit_credit_lines.rb +25 -0
- data/db/migrate/20250822091527_create_dscf_credit_credit_line_specs.rb +32 -0
- data/db/migrate/20250822091744_create_dscf_credit_system_config_definitions.rb +18 -0
- data/db/migrate/20250822091820_create_dscf_credit_system_configs.rb +17 -0
- data/db/migrate/20250822092050_create_dscf_credit_scoring_parameters.rb +30 -0
- data/db/migrate/20250822092225_create_dscf_credit_parameter_normalizers.rb +18 -0
- data/db/migrate/20250822092246_create_dscf_credit_loan_profiles.rb +25 -0
- data/db/migrate/20250822092417_create_dscf_credit_loan_profile_scoring_specs.rb +23 -0
- data/db/migrate/20250822092436_create_dscf_credit_facilitators.rb +22 -0
- data/db/migrate/20250822092528_create_dscf_credit_facilitator_performances.rb +26 -0
- data/db/migrate/20250822092608_create_dscf_credit_payment_requests.rb +26 -0
- data/db/migrate/20250822092654_create_dscf_credit_loans.rb +29 -0
- data/db/migrate/20250822092717_create_dscf_credit_loan_transactions.rb +21 -0
- data/db/migrate/20250822092738_create_dscf_credit_daily_routine_transactions.rb +23 -0
- data/db/migrate/20250822092819_create_dscf_credit_accounting_audit_requests.rb +20 -0
- data/db/migrate/20250822092843_create_dscf_credit_payments.rb +23 -0
- data/db/migrate/20250822092908_create_dscf_credit_failed_operations_logs.rb +21 -0
- data/db/migrate/20250822092936_create_dscf_credit_accounting_entries.rb +21 -0
- data/db/migrate/20250825231109_create_dscf_credit_bank_staff.rb +14 -0
- data/db/migrate/20250901172842_create_dscf_credit_scoring_tables.rb +18 -0
- data/db/seeds.rb +745 -0
- data/lib/dscf/credit/engine.rb +28 -0
- data/lib/dscf/credit/version.rb +5 -0
- data/lib/dscf/credit.rb +9 -0
- data/lib/tasks/dscf/credit_tasks.rake +4 -0
- data/spec/factories/dscf/credit/accounting_audit_requests.rb +58 -0
- data/spec/factories/dscf/credit/accounting_entries.rb +29 -0
- data/spec/factories/dscf/credit/bank_branches.rb +21 -0
- data/spec/factories/dscf/credit/bank_staffs.rb +19 -0
- data/spec/factories/dscf/credit/banks.rb +30 -0
- data/spec/factories/dscf/credit/categories.rb +27 -0
- data/spec/factories/dscf/credit/credit_line_specs.rb +57 -0
- data/spec/factories/dscf/credit/credit_lines.rb +32 -0
- data/spec/factories/dscf/credit/daily_routine_transactions.rb +36 -0
- data/spec/factories/dscf/credit/facilitator_performances.rb +30 -0
- data/spec/factories/dscf/credit/facilitators.rb +35 -0
- data/spec/factories/dscf/credit/failed_operations_logs.rb +34 -0
- data/spec/factories/dscf/credit/loan_profile_scoring_specs.rb +31 -0
- data/spec/factories/dscf/credit/loan_profiles.rb +49 -0
- data/spec/factories/dscf/credit/loan_transactions.rb +37 -0
- data/spec/factories/dscf/credit/loans.rb +37 -0
- data/spec/factories/dscf/credit/parameter_normalizers.rb +24 -0
- data/spec/factories/dscf/credit/payment_requests.rb +40 -0
- data/spec/factories/dscf/credit/payments.rb +39 -0
- data/spec/factories/dscf/credit/scoring_parameters.rb +48 -0
- data/spec/factories/dscf/credit/scoring_tables.rb +25 -0
- data/spec/factories/dscf/credit/system_config_definitions.rb +45 -0
- data/spec/factories/dscf/credit/system_configs.rb +29 -0
- metadata +456 -0
@@ -0,0 +1,125 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
7
|
+
<title>DSCF Credit System</title>
|
8
|
+
<style>
|
9
|
+
body {
|
10
|
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
11
|
+
line-height: 1.6;
|
12
|
+
color: #333;
|
13
|
+
max-width: 600px;
|
14
|
+
margin: 0 auto;
|
15
|
+
padding: 20px;
|
16
|
+
background-color: #f8f9fa;
|
17
|
+
}
|
18
|
+
|
19
|
+
.email-container {
|
20
|
+
background-color: #ffffff;
|
21
|
+
border-radius: 8px;
|
22
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
23
|
+
overflow: hidden;
|
24
|
+
}
|
25
|
+
|
26
|
+
.email-header {
|
27
|
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
28
|
+
color: white;
|
29
|
+
padding: 30px 20px;
|
30
|
+
text-align: center;
|
31
|
+
}
|
32
|
+
|
33
|
+
.email-header h1 {
|
34
|
+
margin: 0;
|
35
|
+
font-size: 24px;
|
36
|
+
font-weight: 600;
|
37
|
+
}
|
38
|
+
|
39
|
+
.email-body {
|
40
|
+
padding: 30px 20px;
|
41
|
+
}
|
42
|
+
|
43
|
+
.email-footer {
|
44
|
+
background-color: #f8f9fa;
|
45
|
+
padding: 20px;
|
46
|
+
text-align: center;
|
47
|
+
font-size: 12px;
|
48
|
+
color: #6c757d;
|
49
|
+
border-top: 1px solid #dee2e6;
|
50
|
+
}
|
51
|
+
|
52
|
+
.button {
|
53
|
+
display: inline-block;
|
54
|
+
padding: 12px 24px;
|
55
|
+
background-color: #007bff;
|
56
|
+
color: white;
|
57
|
+
text-decoration: none;
|
58
|
+
border-radius: 5px;
|
59
|
+
font-weight: 500;
|
60
|
+
margin: 15px 0;
|
61
|
+
transition: background-color 0.3s ease;
|
62
|
+
}
|
63
|
+
|
64
|
+
.button:hover {
|
65
|
+
background-color: #0056b3;
|
66
|
+
}
|
67
|
+
|
68
|
+
.alert {
|
69
|
+
padding: 12px 16px;
|
70
|
+
border-radius: 4px;
|
71
|
+
margin: 15px 0;
|
72
|
+
}
|
73
|
+
|
74
|
+
.alert-info {
|
75
|
+
background-color: #d1ecf1;
|
76
|
+
border: 1px solid #bee5eb;
|
77
|
+
color: #0c5460;
|
78
|
+
}
|
79
|
+
|
80
|
+
.alert-success {
|
81
|
+
background-color: #d4edda;
|
82
|
+
border: 1px solid #c3e6cb;
|
83
|
+
color: #155724;
|
84
|
+
}
|
85
|
+
|
86
|
+
.highlight {
|
87
|
+
background-color: #fff3cd;
|
88
|
+
padding: 2px 4px;
|
89
|
+
border-radius: 3px;
|
90
|
+
font-weight: 500;
|
91
|
+
}
|
92
|
+
|
93
|
+
ul {
|
94
|
+
padding-left: 20px;
|
95
|
+
}
|
96
|
+
|
97
|
+
li {
|
98
|
+
margin-bottom: 8px;
|
99
|
+
}
|
100
|
+
</style>
|
101
|
+
</head>
|
102
|
+
<body>
|
103
|
+
<div class="email-container">
|
104
|
+
<div class="email-header">
|
105
|
+
<h1>DSCF Credit System</h1>
|
106
|
+
</div>
|
107
|
+
|
108
|
+
<div class="email-body">
|
109
|
+
<%= yield %>
|
110
|
+
</div>
|
111
|
+
|
112
|
+
<div class="email-footer">
|
113
|
+
<p>
|
114
|
+
<strong>DSCF Credit System</strong><br>
|
115
|
+
Digital Supply Chain Finance Platform<br>
|
116
|
+
This is an automated email. Please do not reply to this message.
|
117
|
+
</p>
|
118
|
+
<p>
|
119
|
+
For support, contact us at:
|
120
|
+
<a href="mailto:support@dscf-credit.com">support@dscf-credit.com</a>
|
121
|
+
</p>
|
122
|
+
</div>
|
123
|
+
</div>
|
124
|
+
</body>
|
125
|
+
</html>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
===============================================================================
|
2
|
+
DSCF CREDIT SYSTEM
|
3
|
+
===============================================================================
|
4
|
+
|
5
|
+
<%= yield %>
|
6
|
+
|
7
|
+
===============================================================================
|
8
|
+
DSCF Credit System - Digital Supply Chain Finance Platform
|
9
|
+
This is an automated email. Please do not reply to this message.
|
10
|
+
|
11
|
+
For support, contact us at: support@dscf-credit.com
|
12
|
+
===============================================================================
|
@@ -0,0 +1,208 @@
|
|
1
|
+
en:
|
2
|
+
bank:
|
3
|
+
success:
|
4
|
+
show: "Bank details retrieved successfully"
|
5
|
+
create: "Bank created successfully"
|
6
|
+
update: "Bank updated successfully"
|
7
|
+
activate: "Bank activated successfully"
|
8
|
+
deactivate: "Bank deactivated successfully"
|
9
|
+
errors:
|
10
|
+
create: "Failed to create bank"
|
11
|
+
update: "Failed to update bank"
|
12
|
+
show: "Failed to retrieve bank details"
|
13
|
+
activate: "Failed to activate bank"
|
14
|
+
deactivate: "Failed to deactivate bank"
|
15
|
+
|
16
|
+
bank_branch:
|
17
|
+
success:
|
18
|
+
index: "Bank branches retrieved successfully"
|
19
|
+
show: "Bank branch details retrieved successfully"
|
20
|
+
create: "Bank branch created successfully"
|
21
|
+
update: "Bank branch updated successfully"
|
22
|
+
destroy: "Bank branch deleted successfully"
|
23
|
+
errors:
|
24
|
+
index: "Failed to retrieve bank branches"
|
25
|
+
show: "Failed to retrieve bank branch details"
|
26
|
+
create: "Failed to create bank branch"
|
27
|
+
update: "Failed to update bank branch"
|
28
|
+
destroy: "Failed to delete bank branch"
|
29
|
+
|
30
|
+
bank_staff:
|
31
|
+
success:
|
32
|
+
index: "Bank staff retrieved successfully"
|
33
|
+
show: "Bank staff details retrieved successfully"
|
34
|
+
create: "Bank staff created successfully"
|
35
|
+
update: "Bank staff updated successfully"
|
36
|
+
destroy: "Bank staff removed successfully"
|
37
|
+
errors:
|
38
|
+
index: "Failed to retrieve bank staff"
|
39
|
+
show: "Failed to retrieve bank staff details"
|
40
|
+
create: "Failed to create bank staff"
|
41
|
+
update: "Failed to update bank staff"
|
42
|
+
destroy: "Failed to remove bank staff"
|
43
|
+
|
44
|
+
scoring_parameter:
|
45
|
+
success:
|
46
|
+
index: "Scoring parameters retrieved successfully"
|
47
|
+
show: "Scoring parameter details retrieved successfully"
|
48
|
+
create: "Scoring parameter created successfully"
|
49
|
+
update: "Scoring parameter updated successfully"
|
50
|
+
destroy: "Scoring parameter deleted successfully"
|
51
|
+
errors:
|
52
|
+
index: "Failed to retrieve scoring parameters"
|
53
|
+
show: "Failed to retrieve scoring parameter details"
|
54
|
+
create: "Failed to create scoring parameter"
|
55
|
+
update: "Failed to update scoring parameter"
|
56
|
+
destroy: "Failed to delete scoring parameter"
|
57
|
+
|
58
|
+
parameter_normalizer:
|
59
|
+
success:
|
60
|
+
index: "Parameter normalizers retrieved successfully"
|
61
|
+
show: "Parameter normalizer details retrieved successfully"
|
62
|
+
create: "Parameter normalizer created successfully"
|
63
|
+
update: "Parameter normalizer updated successfully"
|
64
|
+
destroy: "Parameter normalizer deleted successfully"
|
65
|
+
errors:
|
66
|
+
index: "Failed to retrieve parameter normalizers"
|
67
|
+
show: "Failed to retrieve parameter normalizer details"
|
68
|
+
create: "Failed to create parameter normalizer"
|
69
|
+
update: "Failed to update parameter normalizer"
|
70
|
+
destroy: "Failed to delete parameter normalizer"
|
71
|
+
|
72
|
+
facilitator:
|
73
|
+
success:
|
74
|
+
index: "Facilitators retrieved successfully"
|
75
|
+
show: "Facilitator details retrieved successfully"
|
76
|
+
create: "Facilitator created successfully"
|
77
|
+
update: "Facilitator updated successfully"
|
78
|
+
approved: "Facilitator approved successfully"
|
79
|
+
rejected: "Facilitator rejected successfully"
|
80
|
+
limit_updated: "Facilitator limit updated successfully"
|
81
|
+
additional_info_submitted: "Additional information submitted successfully"
|
82
|
+
batch_created_all: "All facilitators created successfully"
|
83
|
+
batch_created_partial: "Batch processing completed with partial success"
|
84
|
+
errors:
|
85
|
+
create: "Failed to create facilitator"
|
86
|
+
update: "Failed to update facilitator"
|
87
|
+
show: "Failed to retrieve facilitator details"
|
88
|
+
approval_failed: "Failed to approve facilitator"
|
89
|
+
rejection_failed: "Failed to reject facilitator"
|
90
|
+
limit_update_failed: "Failed to update facilitator limit"
|
91
|
+
additional_info_failed: "Failed to submit additional information"
|
92
|
+
no_business: "User must have a business associated to become a facilitator"
|
93
|
+
invalid_batch_format: "Invalid batch format"
|
94
|
+
empty_batch: "Empty batch provided"
|
95
|
+
batch_too_large: "Batch size exceeds maximum allowed"
|
96
|
+
batch_failed_all: "All facilitators failed to create"
|
97
|
+
|
98
|
+
credit_line_spec:
|
99
|
+
success:
|
100
|
+
index: "Credit line specifications retrieved successfully"
|
101
|
+
show: "Credit line specification details retrieved successfully"
|
102
|
+
create: "Credit line specification created successfully"
|
103
|
+
update: "Credit line specification updated successfully"
|
104
|
+
destroy: "Credit line specification deleted successfully"
|
105
|
+
errors:
|
106
|
+
index: "Failed to retrieve credit line specifications"
|
107
|
+
show: "Failed to retrieve credit line specification details"
|
108
|
+
create: "Failed to create credit line specification"
|
109
|
+
update: "Failed to update credit line specification"
|
110
|
+
destroy: "Failed to delete credit line specification"
|
111
|
+
|
112
|
+
credit_line:
|
113
|
+
success:
|
114
|
+
index: "Credit lines retrieved successfully"
|
115
|
+
show: "Credit line details retrieved successfully"
|
116
|
+
create: "Credit line created successfully"
|
117
|
+
update: "Credit line updated successfully"
|
118
|
+
approve: "Credit line approved successfully"
|
119
|
+
reject: "Credit line rejected successfully"
|
120
|
+
destroy: "Credit line deleted successfully"
|
121
|
+
errors:
|
122
|
+
index: "Failed to retrieve credit lines"
|
123
|
+
show: "Failed to retrieve credit line details"
|
124
|
+
create: "Failed to create credit line"
|
125
|
+
update: "Failed to update credit line"
|
126
|
+
approve: "Failed to approve credit line"
|
127
|
+
reject: "Failed to reject credit line"
|
128
|
+
destroy: "Failed to delete credit line"
|
129
|
+
|
130
|
+
system_config_definition:
|
131
|
+
success:
|
132
|
+
index: "System config definitions retrieved successfully"
|
133
|
+
show: "System config definition details retrieved successfully"
|
134
|
+
create: "System config definition created successfully"
|
135
|
+
update: "System config definition updated successfully"
|
136
|
+
destroy: "System config definition deleted successfully"
|
137
|
+
errors:
|
138
|
+
index: "Failed to retrieve system config definitions"
|
139
|
+
show: "Failed to retrieve system config definition details"
|
140
|
+
create: "Failed to create system config definition"
|
141
|
+
update: "Failed to update system config definition"
|
142
|
+
destroy: "Failed to delete system config definition"
|
143
|
+
|
144
|
+
system_config:
|
145
|
+
success:
|
146
|
+
index: "System configs retrieved successfully"
|
147
|
+
show: "System config details retrieved successfully"
|
148
|
+
create: "System config created successfully"
|
149
|
+
update: "System config updated successfully"
|
150
|
+
destroy: "System config deleted successfully"
|
151
|
+
errors:
|
152
|
+
index: "Failed to retrieve system configs"
|
153
|
+
show: "Failed to retrieve system config details"
|
154
|
+
create: "Failed to create system config"
|
155
|
+
update: "Failed to update system config"
|
156
|
+
destroy: "Failed to delete system config"
|
157
|
+
|
158
|
+
category:
|
159
|
+
success:
|
160
|
+
index: "Categories retrieved successfully"
|
161
|
+
show: "Category details retrieved successfully"
|
162
|
+
create: "Category created successfully"
|
163
|
+
update: "Category updated successfully"
|
164
|
+
destroy: "Category deleted successfully"
|
165
|
+
errors:
|
166
|
+
index: "Failed to retrieve categories"
|
167
|
+
show: "Failed to retrieve category details"
|
168
|
+
create: "Failed to create category"
|
169
|
+
update: "Failed to update category"
|
170
|
+
destroy: "Failed to delete category"
|
171
|
+
|
172
|
+
scoring_table:
|
173
|
+
success:
|
174
|
+
index: "Scoring tables retrieved successfully"
|
175
|
+
show: "Scoring table details retrieved successfully"
|
176
|
+
create: "Scoring table created successfully"
|
177
|
+
update: "Scoring table updated successfully"
|
178
|
+
activate: "Scoring table activated successfully"
|
179
|
+
deactivate: "Scoring table deactivated successfully"
|
180
|
+
destroy: "Scoring table deleted successfully"
|
181
|
+
errors:
|
182
|
+
index: "Failed to retrieve scoring tables"
|
183
|
+
show: "Failed to retrieve scoring table details"
|
184
|
+
create: "Failed to create scoring table"
|
185
|
+
update: "Failed to update scoring table"
|
186
|
+
activate: "Failed to activate scoring table"
|
187
|
+
deactivate: "Failed to deactivate scoring table"
|
188
|
+
destroy: "Failed to delete scoring table"
|
189
|
+
|
190
|
+
# Global messages
|
191
|
+
operations:
|
192
|
+
success:
|
193
|
+
completed: "Operation completed successfully"
|
194
|
+
processed: "Request processed successfully"
|
195
|
+
errors:
|
196
|
+
failed: "Operation failed"
|
197
|
+
not_found: "Resource not found"
|
198
|
+
|
199
|
+
errors:
|
200
|
+
validation_failed: "Validation failed"
|
201
|
+
access_denied: "Access denied"
|
202
|
+
internal_server_error: "An unexpected error occurred"
|
203
|
+
operation_failed: "Operation failed"
|
204
|
+
record_not_found: "Record not found"
|
205
|
+
unauthorized: "You are not authorized to perform this action"
|
206
|
+
forbidden: "Access to this resource is forbidden"
|
207
|
+
bad_request: "Invalid request"
|
208
|
+
unprocessable_entity: "The request could not be processed"
|
data/config/routes.rb
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
Dscf::Credit::Engine.routes.draw do
|
2
|
+
# Main API endpoints
|
3
|
+
resources :banks, only: [ :index, :show, :create, :update, :destroy ]
|
4
|
+
resources :bank_branches
|
5
|
+
resources :payments, only: [ :index, :show, :create, :update, :destroy ]
|
6
|
+
resources :loans, only: [ :index, :show, :create, :update, :destroy ]
|
7
|
+
|
8
|
+
resources :facilitators, only: [ :index, :show, :create, :update, :destroy ] do
|
9
|
+
collection do
|
10
|
+
post "batch_create", to: "facilitators#batch_create"
|
11
|
+
end
|
12
|
+
member do
|
13
|
+
patch "approve", to: "facilitators#approve"
|
14
|
+
patch "reject", to: "facilitators#reject"
|
15
|
+
patch "set_limit", to: "facilitators#set_limit"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
post "facilitators/additional_info", to: "facilitators#submit_additional_info"
|
20
|
+
|
21
|
+
resources :loan_profiles, only: [ :index, :show, :create, :update, :destroy ] do
|
22
|
+
member do
|
23
|
+
get "kyc_review", to: "kyc_reviews#show"
|
24
|
+
patch "kyc_review", to: "kyc_reviews#update"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
resources :payment_requests
|
29
|
+
resources :scoring_parameters
|
30
|
+
resources :parameter_normalizers
|
31
|
+
resources :system_configs
|
32
|
+
resources :system_config_definitions
|
33
|
+
resources :credit_lines do
|
34
|
+
member do
|
35
|
+
patch "approve", to: "credit_lines#approve"
|
36
|
+
patch "reject", to: "credit_lines#reject"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
resources :credit_line_specs
|
40
|
+
resources :categories
|
41
|
+
resources :scoring_tables do
|
42
|
+
member do
|
43
|
+
patch "activate", to: "scoring_tables#activate"
|
44
|
+
patch "deactivate", to: "scoring_tables#deactivate"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
resources :users
|
48
|
+
resources :kyc_reviews, only: [ :index, :show ]
|
49
|
+
resources :bank_staffs
|
50
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class CreateDscfCreditCategories < ActiveRecord::Migration[8.0]
|
2
|
+
def change
|
3
|
+
create_table :dscf_credit_categories do |t|
|
4
|
+
t.string :type, null: false
|
5
|
+
t.string :name, null: false
|
6
|
+
t.text :description
|
7
|
+
|
8
|
+
t.timestamps
|
9
|
+
end
|
10
|
+
|
11
|
+
add_index :dscf_credit_categories, :type
|
12
|
+
add_index :dscf_credit_categories, :name
|
13
|
+
add_index :dscf_credit_categories, [ :type, :name ], unique: true
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class CreateDscfCreditBanks < ActiveRecord::Migration[8.0]
|
2
|
+
def change
|
3
|
+
create_table :dscf_credit_banks do |t|
|
4
|
+
t.references :user, null: true, foreign_key: { to_table: :dscf_core_users }
|
5
|
+
t.string :name, null: false
|
6
|
+
t.string :registration_number
|
7
|
+
t.string :swift_code
|
8
|
+
t.text :headquarters_address
|
9
|
+
t.string :city
|
10
|
+
t.string :country
|
11
|
+
t.string :contact_email
|
12
|
+
t.string :contact_phone
|
13
|
+
t.string :status, default: 'active'
|
14
|
+
|
15
|
+
t.timestamps
|
16
|
+
end
|
17
|
+
|
18
|
+
add_index :dscf_credit_banks, :name
|
19
|
+
add_index :dscf_credit_banks, :registration_number, unique: true
|
20
|
+
add_index :dscf_credit_banks, :swift_code, unique: true
|
21
|
+
add_index :dscf_credit_banks, :status
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class CreateDscfCreditBankBranches < ActiveRecord::Migration[8.0]
|
2
|
+
def change
|
3
|
+
create_table :dscf_credit_bank_branches do |t|
|
4
|
+
t.references :bank, null: false, foreign_key: { to_table: :dscf_credit_banks }
|
5
|
+
t.string :branch_name, null: false
|
6
|
+
t.string :branch_code
|
7
|
+
t.text :branch_address
|
8
|
+
t.string :city
|
9
|
+
t.string :country
|
10
|
+
t.string :contact_email
|
11
|
+
t.string :contact_phone
|
12
|
+
t.string :status, default: 'active'
|
13
|
+
|
14
|
+
t.timestamps
|
15
|
+
end
|
16
|
+
|
17
|
+
add_index :dscf_credit_bank_branches, :branch_name
|
18
|
+
add_index :dscf_credit_bank_branches, :branch_code
|
19
|
+
add_index :dscf_credit_bank_branches, :status
|
20
|
+
add_index :dscf_credit_bank_branches, [ :bank_id, :branch_name ], unique: true
|
21
|
+
add_index :dscf_credit_bank_branches, [ :bank_id, :branch_code ], unique: true
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
class CreateDscfCreditCreditLines < ActiveRecord::Migration[8.0]
|
2
|
+
def change
|
3
|
+
create_table :dscf_credit_credit_lines do |t|
|
4
|
+
t.references :bank, null: false, foreign_key: { to_table: :dscf_credit_banks }
|
5
|
+
t.references :category, null: false, foreign_key: { to_table: :dscf_credit_categories }
|
6
|
+
t.string :name, null: false
|
7
|
+
t.string :code
|
8
|
+
t.text :description
|
9
|
+
t.string :status, default: 'pending'
|
10
|
+
t.references :created_by, polymorphic: true, null: false
|
11
|
+
t.references :approved_by, polymorphic: true, null: true
|
12
|
+
t.datetime :approval_date
|
13
|
+
|
14
|
+
t.timestamps
|
15
|
+
end
|
16
|
+
|
17
|
+
add_index :dscf_credit_credit_lines, :name
|
18
|
+
add_index :dscf_credit_credit_lines, :code
|
19
|
+
add_index :dscf_credit_credit_lines, :status
|
20
|
+
add_index :dscf_credit_credit_lines, [ :created_by_type, :created_by_id ]
|
21
|
+
add_index :dscf_credit_credit_lines, [ :approved_by_type, :approved_by_id ]
|
22
|
+
add_index :dscf_credit_credit_lines, :approval_date
|
23
|
+
add_index :dscf_credit_credit_lines, [ :bank_id, :code ], unique: true
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
class CreateDscfCreditCreditLineSpecs < ActiveRecord::Migration[8.0]
|
2
|
+
def change
|
3
|
+
create_table :dscf_credit_credit_line_specs do |t|
|
4
|
+
t.references :credit_line, null: false, foreign_key: { to_table: :dscf_credit_credit_lines }
|
5
|
+
t.decimal :min_amount, precision: 15, scale: 2, null: false
|
6
|
+
t.decimal :max_amount, precision: 15, scale: 2, null: false
|
7
|
+
t.decimal :interest_rate, precision: 5, scale: 4, null: false
|
8
|
+
t.decimal :penalty_rate, precision: 5, scale: 4, null: false
|
9
|
+
t.decimal :facilitation_fee_rate, precision: 5, scale: 4, null: false
|
10
|
+
t.decimal :tax_rate, precision: 5, scale: 4, null: false
|
11
|
+
t.integer :max_penalty_days, null: false
|
12
|
+
t.integer :loan_duration, null: false
|
13
|
+
t.string :interest_frequency, null: false
|
14
|
+
t.decimal :interest_income_tax, precision: 5, scale: 4, null: false
|
15
|
+
t.decimal :vat, precision: 5, scale: 4, null: false
|
16
|
+
t.integer :max_interest_calculation_days, null: false
|
17
|
+
t.string :penalty_frequency, null: false
|
18
|
+
t.decimal :penalty_income_tax, precision: 5, scale: 4, null: false
|
19
|
+
t.boolean :active, default: true
|
20
|
+
t.references :created_by, polymorphic: true, null: false
|
21
|
+
|
22
|
+
t.timestamps
|
23
|
+
end
|
24
|
+
|
25
|
+
add_index :dscf_credit_credit_line_specs, :active
|
26
|
+
add_index :dscf_credit_credit_line_specs, [ :created_by_type, :created_by_id ]
|
27
|
+
add_index :dscf_credit_credit_line_specs, [ :credit_line_id, :active ]
|
28
|
+
add_index :dscf_credit_credit_line_specs, :loan_duration
|
29
|
+
add_index :dscf_credit_credit_line_specs, :interest_frequency
|
30
|
+
add_index :dscf_credit_credit_line_specs, :penalty_frequency
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class CreateDscfCreditSystemConfigDefinitions < ActiveRecord::Migration[8.0]
|
2
|
+
def change
|
3
|
+
create_table :dscf_credit_system_config_definitions do |t|
|
4
|
+
t.references :bank, null: false, foreign_key: { to_table: :dscf_credit_banks }
|
5
|
+
t.string :config_key, null: false
|
6
|
+
t.text :description
|
7
|
+
t.string :value_type, null: false
|
8
|
+
t.string :frequency
|
9
|
+
|
10
|
+
t.timestamps
|
11
|
+
end
|
12
|
+
|
13
|
+
add_index :dscf_credit_system_config_definitions, :config_key
|
14
|
+
add_index :dscf_credit_system_config_definitions, :value_type
|
15
|
+
add_index :dscf_credit_system_config_definitions, :frequency
|
16
|
+
add_index :dscf_credit_system_config_definitions, [ :bank_id, :config_key ], unique: true
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class CreateDscfCreditSystemConfigs < ActiveRecord::Migration[8.0]
|
2
|
+
def change
|
3
|
+
create_table :dscf_credit_system_configs do |t|
|
4
|
+
t.references :config_definition, null: false, foreign_key: { to_table: :dscf_credit_system_config_definitions }, index: { unique: true }
|
5
|
+
t.text :config_value, null: false
|
6
|
+
t.string :status, default: 'pending'
|
7
|
+
t.references :last_updated_by, polymorphic: true, null: false
|
8
|
+
t.references :approved_by, polymorphic: true, null: false
|
9
|
+
|
10
|
+
t.timestamps
|
11
|
+
end
|
12
|
+
|
13
|
+
add_index :dscf_credit_system_configs, [ :last_updated_by_type, :last_updated_by_id ]
|
14
|
+
add_index :dscf_credit_system_configs, [ :approved_by_type, :approved_by_id ]
|
15
|
+
add_index :dscf_credit_system_configs, :status
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
class CreateDscfCreditScoringParameters < ActiveRecord::Migration[8.0]
|
2
|
+
def change
|
3
|
+
create_table :dscf_credit_scoring_parameters do |t|
|
4
|
+
t.references :bank, null: false, foreign_key: { to_table: :dscf_credit_banks }
|
5
|
+
t.string :name, null: false
|
6
|
+
t.text :description
|
7
|
+
t.string :data_type, null: false
|
8
|
+
t.string :type, null: false
|
9
|
+
t.decimal :weight, precision: 5, scale: 4, null: false
|
10
|
+
t.decimal :min_value, precision: 15, scale: 2
|
11
|
+
t.decimal :max_value, precision: 15, scale: 2
|
12
|
+
t.boolean :active, default: true
|
13
|
+
t.references :previous_version, foreign_key: { to_table: :dscf_credit_scoring_parameters }, null: true
|
14
|
+
t.references :created_by, polymorphic: true, null: false
|
15
|
+
t.references :approved_by, polymorphic: true, null: false
|
16
|
+
t.datetime :expires_at
|
17
|
+
|
18
|
+
t.timestamps
|
19
|
+
end
|
20
|
+
|
21
|
+
add_index :dscf_credit_scoring_parameters, :name
|
22
|
+
add_index :dscf_credit_scoring_parameters, :data_type
|
23
|
+
add_index :dscf_credit_scoring_parameters, :type
|
24
|
+
add_index :dscf_credit_scoring_parameters, :active
|
25
|
+
add_index :dscf_credit_scoring_parameters, [ :created_by_type, :created_by_id ]
|
26
|
+
add_index :dscf_credit_scoring_parameters, [ :approved_by_type, :approved_by_id ]
|
27
|
+
add_index :dscf_credit_scoring_parameters, :expires_at
|
28
|
+
add_index :dscf_credit_scoring_parameters, [ :bank_id, :name, :active ]
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class CreateDscfCreditParameterNormalizers < ActiveRecord::Migration[8.0]
|
2
|
+
def change
|
3
|
+
create_table :dscf_credit_parameter_normalizers do |t|
|
4
|
+
t.references :scoring_parameter, null: false, foreign_key: { to_table: :dscf_credit_scoring_parameters }
|
5
|
+
t.string :name, null: false
|
6
|
+
t.text :description
|
7
|
+
t.string :raw_value, null: false
|
8
|
+
t.integer :normalized_value, null: false
|
9
|
+
|
10
|
+
t.timestamps
|
11
|
+
end
|
12
|
+
|
13
|
+
add_index :dscf_credit_parameter_normalizers, :name
|
14
|
+
add_index :dscf_credit_parameter_normalizers, :raw_value
|
15
|
+
add_index :dscf_credit_parameter_normalizers, :normalized_value
|
16
|
+
add_index :dscf_credit_parameter_normalizers, [ :scoring_parameter_id, :raw_value ], unique: true
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
class CreateDscfCreditLoanProfiles < ActiveRecord::Migration[8.0]
|
2
|
+
def change
|
3
|
+
create_table :dscf_credit_loan_profiles do |t|
|
4
|
+
t.references :bank, null: false, foreign_key: { to_table: :dscf_credit_banks }
|
5
|
+
t.references :user, null: false, foreign_key: { to_table: :dscf_core_users }
|
6
|
+
t.references :backer, polymorphic: true, null: true
|
7
|
+
t.string :status, default: 'pending'
|
8
|
+
t.decimal :total_amount, precision: 15, scale: 2, default: 0
|
9
|
+
t.decimal :available_amount, precision: 15, scale: 2, default: 0
|
10
|
+
t.references :approved_by, polymorphic: true, null: false
|
11
|
+
t.text :rejection_reason
|
12
|
+
|
13
|
+
t.timestamps
|
14
|
+
end
|
15
|
+
|
16
|
+
add_index :dscf_credit_loan_profiles, :status
|
17
|
+
add_index :dscf_credit_loan_profiles, :total_amount
|
18
|
+
add_index :dscf_credit_loan_profiles, :available_amount
|
19
|
+
add_index :dscf_credit_loan_profiles, [ :backer_type, :backer_id ]
|
20
|
+
add_index :dscf_credit_loan_profiles, [ :approved_by_type, :approved_by_id ]
|
21
|
+
add_index :dscf_credit_loan_profiles, [ :bank_id, :user_id, :status ]
|
22
|
+
add_index :dscf_credit_loan_profiles, [ :user_id, :status ]
|
23
|
+
add_index :dscf_credit_loan_profiles, [ :total_amount, :available_amount ]
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class CreateDscfCreditLoanProfileScoringSpecs < ActiveRecord::Migration[8.0]
|
2
|
+
def change
|
3
|
+
create_table :dscf_credit_loan_profile_scoring_specs do |t|
|
4
|
+
t.references :loan_profile, null: false, foreign_key: { to_table: :dscf_credit_loan_profiles }
|
5
|
+
t.jsonb :scoring_input_data, null: false
|
6
|
+
t.decimal :score, precision: 5, scale: 2, null: false
|
7
|
+
t.boolean :active, default: true
|
8
|
+
t.references :created_by, polymorphic: true, null: false
|
9
|
+
t.references :approved_by, polymorphic: true, null: false
|
10
|
+
t.datetime :expires_at
|
11
|
+
|
12
|
+
t.timestamps
|
13
|
+
end
|
14
|
+
|
15
|
+
add_index :dscf_credit_loan_profile_scoring_specs, :score
|
16
|
+
add_index :dscf_credit_loan_profile_scoring_specs, :active
|
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
|
+
add_index :dscf_credit_loan_profile_scoring_specs, :scoring_input_data, using: :gin
|
21
|
+
add_index :dscf_credit_loan_profile_scoring_specs, [ :loan_profile_id, :active ]
|
22
|
+
end
|
23
|
+
end
|