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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1e5ce384f2229c93db978e4eff5599a0d0fb9fe74e586da8bab5209a63dcb9f6
4
- data.tar.gz: 889029fa9ee854b75198eed3a539215139d59914f09f8337674583ea153b3703
3
+ metadata.gz: 3a206be7d1f68e8a83476b508b3238c990eb67226243a5f242d3149828454891
4
+ data.tar.gz: 2fb1cc62bf33eaf81c4dd52e8413ab9bb2bfa186287b4714b603cb95360fe522
5
5
  SHA512:
6
- metadata.gz: b0772af1d0a922a4826de14d34c8d18f78480fe17a8c7db23d22e1e2e463ccb8e95cc7a6db8d6ff8ffb178036239316c26b8e2b8c18c2808e03f2639bae028b2
7
- data.tar.gz: 27587c70165aeda76c4577ef9e109b03539f0a5188681a3108408724e84fa39a681e7ba699cc6e213c886df5344f8cd196717947b83a882f7db43e49c80909e2
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: 'facilitation_fee', status: 'pending').sum(:amount),
44
- paid: loan.loan_accruals.where(accrual_type: 'facilitation_fee', status: 'paid').sum(:amount)
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: 'tax', status: 'pending').sum(:amount),
48
- paid: loan.loan_accruals.where(accrual_type: 'tax', status: 'paid').sum(:amount)
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: 'interest', status: 'pending').sum(:amount),
52
- paid: loan.loan_accruals.where(accrual_type: 'interest', status: 'paid').sum(:amount)
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: 'penalty', status: 'pending').sum(:amount),
56
- paid: loan.loan_accruals.where(accrual_type: 'penalty', status: 'paid').sum(:amount)
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: 'pending').count,
62
- paid: loan.loan_accruals.where(status: 'paid').count,
63
- cancelled: loan.loan_accruals.where(status: 'cancelled').count
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
- 'Loan accrual statistics retrieved successfully',
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, eligible_credit_lines: { credit_line: :credit_line },
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, reviews: { reviewed_by: :user_profile } ],
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, eligible_credit_lines: { credit_line: :credit_line }, reviews: { reviewed_by: :user_profile }
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, :eligible_credit_lines,
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
  }
@@ -1,6 +1,5 @@
1
1
  module Dscf::Credit
2
2
  class RepaymentsController < ApplicationController
3
-
4
3
  def create
5
4
  loan = Dscf::Credit::Loan.find(params[:loan_id])
6
5
  payment_amount = params[:amount].to_f
@@ -17,7 +17,7 @@ module Dscf::Credit
17
17
  end
18
18
 
19
19
  rejected_user_ids = Dscf::Credit::FacilitatorApplication.joins(:reviews)
20
- .where(dscf_core_reviews: { status: 'rejected' })
20
+ .where(dscf_core_reviews: { status: "rejected" })
21
21
  .pluck(:user_id)
22
22
  .uniq
23
23
 
@@ -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: 'facilitation_fee', status: 'pending').sum(:amount)
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: 'interest', status: 'pending').sum(:amount)
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: 'penalty', status: 'pending').sum(:amount)
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: 'tax', status: 'pending').sum(:amount)
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: 'pending').sum(:amount)
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, :status, :principal_amount, :remaining_amount, :due_date, :disbursed_at, :total_interest, :total_penalty,
4
- :total_vat, :total_facilitation_fee, :total_outstanding, :active, :created_at, :updated_at
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
@@ -1,5 +1,5 @@
1
1
  module Dscf
2
2
  module Credit
3
- VERSION = "0.1.8"
3
+ VERSION = "0.1.9"
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.1.8
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-04 00:00:00.000000000 Z
10
+ date: 2025-10-05 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: dscf-core