dscf-banking 0.2.1 → 0.2.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/dscf/banking/accounts_controller.rb +3 -1
- data/app/controllers/dscf/banking/application_controller.rb +2 -0
- data/app/controllers/dscf/banking/applications_controller.rb +22 -67
- data/app/controllers/dscf/banking/documents_controller.rb +154 -0
- data/app/controllers/dscf/banking/interest_configurations_controller.rb +1 -1
- data/app/controllers/dscf/banking/interest_rate_tiers_controller.rb +1 -1
- data/app/controllers/dscf/banking/interest_rate_types_controller.rb +1 -1
- data/app/controllers/dscf/banking/product_approvals_controller.rb +1 -1
- data/app/controllers/dscf/banking/product_categories_controller.rb +1 -1
- data/app/controllers/dscf/banking/transaction_types_controller.rb +1 -1
- data/app/controllers/dscf/banking/transactions_controller.rb +9 -1
- data/app/controllers/dscf/banking/virtual_account_products_controller.rb +24 -5
- data/app/models/dscf/banking/application.rb +10 -0
- data/app/models/dscf/banking/virtual_account_product.rb +11 -1
- data/app/serializers/dscf/banking/application_serializer.rb +2 -0
- data/app/serializers/dscf/banking/document_serializer.rb +7 -0
- data/app/serializers/dscf/banking/virtual_account_product_serializer.rb +2 -0
- data/config/locales/en.yml +25 -0
- data/config/routes.rb +12 -2
- data/db/migrate/20250919084927_make_account_associations_optional.rb +6 -1
- data/db/seeds.rb +26 -0
- data/lib/dscf/banking/version.rb +1 -1
- data/spec/factories/dscf/banking/documents.rb +10 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9fc221b52889b3f647a6bf2aece413c37920cd18b793e15507d0c54d10d64049
|
4
|
+
data.tar.gz: 36c852689c3e64245e5b3f36bbd31d54506e04e82fb259329e4c711274ce9e48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35049ee207d00a654faf0f8bdebf0e24c6cbed1e0534a923814040bd88d667b89e8bb643e7b35ff14555cce633b68d99c0fce786a4a8e2b6ecac0aff06c28cd0
|
7
|
+
data.tar.gz: d3d6818202de5b7ecdcfc5a7d33495a0d4040b2c00b8f63b0ed13a45645c7a53852209e960c6cb89770f51578e3893843afd1023fa96e061f74ab769666e58b8
|
@@ -210,6 +210,7 @@ module Dscf::Banking
|
|
210
210
|
minimum_balance: account.minimum_balance,
|
211
211
|
currency: account.currency,
|
212
212
|
active: account.active,
|
213
|
+
system_account: account.system_account,
|
213
214
|
application_id: account.application_id,
|
214
215
|
virtual_account_product_id: account.virtual_account_product_id,
|
215
216
|
account_properties: account.account_properties,
|
@@ -219,7 +220,7 @@ module Dscf::Banking
|
|
219
220
|
end
|
220
221
|
|
221
222
|
def model_params
|
222
|
-
params.require(:
|
223
|
+
params.require(:account).permit(
|
223
224
|
:application_id,
|
224
225
|
:virtual_account_product_id,
|
225
226
|
:name,
|
@@ -231,6 +232,7 @@ module Dscf::Banking
|
|
231
232
|
:minimum_balance,
|
232
233
|
:currency,
|
233
234
|
:active,
|
235
|
+
:system_account,
|
234
236
|
account_properties: {}
|
235
237
|
)
|
236
238
|
end
|
@@ -1,69 +1,23 @@
|
|
1
1
|
module Dscf::Banking
|
2
2
|
class ApplicationsController < ApplicationController
|
3
3
|
include Dscf::Core::Common
|
4
|
+
include Dscf::Core::ReviewableController
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
message: "Application approved successfully"
|
21
|
-
}
|
22
|
-
else
|
23
|
-
render json: {
|
24
|
-
success: false,
|
25
|
-
error: "Failed to approve application",
|
26
|
-
errors: application.errors.full_messages
|
27
|
-
}, status: :unprocessable_entity
|
28
|
-
end
|
29
|
-
rescue ActiveRecord::RecordNotFound
|
30
|
-
render json: {
|
31
|
-
success: false,
|
32
|
-
error: "Application not found"
|
33
|
-
}, status: :not_found
|
34
|
-
end
|
35
|
-
|
36
|
-
def reject
|
37
|
-
application = Dscf::Banking::Application.find(params[:id])
|
38
|
-
rejection_reason = params[:rejection_reason]
|
39
|
-
|
40
|
-
unless application.can_be_rejected_via_api?
|
41
|
-
return render json: {
|
42
|
-
success: false,
|
43
|
-
error: "Failed to reject application",
|
44
|
-
errors: [ "Application cannot be rejected from current status: #{application.status}" ]
|
45
|
-
}, status: :unprocessable_entity
|
46
|
-
end
|
47
|
-
|
48
|
-
if application.reject!(rejection_reason)
|
49
|
-
render json: {
|
50
|
-
success: true,
|
51
|
-
data: application_data(application),
|
52
|
-
message: "Application rejected successfully"
|
53
|
-
}
|
54
|
-
else
|
55
|
-
render json: {
|
56
|
-
success: false,
|
57
|
-
error: "Failed to reject application",
|
58
|
-
errors: application.errors.full_messages
|
59
|
-
}, status: :unprocessable_entity
|
60
|
-
end
|
61
|
-
rescue ActiveRecord::RecordNotFound
|
62
|
-
render json: {
|
63
|
-
success: false,
|
64
|
-
error: "Application not found"
|
65
|
-
}, status: :not_found
|
66
|
-
end
|
6
|
+
# Custom default context for applications
|
7
|
+
reviewable_context :default,
|
8
|
+
statuses: %w[draft submitted under_review approved rejected],
|
9
|
+
initial_status: "submitted",
|
10
|
+
transitions: {
|
11
|
+
"draft" => %w[submitted],
|
12
|
+
"submitted" => %w[under_review approved rejected],
|
13
|
+
"under_review" => %w[approved rejected]
|
14
|
+
},
|
15
|
+
actions: {
|
16
|
+
submit: { status: "submitted" },
|
17
|
+
assign_for_review: { status: "under_review" },
|
18
|
+
approve: { status: "approved" },
|
19
|
+
reject: { status: "rejected", require_feedback: true }
|
20
|
+
}
|
67
21
|
|
68
22
|
private
|
69
23
|
|
@@ -85,7 +39,7 @@ module Dscf::Banking
|
|
85
39
|
end
|
86
40
|
|
87
41
|
def model_params
|
88
|
-
params.require(:
|
42
|
+
params.require(:application).permit(
|
89
43
|
:user_id,
|
90
44
|
:virtual_account_product_id,
|
91
45
|
:applicant_type,
|
@@ -95,7 +49,7 @@ module Dscf::Banking
|
|
95
49
|
end
|
96
50
|
|
97
51
|
def eager_loaded_associations
|
98
|
-
[ :user, :virtual_account_product ]
|
52
|
+
[ :user, :virtual_account_product, :documents, reviews: { reviewed_by: :user_profile } ]
|
99
53
|
end
|
100
54
|
|
101
55
|
def allowed_order_columns
|
@@ -104,9 +58,10 @@ module Dscf::Banking
|
|
104
58
|
|
105
59
|
def default_serializer_includes
|
106
60
|
{
|
107
|
-
user: {},
|
108
|
-
virtual_account_product: {},
|
109
|
-
|
61
|
+
index: [:user, :virtual_account_product, :documents, reviews: { reviewed_by: :user_profile }],
|
62
|
+
show: [:user, :virtual_account_product, :account, :documents, reviews: { reviewed_by: :user_profile }],
|
63
|
+
create: [:documents, :reviews],
|
64
|
+
update: [:user, :virtual_account_product, :account, :documents, reviews: { reviewed_by: :user_profile }]
|
110
65
|
}
|
111
66
|
end
|
112
67
|
end
|
@@ -0,0 +1,154 @@
|
|
1
|
+
module Dscf::Banking
|
2
|
+
class DocumentsController < ApplicationController
|
3
|
+
include Dscf::Core::Common
|
4
|
+
|
5
|
+
def index
|
6
|
+
documents = Dscf::Core::Document.all
|
7
|
+
|
8
|
+
# Handle nested routes
|
9
|
+
if params[:application_id].present?
|
10
|
+
documents = documents.where(documentable_type: "Dscf::Banking::Application", documentable_id: params[:application_id])
|
11
|
+
end
|
12
|
+
|
13
|
+
# Filter by documentable type and ID if provided
|
14
|
+
if params[:documentable_type].present? && params[:documentable_id].present?
|
15
|
+
documents = documents.where(documentable_type: params[:documentable_type], documentable_id: params[:documentable_id])
|
16
|
+
end
|
17
|
+
|
18
|
+
# Filter by document type if provided
|
19
|
+
documents = documents.where(document_type: params[:document_type]) if params[:document_type].present?
|
20
|
+
|
21
|
+
# Apply ordering
|
22
|
+
order_column = allowed_order_columns.include?(params[:order_by]) ? params[:order_by] : "created_at"
|
23
|
+
order_direction = %w[asc desc].include?(params[:order_direction]) ? params[:order_direction] : "desc"
|
24
|
+
documents = documents.order("#{order_column} #{order_direction}")
|
25
|
+
|
26
|
+
render json: {
|
27
|
+
success: true,
|
28
|
+
data: documents.map { |document| document_data(document) }
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
def show
|
33
|
+
document = Dscf::Core::Document.find(params[:id])
|
34
|
+
render json: {
|
35
|
+
success: true,
|
36
|
+
data: document_data(document)
|
37
|
+
}
|
38
|
+
rescue ActiveRecord::RecordNotFound
|
39
|
+
render json: {
|
40
|
+
success: false,
|
41
|
+
error: "Document not found"
|
42
|
+
}, status: :not_found
|
43
|
+
end
|
44
|
+
|
45
|
+
def create
|
46
|
+
document_params = model_params
|
47
|
+
|
48
|
+
# Handle nested routes - set documentable_type and documentable_id from URL params
|
49
|
+
if params[:application_id].present?
|
50
|
+
document_params[:documentable_type] = "Dscf::Banking::Application"
|
51
|
+
document_params[:documentable_id] = params[:application_id]
|
52
|
+
end
|
53
|
+
|
54
|
+
document = Dscf::Core::Document.new(document_params)
|
55
|
+
|
56
|
+
if document.save
|
57
|
+
render json: {
|
58
|
+
success: true,
|
59
|
+
data: document_data(document)
|
60
|
+
}, status: :created
|
61
|
+
else
|
62
|
+
render json: {
|
63
|
+
success: false,
|
64
|
+
error: "Failed to create document",
|
65
|
+
errors: document.errors.full_messages
|
66
|
+
}, status: :unprocessable_content
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def update
|
71
|
+
document = Dscf::Core::Document.find(params[:id])
|
72
|
+
|
73
|
+
if document.update(model_params)
|
74
|
+
render json: {
|
75
|
+
success: true,
|
76
|
+
data: document_data(document)
|
77
|
+
}
|
78
|
+
else
|
79
|
+
render json: {
|
80
|
+
success: false,
|
81
|
+
error: "Failed to update document",
|
82
|
+
errors: document.errors.full_messages
|
83
|
+
}, status: :unprocessable_content
|
84
|
+
end
|
85
|
+
rescue ActiveRecord::RecordNotFound
|
86
|
+
render json: {
|
87
|
+
success: false,
|
88
|
+
error: "Document not found"
|
89
|
+
}, status: :not_found
|
90
|
+
end
|
91
|
+
|
92
|
+
def destroy
|
93
|
+
document = Dscf::Core::Document.find(params[:id])
|
94
|
+
|
95
|
+
if document.destroy
|
96
|
+
render json: {
|
97
|
+
success: true,
|
98
|
+
message: "Document deleted successfully"
|
99
|
+
}
|
100
|
+
else
|
101
|
+
render json: {
|
102
|
+
success: false,
|
103
|
+
error: "Failed to delete document"
|
104
|
+
}, status: :unprocessable_content
|
105
|
+
end
|
106
|
+
rescue ActiveRecord::RecordNotFound
|
107
|
+
render json: {
|
108
|
+
success: false,
|
109
|
+
error: "Document not found"
|
110
|
+
}, status: :not_found
|
111
|
+
end
|
112
|
+
|
113
|
+
private
|
114
|
+
|
115
|
+
def document_data(document)
|
116
|
+
{
|
117
|
+
id: document.id,
|
118
|
+
document_type: document.document_type,
|
119
|
+
file_url: document.file_url,
|
120
|
+
documentable_type: document.documentable_type,
|
121
|
+
documentable_id: document.documentable_id,
|
122
|
+
verified_by: document.verified_by,
|
123
|
+
created_at: document.created_at,
|
124
|
+
updated_at: document.updated_at
|
125
|
+
}
|
126
|
+
rescue => e
|
127
|
+
# Handle cases where file_url might fail (e.g., ActiveStorage not set up)
|
128
|
+
{
|
129
|
+
id: document.id,
|
130
|
+
document_type: document.document_type,
|
131
|
+
file_url: nil,
|
132
|
+
documentable_type: document.documentable_type,
|
133
|
+
documentable_id: document.documentable_id,
|
134
|
+
verified_by: document.verified_by,
|
135
|
+
created_at: document.created_at,
|
136
|
+
updated_at: document.updated_at
|
137
|
+
}
|
138
|
+
end
|
139
|
+
|
140
|
+
def model_params
|
141
|
+
params.require(:document).permit(
|
142
|
+
:document_type,
|
143
|
+
:documentable_type,
|
144
|
+
:documentable_id,
|
145
|
+
:verified_by_id,
|
146
|
+
:file
|
147
|
+
)
|
148
|
+
end
|
149
|
+
|
150
|
+
def allowed_order_columns
|
151
|
+
%w[id document_type created_at updated_at]
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
@@ -2,6 +2,14 @@ module Dscf::Banking
|
|
2
2
|
class TransactionsController < ApplicationController
|
3
3
|
include Dscf::Core::Common
|
4
4
|
|
5
|
+
rescue_from ActiveRecord::RecordNotFound do |exception|
|
6
|
+
render json: {
|
7
|
+
success: false,
|
8
|
+
error: "Transaction not found",
|
9
|
+
errors: ["Transaction with ID #{params[:id]} not found"]
|
10
|
+
}, status: :not_found
|
11
|
+
end
|
12
|
+
|
5
13
|
# Transfer money between accounts (from test cases)
|
6
14
|
def transfer
|
7
15
|
debit_account = Dscf::Banking::Account.find_by(account_number: transfer_params[:debit_account_number])
|
@@ -243,7 +251,7 @@ module Dscf::Banking
|
|
243
251
|
end
|
244
252
|
|
245
253
|
def model_params
|
246
|
-
params.require(:
|
254
|
+
params.require(:transaction).permit(
|
247
255
|
:account_id,
|
248
256
|
:transaction_type_id,
|
249
257
|
:debit_account_id,
|
@@ -1,6 +1,24 @@
|
|
1
1
|
module Dscf::Banking
|
2
2
|
class VirtualAccountProductsController < ApplicationController
|
3
3
|
include Dscf::Core::Common
|
4
|
+
include Dscf::Core::ReviewableController
|
5
|
+
|
6
|
+
# Custom default context with request_modification status
|
7
|
+
reviewable_context :default,
|
8
|
+
statuses: %w[draft pending_approval approved rejected request_modification],
|
9
|
+
initial_status: "pending_approval",
|
10
|
+
transitions: {
|
11
|
+
"draft" => %w[pending_approval],
|
12
|
+
"pending_approval" => %w[approved rejected request_modification],
|
13
|
+
"request_modification" => %w[pending_approval]
|
14
|
+
},
|
15
|
+
actions: {
|
16
|
+
submit: { status: "pending_approval" },
|
17
|
+
approve: { status: "approved" },
|
18
|
+
reject: { status: "rejected", require_feedback: true },
|
19
|
+
request_modification: { status: "request_modification", require_feedback: true },
|
20
|
+
resubmit: { status: "pending_approval", update_model: true }
|
21
|
+
}
|
4
22
|
|
5
23
|
def audit_logs
|
6
24
|
product = Dscf::Banking::VirtualAccountProduct.find(params[:id])
|
@@ -41,7 +59,7 @@ module Dscf::Banking
|
|
41
59
|
end
|
42
60
|
|
43
61
|
def model_params
|
44
|
-
params.require(:
|
62
|
+
params.require(:virtual_account_product).permit(
|
45
63
|
:product_code,
|
46
64
|
:product_name,
|
47
65
|
:product_category_id,
|
@@ -56,7 +74,7 @@ module Dscf::Banking
|
|
56
74
|
end
|
57
75
|
|
58
76
|
def eager_loaded_associations
|
59
|
-
[ :product_category, :created_by, :approved_by ]
|
77
|
+
[ :product_category, :created_by, :approved_by, reviews: { reviewed_by: :user_profile } ]
|
60
78
|
end
|
61
79
|
|
62
80
|
def allowed_order_columns
|
@@ -65,9 +83,10 @@ module Dscf::Banking
|
|
65
83
|
|
66
84
|
def default_serializer_includes
|
67
85
|
{
|
68
|
-
product_category: {},
|
69
|
-
created_by: {},
|
70
|
-
|
86
|
+
index: [:product_category, :created_by, :approved_by, reviews: { reviewed_by: :user_profile }],
|
87
|
+
show: [:product_category, :created_by, :approved_by, reviews: { reviewed_by: :user_profile }],
|
88
|
+
create: [:reviews],
|
89
|
+
update: [:product_category, :created_by, :approved_by, reviews: { reviewed_by: :user_profile }]
|
71
90
|
}
|
72
91
|
end
|
73
92
|
end
|
@@ -1,12 +1,14 @@
|
|
1
1
|
module Dscf::Banking
|
2
2
|
class Application < ApplicationRecord
|
3
3
|
include Dscf::Banking::Auditable
|
4
|
+
include Dscf::Core::ReviewableModel
|
4
5
|
|
5
6
|
belongs_to :user, class_name: "Dscf::Core::User"
|
6
7
|
belongs_to :assigned_kyc_officer, class_name: "Dscf::Core::User", optional: true
|
7
8
|
belongs_to :assigned_branch_manager, class_name: "Dscf::Core::User", optional: true
|
8
9
|
belongs_to :virtual_account_product, class_name: "Dscf::Banking::VirtualAccountProduct"
|
9
10
|
has_one :account, class_name: "Dscf::Banking::Account"
|
11
|
+
has_many :documents, as: :documentable, class_name: "Dscf::Core::Document"
|
10
12
|
|
11
13
|
validates :application_number, presence: true, uniqueness: true, length: { maximum: 50 }
|
12
14
|
validates :applicant_type, presence: true
|
@@ -47,6 +49,14 @@ module Dscf::Banking
|
|
47
49
|
end
|
48
50
|
end
|
49
51
|
|
52
|
+
def self.ransackable_attributes(auth_object = nil)
|
53
|
+
%w[id application_number status submitted_at completed_at created_at updated_at]
|
54
|
+
end
|
55
|
+
|
56
|
+
def self.ransackable_associations(auth_object = nil)
|
57
|
+
%w[user virtual_account_product account reviews documents]
|
58
|
+
end
|
59
|
+
|
50
60
|
private
|
51
61
|
|
52
62
|
def generate_application_number
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module Dscf::Banking
|
2
2
|
class VirtualAccountProduct < ApplicationRecord
|
3
3
|
include Auditable
|
4
|
+
include Dscf::Core::ReviewableModel
|
4
5
|
|
5
6
|
self.table_name = "dscf_banking_virtual_account_products"
|
6
7
|
|
@@ -8,7 +9,8 @@ module Dscf::Banking
|
|
8
9
|
draft: 0,
|
9
10
|
pending_approval: 1,
|
10
11
|
approved: 2,
|
11
|
-
rejected: 3
|
12
|
+
rejected: 3,
|
13
|
+
request_modification: 4
|
12
14
|
}
|
13
15
|
|
14
16
|
belongs_to :product_category, class_name: "Dscf::Banking::ProductCategory", optional: true
|
@@ -35,6 +37,14 @@ module Dscf::Banking
|
|
35
37
|
scope :by_category, ->(category_id) { where(product_category_id: category_id) }
|
36
38
|
scope :created_by_user, ->(user_id) { where(created_by_id: user_id) }
|
37
39
|
|
40
|
+
def self.ransackable_attributes(auth_object = nil)
|
41
|
+
%w[id product_code product_name status is_active created_at updated_at]
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.ransackable_associations(auth_object = nil)
|
45
|
+
%w[product_category created_by approved_by reviews]
|
46
|
+
end
|
47
|
+
|
38
48
|
before_validation :strip_whitespace
|
39
49
|
|
40
50
|
private
|
@@ -8,6 +8,8 @@ module Dscf::Banking
|
|
8
8
|
belongs_to :assigned_kyc_officer, optional: true
|
9
9
|
belongs_to :assigned_branch_manager, optional: true
|
10
10
|
has_one :account, serializer: AccountSerializer, if: :has_account?
|
11
|
+
has_many :reviews, serializer: Dscf::Core::ReviewSerializer
|
12
|
+
has_many :documents, serializer: Dscf::Banking::DocumentSerializer
|
11
13
|
|
12
14
|
def has_account?
|
13
15
|
object.has_account?
|
@@ -0,0 +1,25 @@
|
|
1
|
+
en:
|
2
|
+
virtual_account_product:
|
3
|
+
success:
|
4
|
+
submit: "Virtual account product submitted for approval successfully"
|
5
|
+
approve: "Virtual account product approved successfully"
|
6
|
+
reject: "Virtual account product rejected successfully"
|
7
|
+
request_modification: "Modification requested for virtual account product"
|
8
|
+
resubmit: "Virtual account product resubmitted successfully"
|
9
|
+
errors:
|
10
|
+
submit: "Failed to submit virtual account product for approval"
|
11
|
+
approve: "Failed to approve virtual account product"
|
12
|
+
reject: "Failed to reject virtual account product"
|
13
|
+
request_modification: "Failed to request modification for virtual account product"
|
14
|
+
resubmit: "Failed to resubmit virtual account product"
|
15
|
+
application:
|
16
|
+
success:
|
17
|
+
submit: "Application submitted successfully"
|
18
|
+
assign_for_review: "Application assigned for review successfully"
|
19
|
+
approve: "Application approved successfully"
|
20
|
+
reject: "Application rejected successfully"
|
21
|
+
errors:
|
22
|
+
submit: "Failed to submit application"
|
23
|
+
assign_for_review: "Failed to assign application for review"
|
24
|
+
approve: "Failed to approve application"
|
25
|
+
reject: "Failed to reject application"
|
data/config/routes.rb
CHANGED
@@ -11,6 +11,11 @@ Dscf::Banking::Engine.routes.draw do
|
|
11
11
|
resources :virtual_account_products do
|
12
12
|
member do
|
13
13
|
get :audit_logs
|
14
|
+
patch :submit
|
15
|
+
patch :approve
|
16
|
+
patch :reject
|
17
|
+
patch :request_modification
|
18
|
+
patch :resubmit
|
14
19
|
end
|
15
20
|
end
|
16
21
|
resources :interest_configurations
|
@@ -18,11 +23,16 @@ Dscf::Banking::Engine.routes.draw do
|
|
18
23
|
resources :product_approvals
|
19
24
|
resources :applications do
|
20
25
|
member do
|
21
|
-
|
22
|
-
|
26
|
+
patch :submit
|
27
|
+
patch :assign_for_review
|
28
|
+
patch :approve
|
29
|
+
patch :reject
|
23
30
|
end
|
31
|
+
resources :documents, only: [:index, :create]
|
24
32
|
end
|
25
33
|
|
34
|
+
resources :documents
|
35
|
+
|
26
36
|
resources :transaction_types
|
27
37
|
|
28
38
|
resources :transactions do
|
@@ -1,6 +1,11 @@
|
|
1
1
|
class MakeAccountAssociationsOptional < ActiveRecord::Migration[8.0]
|
2
|
-
def
|
2
|
+
def up
|
3
3
|
change_column_null :dscf_banking_accounts, :virtual_account_product_id, true
|
4
4
|
change_column_null :dscf_banking_accounts, :application_id, true
|
5
5
|
end
|
6
|
+
|
7
|
+
def down
|
8
|
+
change_column_null :dscf_banking_accounts, :virtual_account_product_id, false
|
9
|
+
change_column_null :dscf_banking_accounts, :application_id, false
|
10
|
+
end
|
6
11
|
end
|
data/db/seeds.rb
CHANGED
@@ -48,4 +48,30 @@ user7 = User.create(name: "Fikirte Alemayehu", email: "fikirte@example.com", pas
|
|
48
48
|
user7.roles << branch_manager_role
|
49
49
|
puts "Created user: #{user7.name}"
|
50
50
|
|
51
|
+
# Seed system accounts for transaction processing
|
52
|
+
puts "Seeding system accounts..."
|
53
|
+
system_deposit_account = Dscf::Banking::Account.find_or_create_by(
|
54
|
+
name: "System Deposit Account",
|
55
|
+
system_account: true
|
56
|
+
) do |account|
|
57
|
+
account.currency = "ETB"
|
58
|
+
account.status = :active
|
59
|
+
account.current_balance = 0
|
60
|
+
account.available_balance = 0
|
61
|
+
account.minimum_balance = 0
|
62
|
+
end
|
63
|
+
puts "Created system deposit account: #{system_deposit_account.name}"
|
64
|
+
|
65
|
+
system_withdrawal_account = Dscf::Banking::Account.find_or_create_by(
|
66
|
+
name: "System Withdrawal Account",
|
67
|
+
system_account: true
|
68
|
+
) do |account|
|
69
|
+
account.currency = "ETB"
|
70
|
+
account.status = :active
|
71
|
+
account.current_balance = 0
|
72
|
+
account.available_balance = 0
|
73
|
+
account.minimum_balance = 0
|
74
|
+
end
|
75
|
+
puts "Created system withdrawal account: #{system_withdrawal_account.name}"
|
76
|
+
|
51
77
|
puts "Seeding completed successfully."
|
data/lib/dscf/banking/version.rb
CHANGED
@@ -0,0 +1,10 @@
|
|
1
|
+
FactoryBot.define do
|
2
|
+
factory :dscf_banking_document, class: "Dscf::Core::Document" do
|
3
|
+
association :documentable, factory: :application
|
4
|
+
document_type { :business_license }
|
5
|
+
verified_by { nil }
|
6
|
+
|
7
|
+
# For file attachment, we can use a simple fixture or skip it in basic tests
|
8
|
+
# file { Rack::Test::UploadedFile.new(Rails.root.join('spec', 'fixtures', 'test.pdf'), 'application/pdf') }
|
9
|
+
end
|
10
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dscf-banking
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eyosiyas Mekbib
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-10-
|
10
|
+
date: 2025-10-12 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: rails
|
@@ -442,6 +442,7 @@ files:
|
|
442
442
|
- app/controllers/dscf/banking/accounts_controller.rb
|
443
443
|
- app/controllers/dscf/banking/application_controller.rb
|
444
444
|
- app/controllers/dscf/banking/applications_controller.rb
|
445
|
+
- app/controllers/dscf/banking/documents_controller.rb
|
445
446
|
- app/controllers/dscf/banking/interest_configurations_controller.rb
|
446
447
|
- app/controllers/dscf/banking/interest_rate_tiers_controller.rb
|
447
448
|
- app/controllers/dscf/banking/interest_rate_types_controller.rb
|
@@ -467,6 +468,7 @@ files:
|
|
467
468
|
- app/models/dscf/banking/virtual_account_product.rb
|
468
469
|
- app/serializers/dscf/banking/account_serializer.rb
|
469
470
|
- app/serializers/dscf/banking/application_serializer.rb
|
471
|
+
- app/serializers/dscf/banking/document_serializer.rb
|
470
472
|
- app/serializers/dscf/banking/interest_configuration_serializer.rb
|
471
473
|
- app/serializers/dscf/banking/interest_rate_tier_serializer.rb
|
472
474
|
- app/serializers/dscf/banking/interest_rate_type_serializer.rb
|
@@ -480,6 +482,7 @@ files:
|
|
480
482
|
- app/services/dscf/banking/deposit_service.rb
|
481
483
|
- app/services/dscf/banking/transfer_service.rb
|
482
484
|
- app/services/dscf/banking/withdrawal_service.rb
|
485
|
+
- config/locales/en.yml
|
483
486
|
- config/routes.rb
|
484
487
|
- db/migrate/20250830211002_create_dscf_banking_product_categories.rb
|
485
488
|
- db/migrate/20250830211027_create_dscf_banking_interest_rate_types.rb
|
@@ -503,6 +506,7 @@ files:
|
|
503
506
|
- lib/tasks/dscf/banking_tasks.rake
|
504
507
|
- spec/factories/dscf/banking/accounts.rb
|
505
508
|
- spec/factories/dscf/banking/applications.rb
|
509
|
+
- spec/factories/dscf/banking/documents.rb
|
506
510
|
- spec/factories/dscf/banking/interest_configurations.rb
|
507
511
|
- spec/factories/dscf/banking/interest_rate_tiers.rb
|
508
512
|
- spec/factories/dscf/banking/interest_rate_types.rb
|