dscf-credit 0.3.8 → 0.4.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.
Files changed (26) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/dscf/credit/credit_lines_controller.rb +20 -6
  3. data/app/controllers/dscf/credit/facilitator_applications_controller.rb +19 -3
  4. data/app/controllers/dscf/credit/facilitators_controller.rb +18 -0
  5. data/app/controllers/dscf/credit/loan_applications_controller.rb +25 -5
  6. data/app/controllers/dscf/credit/loan_profiles_controller.rb +11 -1
  7. data/app/controllers/dscf/credit/scoring_parameters_controller.rb +39 -3
  8. data/app/controllers/dscf/credit/system_configs_controller.rb +8 -1
  9. data/app/models/dscf/credit/credit_line.rb +1 -0
  10. data/app/models/dscf/credit/facilitator_application.rb +2 -1
  11. data/app/models/dscf/credit/loan_application.rb +2 -1
  12. data/app/models/dscf/credit/scoring_parameter.rb +2 -1
  13. data/app/serializers/dscf/credit/credit_line_serializer.rb +1 -0
  14. data/app/serializers/dscf/credit/facilitator_application_serializer.rb +1 -0
  15. data/app/serializers/dscf/credit/loan_application_serializer.rb +1 -0
  16. data/app/serializers/dscf/credit/scoring_parameter_serializer.rb +1 -0
  17. data/config/locales/en.yml +18 -1
  18. data/config/routes.rb +11 -0
  19. data/db/migrate/20250822091527_create_dscf_credit_credit_line_specs.rb +3 -1
  20. data/lib/dscf/credit/version.rb +1 -1
  21. metadata +6 -9
  22. data/db/migrate/20251011202425_add_base_scoring_parameter_to_dscf_credit_credit_line_specs.rb +0 -5
  23. data/db/migrate/20251012100039_add_credit_line_divider_to_dscf_credit_credit_line_specs.rb +0 -5
  24. data/db/migrate/20251012115159_remove_default_from_credit_line_multiplier_in_credit_line_specs.rb +0 -5
  25. /data/db/migrate/{20250822092040_create_dscf_credit_scoring_param_types.rb → 20250822091525_create_dscf_credit_scoring_param_types.rb} +0 -0
  26. /data/db/migrate/{20250822092050_create_dscf_credit_scoring_parameters.rb → 20250822091526_create_dscf_credit_scoring_parameters.rb} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 04cc64832d4b85ab0ca609c056fb8b92282b6231cd996144e85721b1ecfd05dd
4
- data.tar.gz: 6f90fadd4bf75cfdb003b2eca35d17bd95916c75c2be77105a2296e4720b7645
3
+ metadata.gz: b308d3cfccda1cb39e00a905f357869e8cd539b1e47553e184f14cf92eb4e568
4
+ data.tar.gz: 2b20dbde292d37abf3ab7081b8b40359602e2fae66795ce560e2e1aebdbecc89
5
5
  SHA512:
6
- metadata.gz: f2ca07ab61fb05247a399992d06b0692b6e0ac020b28b3cee9fd39ea4eea9a52dad7b8ade4303344616649e24c9d51dab515cd0b5ee93ec4d1f6d8abb5c55349
7
- data.tar.gz: ff113b79a241223bf3834715c0f8abd8bd4f7267a0fabebc8e46438852d0a56724fe6a3f8ae74012139e1590561fceb5fe1e247fa5544769832559e71ce8d464
6
+ metadata.gz: 1dc0056daf90929f9442b09236f29893ae9f92bb5efda81b0a08c9a477f411e1b34dc63b8e776249ce37ddfc9d8258b30a9f714cb60ac9cf5265c5466bdab4a1
7
+ data.tar.gz: a6f1380794da537e0f2c8c0dd467ba7896d4a5c2d0b81e11eb5fcddda676a8c8c0552031484e05ae42db9c77a2016e85250cfbae8a4d9c42097dc4ad07743fb8
@@ -2,19 +2,31 @@ module Dscf::Credit
2
2
  class CreditLinesController < ApplicationController
3
3
  include Dscf::Core::Common
4
4
  include Dscf::Core::ReviewableController
5
+ include Dscf::Core::AuditableController
6
+
7
+ auditable associated: :reviews,
8
+ only: [ :status ],
9
+ on: %i[approve reject request_modification resubmit]
5
10
 
6
11
  def create
7
12
  super do
8
13
  credit_line = @clazz.new(model_params)
9
14
  credit_line.created_by = current_user
10
- credit_line.reviews.build(
11
- status: "pending",
12
- context: "default",
13
- )
15
+ credit_line.reviews.build(status: "draft", context: "default")
14
16
  credit_line
15
17
  end
16
18
  end
17
19
 
20
+ def update
21
+ unless @obj.editable?
22
+ return render_error(
23
+ errors: [ "Cannot update credit line after submission. Use modification request workflow instead." ],
24
+ status: :unprocessable_entity
25
+ )
26
+ end
27
+ super
28
+ end
29
+
18
30
  private
19
31
 
20
32
  def model_params
@@ -32,7 +44,8 @@ module Dscf::Credit
32
44
  [
33
45
  :bank, :category, :created_by, :loans, :eligible_credit_lines,
34
46
  credit_line_specs: :base_scoring_parameter,
35
- reviews: { reviewed_by: :user_profile }
47
+ reviews: { reviewed_by: :user_profile },
48
+ audit_logs: :actor
36
49
  ]
37
50
  end
38
51
 
@@ -46,7 +59,8 @@ module Dscf::Credit
46
59
  show: [
47
60
  :bank, :category, :created_by, :loans, :eligible_credit_lines,
48
61
  credit_line_specs: :base_scoring_parameter,
49
- reviews: { reviewed_by: :user_profile }
62
+ reviews: { reviewed_by: :user_profile },
63
+ audit_logs: :actor
50
64
  ],
51
65
  create: [ :bank, :category, :created_by, :reviews ],
52
66
  update: [
@@ -2,6 +2,11 @@ module Dscf::Credit
2
2
  class FacilitatorApplicationsController < ApplicationController
3
3
  include Dscf::Core::Common
4
4
  include Dscf::Core::ReviewableController
5
+ include Dscf::Core::AuditableController
6
+
7
+ auditable associated: [ :reviews ],
8
+ only: [ :status ],
9
+ on: %i[approve reject request_modification resubmit]
5
10
 
6
11
  def create
7
12
  super do
@@ -9,12 +14,22 @@ module Dscf::Credit
9
14
 
10
15
  user = Dscf::Core::User.find(model_params[:user_id])
11
16
  facilitator_application.user = user
12
- facilitator_application.reviews.build(context: "default", status: "pending")
17
+ facilitator_application.reviews.build(context: "default", status: "draft")
13
18
 
14
19
  facilitator_application
15
20
  end
16
21
  end
17
22
 
23
+ def update
24
+ unless @obj.editable?
25
+ return render_error(
26
+ errors: [ "Cannot update facilitator application after submission. Use modification request workflow instead." ],
27
+ status: :unprocessable_entity
28
+ )
29
+ end
30
+ super
31
+ end
32
+
18
33
  def bulk_create
19
34
  if params[:facilitator_applications].blank?
20
35
  return render_error(
@@ -102,7 +117,7 @@ module Dscf::Credit
102
117
  end
103
118
 
104
119
  def eager_loaded_associations
105
- [ :user, :bank, { user: { businesses: :business_type } }, reviews: { reviewed_by: :user_profile } ]
120
+ [ :user, :bank, { user: { businesses: :business_type } }, reviews: { reviewed_by: :user_profile }, audit_logs: :actor ]
106
121
  end
107
122
 
108
123
  def allowed_order_columns
@@ -111,7 +126,8 @@ module Dscf::Credit
111
126
 
112
127
  def default_serializer_includes
113
128
  {
114
- default: [ :user, :bank, { user: { businesses: :business_type } }, reviews: { reviewed_by: :user_profile } ]
129
+ default: [ :user, :bank, { user: { businesses: :business_type } }, reviews: { reviewed_by: :user_profile } ],
130
+ show: [ :user, :bank, { user: { businesses: :business_type } }, reviews: { reviewed_by: :user_profile }, audit_logs: :actor ]
115
131
  }
116
132
  end
117
133
  end
@@ -3,6 +3,24 @@ module Dscf::Credit
3
3
  include Dscf::Core::Common
4
4
  include Dscf::Core::ReviewableController
5
5
 
6
+ def create
7
+ super do
8
+ facilitator = @clazz.new(model_params)
9
+ facilitator.reviews.build(status: "draft", context: "default")
10
+ facilitator
11
+ end
12
+ end
13
+
14
+ def update
15
+ unless @obj.editable?
16
+ return render_error(
17
+ errors: [ "Cannot update facilitator after submission. Use modification request workflow instead." ],
18
+ status: :unprocessable_entity
19
+ )
20
+ end
21
+ super
22
+ end
23
+
6
24
  private
7
25
 
8
26
  def model_params
@@ -2,14 +2,22 @@ module Dscf::Credit
2
2
  class LoanApplicationsController < ApplicationController
3
3
  include Dscf::Core::Common
4
4
  include Dscf::Core::ReviewableController
5
+ include Dscf::Core::AuditableController
6
+
7
+ auditable associated: [ :reviews ],
8
+ only: [ :status ],
9
+ on: %i[approve reject request_modification resubmit]
10
+
5
11
  reviewable_context :default,
6
- statuses: %w[pending approved rejected modify],
7
- initial_status: "pending",
12
+ statuses: %w[draft pending approved rejected modify],
13
+ initial_status: "draft",
8
14
  transitions: {
15
+ "draft" => [ "pending" ],
9
16
  "pending" => %w[approved rejected modify],
10
17
  "modify" => [ "pending" ]
11
18
  },
12
19
  actions: {
20
+ submit: { status: "pending" },
13
21
  approve: {
14
22
  status: "approved",
15
23
  after: ->(review) {
@@ -27,12 +35,22 @@ module Dscf::Credit
27
35
  super do
28
36
  loan_application = @clazz.new(model_params)
29
37
  loan_application.user = current_user
30
- loan_application.reviews.build(context: "default", status: "pending")
38
+ loan_application.reviews.build(context: "default", status: "draft")
31
39
 
32
40
  loan_application
33
41
  end
34
42
  end
35
43
 
44
+ def update
45
+ unless @obj.editable?
46
+ return render_error(
47
+ errors: [ "Cannot update loan application after submission. Use modification request workflow instead." ],
48
+ status: :unprocessable_entity
49
+ )
50
+ end
51
+ super
52
+ end
53
+
36
54
  def update_bank_info
37
55
  loan_application = @clazz.find(params[:id])
38
56
  if loan_application.update(bank_info: bank_info_params)
@@ -264,7 +282,8 @@ module Dscf::Credit
264
282
  def eager_loaded_associations
265
283
  [
266
284
  :bank, :user, :backer, :review_branch, :loan_profile,
267
- reviews: { reviewed_by: :user_profile }
285
+ reviews: { reviewed_by: :user_profile },
286
+ audit_logs: :actor
268
287
  ]
269
288
  end
270
289
 
@@ -280,7 +299,8 @@ module Dscf::Credit
280
299
  ],
281
300
  show: [
282
301
  :bank, :user, :backer, :review_branch, :loan_profile,
283
- reviews: { reviewed_by: :user_profile }
302
+ reviews: { reviewed_by: :user_profile },
303
+ audit_logs: :actor
284
304
  ],
285
305
  create: [
286
306
  :bank, :user, :backer, :review_branch, :loan_profile, :reviews
@@ -7,13 +7,23 @@ module Dscf::Credit
7
7
  super do
8
8
  loan_profile = @clazz.new(model_params)
9
9
  loan_profile.reviews.build(
10
- status: "pending",
10
+ status: "draft",
11
11
  context: "default",
12
12
  )
13
13
  loan_profile
14
14
  end
15
15
  end
16
16
 
17
+ def update
18
+ unless @obj.editable?
19
+ return render_error(
20
+ errors: [ "Cannot update loan profile after submission. Use modification request workflow instead." ],
21
+ status: :unprocessable_entity
22
+ )
23
+ end
24
+ super
25
+ end
26
+
17
27
 
18
28
  def calculate_facility_limits
19
29
  loan_profile = @clazz.find(params[:id])
@@ -2,12 +2,23 @@ module Dscf::Credit
2
2
  class ScoringParametersController < ApplicationController
3
3
  include Dscf::Core::Common
4
4
  include Dscf::Core::ReviewableController
5
+ include Dscf::Core::AuditableController
5
6
 
7
+ before_action :set_object, only: %i[ show update activate deactivate]
8
+
9
+ auditable associated: [ :reviews ],
10
+ on: %i[approve reject request_modification resubmit]
11
+
12
+ auditable only: [ :active ],
13
+ on: %i[activate deactivate]
14
+
15
+ auditable on: %i[create],
16
+ associated: { reviews: { only: [ :status ] } }
6
17
  def create
7
18
  super do
8
19
  scoring_parameter = @clazz.new(model_params)
9
20
  scoring_parameter.created_by = current_user
10
- scoring_parameter.reviews.build(context: "default", status: "pending")
21
+ scoring_parameter.reviews.build(context: "default", status: "draft")
11
22
 
12
23
  if validate_scoring_param_type_weight_limit(scoring_parameter)
13
24
  scoring_parameter
@@ -20,6 +31,13 @@ module Dscf::Credit
20
31
  end
21
32
 
22
33
  def update
34
+ unless @obj.editable?
35
+ return render_error(
36
+ errors: [ "Cannot update scoring parameter after submission. Use modification request workflow instead." ],
37
+ status: :unprocessable_entity
38
+ )
39
+ end
40
+
23
41
  unless validate_scoring_param_type_weight_limit(@obj, exclude_current: true)
24
42
  @obj.errors.add(:weight, "would exceed the total weight limit of 1.0 for this scoring parameter type")
25
43
  render_error(errors: @obj.errors.full_messages, status: :unprocessable_entity)
@@ -29,6 +47,22 @@ module Dscf::Credit
29
47
  super
30
48
  end
31
49
 
50
+ def activate
51
+ if @obj.update(active: true)
52
+ render_success(data: @obj)
53
+ else
54
+ render_error(errors: @obj.errors.full_messages, status: :unprocessable_entity)
55
+ end
56
+ end
57
+
58
+ def deactivate
59
+ if @obj.update(active: false)
60
+ render_success(data: @obj)
61
+ else
62
+ render_error(errors: @obj.errors.full_messages, status: :unprocessable_entity)
63
+ end
64
+ end
65
+
32
66
  private
33
67
 
34
68
  def model_params
@@ -52,7 +86,8 @@ module Dscf::Credit
52
86
  def eager_loaded_associations
53
87
  [
54
88
  :bank, :category, :created_by, :scoring_param_type, :previous_version, :parameter_normalizers,
55
- reviews: { reviewed_by: :user_profile }
89
+ reviews: { reviewed_by: :user_profile },
90
+ audit_logs: :actor
56
91
  ]
57
92
  end
58
93
 
@@ -65,7 +100,8 @@ module Dscf::Credit
65
100
  index: [ :bank, :category, :parameter_normalizers, :scoring_param_type, reviews: { reviewed_by: :user_profile } ],
66
101
  show: [
67
102
  :bank, :category, :created_by, :scoring_param_type, :previous_version, :parameter_normalizers,
68
- reviews: { reviewed_by: :user_profile }
103
+ reviews: { reviewed_by: :user_profile },
104
+ audit_logs: :actor
69
105
  ],
70
106
  create: [ :bank, :category, :created_by, :scoring_param_type ],
71
107
  update: [
@@ -7,13 +7,20 @@ module Dscf::Credit
7
7
  super do
8
8
  obj = @clazz.new(model_params)
9
9
  obj.last_updated_by = current_user
10
- obj.reviews.build(context: "default", status: "pending")
10
+ obj.reviews.build(context: "default", status: "draft")
11
11
 
12
12
  obj
13
13
  end
14
14
  end
15
15
 
16
16
  def update
17
+ unless @obj.editable?
18
+ return render_error(
19
+ errors: [ "Cannot update system config after submission. Use modification request workflow instead." ],
20
+ status: :unprocessable_entity
21
+ )
22
+ end
23
+
17
24
  super do
18
25
  obj = set_object
19
26
  obj.last_updated_by = current_user
@@ -3,6 +3,7 @@ module Dscf::Credit
3
3
  self.table_name = "dscf_credit_credit_lines"
4
4
 
5
5
  include Dscf::Core::ReviewableModel
6
+ include Dscf::Core::AuditableModel
6
7
 
7
8
  belongs_to :bank, class_name: "Dscf::Credit::Bank", foreign_key: "bank_id"
8
9
  belongs_to :category, class_name: "Dscf::Credit::Category", foreign_key: "category_id"
@@ -3,6 +3,7 @@ module Dscf::Credit
3
3
  self.table_name = "dscf_credit_facilitator_applications"
4
4
 
5
5
  include Dscf::Core::ReviewableModel
6
+ include Dscf::Core::AuditableModel
6
7
 
7
8
  belongs_to :user, class_name: "Dscf::Core::User", foreign_key: "user_id"
8
9
  belongs_to :bank, class_name: "Dscf::Credit::Bank", foreign_key: "bank_id"
@@ -13,7 +14,7 @@ module Dscf::Credit
13
14
  end
14
15
 
15
16
  def self.ransackable_associations(auth_object = nil)
16
- %w[user bank reviews]
17
+ %w[user bank reviews audit_logs]
17
18
  end
18
19
  end
19
20
  end
@@ -3,6 +3,7 @@ module Dscf::Credit
3
3
  self.table_name = "dscf_credit_loan_applications"
4
4
 
5
5
  include Dscf::Core::ReviewableModel
6
+ include Dscf::Core::AuditableModel
6
7
 
7
8
  belongs_to :bank, class_name: "Dscf::Credit::Bank", foreign_key: "bank_id"
8
9
  if defined?(Dscf::Core::User)
@@ -24,7 +25,7 @@ module Dscf::Credit
24
25
  end
25
26
 
26
27
  def self.ransackable_associations(auth_object = nil)
27
- %w[bank user backer review_branch loan_profile reviews]
28
+ %w[bank user backer review_branch loan_profile reviews audit_logs]
28
29
  end
29
30
  end
30
31
  end
@@ -3,6 +3,7 @@ module Dscf::Credit
3
3
  self.table_name = "dscf_credit_scoring_parameters"
4
4
 
5
5
  include Dscf::Core::ReviewableModel
6
+ include Dscf::Core::AuditableModel
6
7
 
7
8
  belongs_to :bank, class_name: "Dscf::Credit::Bank", foreign_key: "bank_id"
8
9
  belongs_to :category, class_name: "Dscf::Credit::Category", foreign_key: "category_id"
@@ -23,7 +24,7 @@ module Dscf::Credit
23
24
  end
24
25
 
25
26
  def self.ransackable_associations(auth_object = nil)
26
- %w[bank created_by scoring_param_type previous_version parameter_normalizers categories reviews]
27
+ %w[bank created_by scoring_param_type previous_version parameter_normalizers categories reviews audit_logs]
27
28
  end
28
29
  end
29
30
  end
@@ -10,5 +10,6 @@ module Dscf::Credit
10
10
  has_many :loans, serializer: Dscf::Credit::LoanSerializer
11
11
  has_many :eligible_credit_lines, serializer: Dscf::Credit::EligibleCreditLineSerializer
12
12
  has_many :reviews, serializer: Dscf::Core::ReviewSerializer
13
+ has_many :audit_logs, serializer: Dscf::Core::AuditLogSerializer
13
14
  end
14
15
  end
@@ -4,4 +4,5 @@ class Dscf::Credit::FacilitatorApplicationSerializer < ActiveModel::Serializer
4
4
  belongs_to :user, serializer: Dscf::Core::UserSerializer
5
5
  belongs_to :bank, serializer: Dscf::Credit::BankSerializer
6
6
  has_many :reviews, serializer: Dscf::Core::ReviewSerializer
7
+ has_many :audit_logs, serializer: Dscf::Core::AuditLogSerializer
7
8
  end
@@ -8,5 +8,6 @@ module Dscf::Credit
8
8
  belongs_to :backer, polymorphic: true
9
9
  belongs_to :review_branch, serializer: Dscf::Credit::BankBranchSerializer
10
10
  has_many :reviews, serializer: Dscf::Core::ReviewSerializer
11
+ has_many :audit_logs, serializer: Dscf::Core::AuditLogSerializer
11
12
  end
12
13
  end
@@ -10,5 +10,6 @@ module Dscf::Credit
10
10
  belongs_to :previous_version, serializer: Dscf::Credit::ScoringParameterSerializer
11
11
  has_many :parameter_normalizers, serializer: Dscf::Credit::ParameterNormalizerSerializer
12
12
  has_many :reviews, serializer: Dscf::Core::ReviewSerializer
13
+ has_many :audit_logs, serializer: Dscf::Core::AuditLogSerializer
13
14
  end
14
15
  end
@@ -61,20 +61,26 @@ en:
61
61
  show: "Scoring parameter details retrieved successfully"
62
62
  create: "Scoring parameter created successfully"
63
63
  update: "Scoring parameter updated successfully"
64
+ submit: "Scoring parameter submitted for review successfully"
64
65
  approve: "Scoring parameter approved successfully"
65
66
  reject: "Scoring parameter rejected successfully"
66
67
  request_modification: "Modification requested for scoring parameter successfully"
67
68
  resubmit: "Scoring parameter resubmitted successfully"
69
+ activate: "Scoring parameter activated successfully"
70
+ deactivate: "Scoring parameter deactivated successfully"
68
71
  destroy: "Scoring parameter deleted successfully"
69
72
  errors:
70
73
  index: "Failed to retrieve scoring parameters"
71
74
  show: "Failed to retrieve scoring parameter details"
72
75
  create: "Failed to create scoring parameter"
73
76
  update: "Failed to update scoring parameter"
77
+ submit: "Failed to submit scoring parameter for review"
74
78
  approve: "Failed to approve scoring parameter"
75
79
  reject: "Failed to reject scoring parameter"
76
80
  request_modification: "Failed to request modification for scoring parameter"
77
81
  resubmit: "Failed to resubmit scoring parameter"
82
+ activate: "Failed to activate scoring parameter"
83
+ deactivate: "Failed to deactivate scoring parameter"
78
84
  destroy: "Failed to delete scoring parameter"
79
85
 
80
86
  loan_profile:
@@ -83,6 +89,7 @@ en:
83
89
  show: "Loan profile details retrieved successfully"
84
90
  create: "Loan profile created successfully"
85
91
  update: "Loan profile updated successfully"
92
+ submit: "Loan profile submitted for review successfully"
86
93
  approve: "Loan profile approved successfully"
87
94
  reject: "Loan profile rejected successfully"
88
95
  request_modification: "Modification requested for loan profile successfully"
@@ -94,6 +101,7 @@ en:
94
101
  show: "Failed to retrieve loan profile details"
95
102
  create: "Failed to create loan profile"
96
103
  update: "Failed to update loan profile"
104
+ submit: "Failed to submit loan profile for review"
97
105
  approve: "Failed to approve loan profile"
98
106
  reject: "Failed to reject loan profile"
99
107
  request_modification: "Failed to request modification for loan profile"
@@ -168,6 +176,7 @@ en:
168
176
  show: "Facilitator details retrieved successfully"
169
177
  create: "Facilitator created successfully"
170
178
  update: "Facilitator updated successfully"
179
+ submit: "Facilitator submitted for review successfully"
171
180
  approve: "Facilitator approved successfully"
172
181
  reject: "Facilitator rejected successfully"
173
182
  request_modification: "Modification requested for facilitator successfully"
@@ -177,6 +186,7 @@ en:
177
186
  show: "Failed to retrieve facilitator details"
178
187
  create: "Failed to create facilitator"
179
188
  update: "Failed to update facilitator"
189
+ submit: "Failed to submit facilitator for review"
180
190
  approve: "Failed to approve facilitator"
181
191
  reject: "Failed to reject facilitator"
182
192
  request_modification: "Failed to request modification for facilitator"
@@ -203,6 +213,7 @@ en:
203
213
  show: "Credit line details retrieved successfully"
204
214
  create: "Credit line created successfully"
205
215
  update: "Credit line updated successfully"
216
+ submit: "Credit line submitted for review successfully"
206
217
  approve: "Credit line approved successfully"
207
218
  reject: "Credit line rejected successfully"
208
219
  destroy: "Credit line deleted successfully"
@@ -213,6 +224,7 @@ en:
213
224
  show: "Failed to retrieve credit line details"
214
225
  create: "Failed to create credit line"
215
226
  update: "Failed to update credit line"
227
+ submit: "Failed to submit credit line for review"
216
228
  approve: "Failed to approve credit line"
217
229
  reject: "Failed to reject credit line"
218
230
  destroy: "Failed to delete credit line"
@@ -254,6 +266,7 @@ en:
254
266
  show: "System config details retrieved successfully"
255
267
  create: "System config created successfully"
256
268
  update: "System config updated successfully"
269
+ submit: "System config submitted for review successfully"
257
270
  approve: "System config approved successfully"
258
271
  reject: "System config rejected successfully"
259
272
  request_modification: "Modification requested for system config successfully"
@@ -264,6 +277,7 @@ en:
264
277
  show: "Failed to retrieve system config details"
265
278
  create: "Failed to create system config"
266
279
  update: "Failed to update system config"
280
+ submit: "Failed to submit system config for review"
267
281
  approve: "Failed to approve system config"
268
282
  reject: "Failed to reject system config"
269
283
  request_modification: "Failed to request modification for system config"
@@ -311,6 +325,7 @@ en:
311
325
  update_bank_info: "Bank information updated successfully"
312
326
  update_facilitator_info: "Facilitator information updated successfully"
313
327
  update_field_assessment: "Field assessment updated successfully"
328
+ submit: "Loan application submitted for review successfully"
314
329
  calculate_credit_score: "Credit score calculated successfully"
315
330
  apply_risk_factor: "Risk factor applied successfully"
316
331
  approve: "Loan application approved successfully"
@@ -325,10 +340,10 @@ en:
325
340
  update_bank_info: "Failed to update bank information"
326
341
  update_facilitator_info: "Failed to update facilitator information"
327
342
  update_field_assessment: "Failed to update field assessment"
343
+ submit: "Failed to submit loan application for review"
328
344
  calculate_credit_score: "Failed to calculate credit score"
329
345
  apply_risk_factor: "Failed to apply risk factor"
330
346
  invalid_risk_percentage: "Invalid risk percentage provided"
331
- no_loan_profile: "No loan profile found for this application"
332
347
  approve: "Failed to approve loan application"
333
348
  reject: "Failed to reject loan application"
334
349
  request_modification: "Failed to request modification for loan application"
@@ -341,6 +356,7 @@ en:
341
356
  show: "Facilitator application details retrieved successfully"
342
357
  create: "Facilitator application created successfully"
343
358
  update: "Facilitator application updated successfully"
359
+ submit: "Facilitator application submitted for review successfully"
344
360
  approve: "Facilitator application approved successfully"
345
361
  reject: "Facilitator application rejected successfully"
346
362
  request_modification: "Modification requested for facilitator application successfully"
@@ -351,6 +367,7 @@ en:
351
367
  show: "Failed to retrieve facilitator application details"
352
368
  create: "Failed to create facilitator application"
353
369
  update: "Failed to update facilitator application"
370
+ submit: "Failed to submit facilitator application for review"
354
371
  approve: "Failed to approve facilitator application"
355
372
  reject: "Failed to reject facilitator application"
356
373
  request_modification: "Failed to request modification for facilitator application"
data/config/routes.rb CHANGED
@@ -13,6 +13,7 @@ Dscf::Credit::Engine.routes.draw do
13
13
 
14
14
  resources :facilitators do
15
15
  member do
16
+ patch "submit"
16
17
  patch "approve"
17
18
  patch "reject"
18
19
  patch "request_modification"
@@ -22,8 +23,11 @@ Dscf::Credit::Engine.routes.draw do
22
23
 
23
24
  resources :loan_profiles do
24
25
  member do
26
+ patch "submit"
25
27
  patch "approve"
26
28
  patch "reject"
29
+ patch "request_modification"
30
+ patch "resubmit"
27
31
  post "calculate_facility_limits"
28
32
  end
29
33
  end
@@ -35,15 +39,19 @@ Dscf::Credit::Engine.routes.draw do
35
39
  end
36
40
  resources :scoring_parameters do
37
41
  member do
42
+ patch "submit"
38
43
  patch "approve"
39
44
  patch "reject"
40
45
  patch "request_modification"
41
46
  patch "resubmit"
47
+ patch "activate"
48
+ patch "deactivate"
42
49
  end
43
50
  end
44
51
  resources :parameter_normalizers
45
52
  resources :system_configs do
46
53
  member do
54
+ patch "submit"
47
55
  patch "approve"
48
56
  patch "reject"
49
57
  patch "request_modification"
@@ -53,6 +61,7 @@ Dscf::Credit::Engine.routes.draw do
53
61
  resources :system_config_definitions
54
62
  resources :credit_lines do
55
63
  member do
64
+ patch "submit"
56
65
  patch "approve"
57
66
  patch "reject"
58
67
  patch "request_modification"
@@ -76,6 +85,7 @@ Dscf::Credit::Engine.routes.draw do
76
85
  resources :loan_transactions
77
86
  resources :loan_applications do
78
87
  member do
88
+ patch "submit"
79
89
  patch "approve"
80
90
  patch "reject"
81
91
  patch "request_modification"
@@ -93,6 +103,7 @@ Dscf::Credit::Engine.routes.draw do
93
103
  end
94
104
 
95
105
  member do
106
+ patch "submit"
96
107
  patch "approve"
97
108
  patch "reject"
98
109
  patch "request_modification"
@@ -8,7 +8,9 @@ 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
+ t.decimal :credit_line_multiplier, precision: 5, scale: 2, null: false
12
+ t.references :base_scoring_parameter, foreign_key: { to_table: :dscf_credit_scoring_parameters }
13
+ t.integer :credit_line_divider
12
14
  t.integer :max_penalty_days, null: false
13
15
  t.integer :loan_duration, null: false
14
16
  t.string :interest_frequency, null: false
@@ -1,5 +1,5 @@
1
1
  module Dscf
2
2
  module Credit
3
- VERSION = "0.3.8"
3
+ VERSION = "0.4.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dscf-credit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.8
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adoniyas
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-10-30 00:00:00.000000000 Z
10
+ date: 2025-11-17 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: dscf-core
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - "~>"
17
17
  - !ruby/object:Gem::Version
18
- version: 0.2.0
18
+ version: 0.2.7
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - "~>"
24
24
  - !ruby/object:Gem::Version
25
- version: 0.2.0
25
+ version: 0.2.7
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: active_model_serializers
28
28
  requirement: !ruby/object:Gem::Requirement
@@ -421,11 +421,11 @@ files:
421
421
  - db/migrate/20250822091015_create_dscf_credit_banks.rb
422
422
  - db/migrate/20250822091055_create_dscf_credit_bank_branches.rb
423
423
  - db/migrate/20250822091131_create_dscf_credit_credit_lines.rb
424
+ - db/migrate/20250822091525_create_dscf_credit_scoring_param_types.rb
425
+ - db/migrate/20250822091526_create_dscf_credit_scoring_parameters.rb
424
426
  - db/migrate/20250822091527_create_dscf_credit_credit_line_specs.rb
425
427
  - db/migrate/20250822091744_create_dscf_credit_system_config_definitions.rb
426
428
  - db/migrate/20250822091820_create_dscf_credit_system_configs.rb
427
- - db/migrate/20250822092040_create_dscf_credit_scoring_param_types.rb
428
- - db/migrate/20250822092050_create_dscf_credit_scoring_parameters.rb
429
429
  - db/migrate/20250822092225_create_dscf_credit_parameter_normalizers.rb
430
430
  - db/migrate/20250822092236_create_dscf_credit_loan_applications.rb
431
431
  - db/migrate/20250822092246_create_dscf_credit_loan_profiles.rb
@@ -442,9 +442,6 @@ files:
442
442
  - db/migrate/20250825231109_create_dscf_credit_bank_staff.rb
443
443
  - db/migrate/20250917120000_create_dscf_credit_eligible_credit_lines.rb
444
444
  - db/migrate/20251003132939_create_dscf_credit_loan_accruals.rb
445
- - db/migrate/20251011202425_add_base_scoring_parameter_to_dscf_credit_credit_line_specs.rb
446
- - db/migrate/20251012100039_add_credit_line_divider_to_dscf_credit_credit_line_specs.rb
447
- - db/migrate/20251012115159_remove_default_from_credit_line_multiplier_in_credit_line_specs.rb
448
445
  - db/seeds.rb
449
446
  - lib/dscf/credit.rb
450
447
  - lib/dscf/credit/engine.rb
@@ -1,5 +0,0 @@
1
- class AddBaseScoringParameterToDscfCreditCreditLineSpecs < ActiveRecord::Migration[8.0]
2
- def change
3
- add_reference :dscf_credit_credit_line_specs, :base_scoring_parameter, null: true, foreign_key: { to_table: :dscf_credit_scoring_parameters }, index: true
4
- end
5
- end
@@ -1,5 +0,0 @@
1
- class AddCreditLineDividerToDscfCreditCreditLineSpecs < ActiveRecord::Migration[8.0]
2
- def change
3
- add_column :dscf_credit_credit_line_specs, :credit_line_divider, :integer, null: true
4
- end
5
- end
@@ -1,5 +0,0 @@
1
- class RemoveDefaultFromCreditLineMultiplierInCreditLineSpecs < ActiveRecord::Migration[8.0]
2
- def change
3
- change_column_default :dscf_credit_credit_line_specs, :credit_line_multiplier, from: 30.0, to: nil
4
- end
5
- end