dscf-banking 0.2.3 → 0.2.4
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/applications_controller.rb +12 -9
- data/app/controllers/dscf/banking/documents_controller.rb +0 -154
- data/app/models/dscf/banking/application.rb +1 -2
- data/app/serializers/dscf/banking/application_serializer.rb +0 -1
- data/app/serializers/dscf/banking/document_serializer.rb +0 -7
- data/config/locales/en.yml +5 -1
- data/config/routes.rb +2 -3
- data/lib/dscf/banking/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: 1b7834f2745a3928e7857c8460f4f85ef499ea7a760b1ca8d3dabeb3545886b8
|
4
|
+
data.tar.gz: 373cb2daa82e54960ee7e0219bd9cbc61576246e5516600f1796369ad9431395
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f7ab2f858766b2b722baa9fdc837646dbb686e18066e92f997a7e2cb5e80b8089d6ec1eedd109428a456ec8d4a4a6a6c8f79b7eb9268a92fb17074bd2b54b67
|
7
|
+
data.tar.gz: 347cfd2b812e210a23bd255be66429a73fc492f28d74cb112a8d93672c9acd60e1fa2236ed65beadf38a75c96d1c6118b80da441ab070b048d02b726a8f12804
|
@@ -5,18 +5,21 @@ module Dscf::Banking
|
|
5
5
|
|
6
6
|
# Custom default context for applications
|
7
7
|
reviewable_context :default,
|
8
|
-
statuses: %w[draft submitted under_review approved rejected],
|
8
|
+
statuses: %w[draft submitted under_review approved rejected request_modification],
|
9
9
|
initial_status: "submitted",
|
10
10
|
transitions: {
|
11
11
|
"draft" => %w[submitted],
|
12
|
-
"submitted" => %w[under_review approved rejected],
|
13
|
-
"under_review" => %w[approved rejected]
|
12
|
+
"submitted" => %w[under_review approved rejected request_modification],
|
13
|
+
"under_review" => %w[approved rejected request_modification],
|
14
|
+
"request_modification" => %w[submitted]
|
14
15
|
},
|
15
16
|
actions: {
|
16
17
|
submit: { status: "submitted" },
|
17
18
|
assign_for_review: { status: "under_review" },
|
18
19
|
approve: { status: "approved" },
|
19
|
-
reject: { status: "rejected", require_feedback: true }
|
20
|
+
reject: { status: "rejected", require_feedback: true },
|
21
|
+
request_modification: { status: "request_modification", require_feedback: true },
|
22
|
+
resubmit: { status: "submitted", update_model: true }
|
20
23
|
}
|
21
24
|
|
22
25
|
private
|
@@ -49,7 +52,7 @@ module Dscf::Banking
|
|
49
52
|
end
|
50
53
|
|
51
54
|
def eager_loaded_associations
|
52
|
-
[ :user, :virtual_account_product,
|
55
|
+
[ :user, :virtual_account_product, reviews: { reviewed_by: :user_profile } ]
|
53
56
|
end
|
54
57
|
|
55
58
|
def allowed_order_columns
|
@@ -58,10 +61,10 @@ module Dscf::Banking
|
|
58
61
|
|
59
62
|
def default_serializer_includes
|
60
63
|
{
|
61
|
-
index: [:user, :virtual_account_product,
|
62
|
-
show: [:user, :virtual_account_product, :account,
|
63
|
-
create: [:
|
64
|
-
update: [:user, :virtual_account_product, :account,
|
64
|
+
index: [:user, :virtual_account_product, reviews: { reviewed_by: :user_profile }],
|
65
|
+
show: [:user, :virtual_account_product, :account, reviews: { reviewed_by: :user_profile }],
|
66
|
+
create: [:reviews],
|
67
|
+
update: [:user, :virtual_account_product, :account, reviews: { reviewed_by: :user_profile }]
|
65
68
|
}
|
66
69
|
end
|
67
70
|
end
|
@@ -1,154 +0,0 @@
|
|
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
|
@@ -8,7 +8,6 @@ module Dscf::Banking
|
|
8
8
|
belongs_to :assigned_branch_manager, class_name: "Dscf::Core::User", optional: true
|
9
9
|
belongs_to :virtual_account_product, class_name: "Dscf::Banking::VirtualAccountProduct"
|
10
10
|
has_one :account, class_name: "Dscf::Banking::Account"
|
11
|
-
has_many :documents, as: :documentable, class_name: "Dscf::Core::Document"
|
12
11
|
|
13
12
|
validates :application_number, presence: true, uniqueness: true, length: { maximum: 50 }
|
14
13
|
validates :applicant_type, presence: true
|
@@ -54,7 +53,7 @@ module Dscf::Banking
|
|
54
53
|
end
|
55
54
|
|
56
55
|
def self.ransackable_associations(auth_object = nil)
|
57
|
-
%w[user virtual_account_product account reviews
|
56
|
+
%w[user virtual_account_product account reviews]
|
58
57
|
end
|
59
58
|
|
60
59
|
private
|
@@ -9,7 +9,6 @@ module Dscf::Banking
|
|
9
9
|
belongs_to :assigned_branch_manager, optional: true
|
10
10
|
has_one :account, serializer: AccountSerializer, if: :has_account?
|
11
11
|
has_many :reviews, serializer: Dscf::Core::ReviewSerializer
|
12
|
-
has_many :documents, serializer: Dscf::Banking::DocumentSerializer
|
13
12
|
|
14
13
|
def has_account?
|
15
14
|
object.has_account?
|
data/config/locales/en.yml
CHANGED
@@ -18,8 +18,12 @@ en:
|
|
18
18
|
assign_for_review: "Application assigned for review successfully"
|
19
19
|
approve: "Application approved successfully"
|
20
20
|
reject: "Application rejected successfully"
|
21
|
+
request_modification: "Modification requested for application"
|
22
|
+
resubmit: "Application resubmitted successfully"
|
21
23
|
errors:
|
22
24
|
submit: "Failed to submit application"
|
23
25
|
assign_for_review: "Failed to assign application for review"
|
24
26
|
approve: "Failed to approve application"
|
25
|
-
reject: "Failed to reject application"
|
27
|
+
reject: "Failed to reject application"
|
28
|
+
request_modification: "Failed to request modification for application"
|
29
|
+
resubmit: "Failed to resubmit application"
|
data/config/routes.rb
CHANGED
@@ -27,12 +27,11 @@ Dscf::Banking::Engine.routes.draw do
|
|
27
27
|
patch :assign_for_review
|
28
28
|
patch :approve
|
29
29
|
patch :reject
|
30
|
+
patch :request_modification
|
31
|
+
patch :resubmit
|
30
32
|
end
|
31
|
-
resources :documents, only: [:index, :create]
|
32
33
|
end
|
33
34
|
|
34
|
-
resources :documents
|
35
|
-
|
36
35
|
resources :transaction_types
|
37
36
|
|
38
37
|
resources :transactions do
|
data/lib/dscf/banking/version.rb
CHANGED
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.4
|
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-13 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: rails
|