dscf-credit 0.1.8 → 0.1.9
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/dscf/credit/loan_accruals_controller.rb +17 -17
- data/app/controllers/dscf/credit/loan_profiles_controller.rb +9 -4
- data/app/controllers/dscf/credit/repayments_controller.rb +0 -1
- data/app/controllers/dscf/credit/users_controller.rb +1 -1
- data/app/models/dscf/credit/loan.rb +5 -5
- data/app/serializers/dscf/credit/loan_serializer.rb +14 -3
- data/lib/dscf/credit/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a206be7d1f68e8a83476b508b3238c990eb67226243a5f242d3149828454891
|
4
|
+
data.tar.gz: 2fb1cc62bf33eaf81c4dd52e8413ab9bb2bfa186287b4714b603cb95360fe522
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc931ad8d941a12b6d4680a761ea5210982ed5714e54bd2aec47a74444fea96e92a526250301d4391194da9bf389e92c4253818e6540fafdbf2d9d3d7728b0d7
|
7
|
+
data.tar.gz: c24155a0a4ef04ebfa0366d523feeba334842be98dcff13708447af5b286a81b0a5118786f785748b0f65c1e76c263b98b6e44196cc55e2501381eceadaf2bf4
|
@@ -40,32 +40,32 @@ module Dscf::Credit
|
|
40
40
|
total_outstanding: loan.total_outstanding,
|
41
41
|
accrual_breakdown: {
|
42
42
|
facilitation_fee: {
|
43
|
-
pending: loan.loan_accruals.where(accrual_type:
|
44
|
-
paid: loan.loan_accruals.where(accrual_type:
|
43
|
+
pending: loan.loan_accruals.where(accrual_type: "facilitation_fee", status: "pending").sum(:amount),
|
44
|
+
paid: loan.loan_accruals.where(accrual_type: "facilitation_fee", status: "paid").sum(:amount)
|
45
45
|
},
|
46
46
|
tax: {
|
47
|
-
pending: loan.loan_accruals.where(accrual_type:
|
48
|
-
paid: loan.loan_accruals.where(accrual_type:
|
47
|
+
pending: loan.loan_accruals.where(accrual_type: "tax", status: "pending").sum(:amount),
|
48
|
+
paid: loan.loan_accruals.where(accrual_type: "tax", status: "paid").sum(:amount)
|
49
49
|
},
|
50
50
|
interest: {
|
51
|
-
pending: loan.loan_accruals.where(accrual_type:
|
52
|
-
paid: loan.loan_accruals.where(accrual_type:
|
51
|
+
pending: loan.loan_accruals.where(accrual_type: "interest", status: "pending").sum(:amount),
|
52
|
+
paid: loan.loan_accruals.where(accrual_type: "interest", status: "paid").sum(:amount)
|
53
53
|
},
|
54
54
|
penalty: {
|
55
|
-
pending: loan.loan_accruals.where(accrual_type:
|
56
|
-
paid: loan.loan_accruals.where(accrual_type:
|
55
|
+
pending: loan.loan_accruals.where(accrual_type: "penalty", status: "pending").sum(:amount),
|
56
|
+
paid: loan.loan_accruals.where(accrual_type: "penalty", status: "paid").sum(:amount)
|
57
57
|
}
|
58
58
|
},
|
59
59
|
accrual_count: {
|
60
60
|
total: loan.loan_accruals.count,
|
61
|
-
pending: loan.loan_accruals.where(status:
|
62
|
-
paid: loan.loan_accruals.where(status:
|
63
|
-
cancelled: loan.loan_accruals.where(status:
|
61
|
+
pending: loan.loan_accruals.where(status: "pending").count,
|
62
|
+
paid: loan.loan_accruals.where(status: "paid").count,
|
63
|
+
cancelled: loan.loan_accruals.where(status: "cancelled").count
|
64
64
|
}
|
65
65
|
}
|
66
66
|
|
67
67
|
render_success(
|
68
|
-
|
68
|
+
"Loan accrual statistics retrieved successfully",
|
69
69
|
data: stats
|
70
70
|
)
|
71
71
|
end
|
@@ -94,7 +94,7 @@ module Dscf::Credit
|
|
94
94
|
end
|
95
95
|
|
96
96
|
def eager_loaded_associations
|
97
|
-
[:loan]
|
97
|
+
[ :loan ]
|
98
98
|
end
|
99
99
|
|
100
100
|
def allowed_order_columns
|
@@ -103,10 +103,10 @@ module Dscf::Credit
|
|
103
103
|
|
104
104
|
def default_serializer_includes
|
105
105
|
{
|
106
|
-
index: [:loan],
|
107
|
-
show: [:loan],
|
108
|
-
create: [:loan],
|
109
|
-
update: [:loan]
|
106
|
+
index: [ :loan ],
|
107
|
+
show: [ :loan ],
|
108
|
+
create: [ :loan ],
|
109
|
+
update: [ :loan ]
|
110
110
|
}
|
111
111
|
end
|
112
112
|
end
|
@@ -105,7 +105,8 @@ module Dscf::Credit
|
|
105
105
|
|
106
106
|
def eager_loaded_associations
|
107
107
|
[
|
108
|
-
:loan_application, :loan_profile_scoring_specs, :loans,
|
108
|
+
:loan_application, :loan_profile_scoring_specs, :loans,
|
109
|
+
{ eligible_credit_lines: :credit_line },
|
109
110
|
reviews: { reviewed_by: :user_profile }
|
110
111
|
]
|
111
112
|
end
|
@@ -116,13 +117,17 @@ module Dscf::Credit
|
|
116
117
|
|
117
118
|
def default_serializer_includes
|
118
119
|
{
|
119
|
-
index: [ :loan_application,
|
120
|
+
index: [ :loan_application, { eligible_credit_lines: :credit_line },
|
121
|
+
reviews: { reviewed_by: :user_profile } ],
|
120
122
|
show: [
|
121
|
-
:loan_application, :loan_profile_scoring_specs, :loans,
|
123
|
+
:loan_application, :loan_profile_scoring_specs, :loans,
|
124
|
+
{ eligible_credit_lines: :credit_line },
|
125
|
+
reviews: { reviewed_by: :user_profile }
|
122
126
|
],
|
123
127
|
create: [ :loan_application, :loan_profile_scoring_specs, :reviews ],
|
124
128
|
update: [
|
125
|
-
:loan_application, :loan_profile_scoring_specs, :loans,
|
129
|
+
:loan_application, :loan_profile_scoring_specs, :loans,
|
130
|
+
{ eligible_credit_lines: :credit_line },
|
126
131
|
reviews: { reviewed_by: :user_profile }
|
127
132
|
]
|
128
133
|
}
|
@@ -32,23 +32,23 @@ module Dscf::Credit
|
|
32
32
|
delegate :bank, to: :credit_line, allow_nil: true
|
33
33
|
|
34
34
|
def total_facilitation_fee
|
35
|
-
loan_accruals.where(accrual_type:
|
35
|
+
loan_accruals.where(accrual_type: "facilitation_fee", status: "pending").sum(:amount)
|
36
36
|
end
|
37
37
|
|
38
38
|
def total_interest
|
39
|
-
loan_accruals.where(accrual_type:
|
39
|
+
loan_accruals.where(accrual_type: "interest", status: "pending").sum(:amount)
|
40
40
|
end
|
41
41
|
|
42
42
|
def total_penalty
|
43
|
-
loan_accruals.where(accrual_type:
|
43
|
+
loan_accruals.where(accrual_type: "penalty", status: "pending").sum(:amount)
|
44
44
|
end
|
45
45
|
|
46
46
|
def total_vat
|
47
|
-
loan_accruals.where(accrual_type:
|
47
|
+
loan_accruals.where(accrual_type: "tax", status: "pending").sum(:amount)
|
48
48
|
end
|
49
49
|
|
50
50
|
def total_outstanding
|
51
|
-
remaining_amount + loan_accruals.where(status:
|
51
|
+
remaining_amount + loan_accruals.where(status: "pending").sum(:amount)
|
52
52
|
end
|
53
53
|
end
|
54
54
|
end
|
@@ -1,7 +1,19 @@
|
|
1
1
|
module Dscf::Credit
|
2
2
|
class LoanSerializer < ActiveModel::Serializer
|
3
|
-
attributes :id,
|
4
|
-
:
|
3
|
+
attributes :id,
|
4
|
+
:status,
|
5
|
+
:principal_amount,
|
6
|
+
:remaining_amount,
|
7
|
+
:due_date,
|
8
|
+
:disbursed_at,
|
9
|
+
:total_interest,
|
10
|
+
:total_penalty,
|
11
|
+
:total_vat,
|
12
|
+
:total_facilitation_fee,
|
13
|
+
:total_outstanding,
|
14
|
+
:active,
|
15
|
+
:created_at,
|
16
|
+
:updated_at
|
5
17
|
|
6
18
|
belongs_to :loan_profile, serializer: LoanProfileSerializer
|
7
19
|
belongs_to :credit_line, serializer: CreditLineSerializer
|
@@ -28,6 +40,5 @@ module Dscf::Credit
|
|
28
40
|
def total_outstanding
|
29
41
|
object.total_outstanding
|
30
42
|
end
|
31
|
-
|
32
43
|
end
|
33
44
|
end
|
data/lib/dscf/credit/version.rb
CHANGED
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.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adoniyas
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-10-
|
10
|
+
date: 2025-10-05 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: dscf-core
|