dscf-banking 0.2.1 → 0.2.2
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 +1 -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/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 +1 -1
- data/app/controllers/dscf/banking/virtual_account_products_controller.rb +24 -5
- data/app/models/dscf/banking/application.rb +9 -0
- data/app/models/dscf/banking/virtual_account_product.rb +11 -1
- data/app/serializers/dscf/banking/application_serializer.rb +1 -0
- data/app/serializers/dscf/banking/virtual_account_product_serializer.rb +2 -0
- data/config/locales/en.yml +25 -0
- data/config/routes.rb +9 -2
- data/db/migrate/20250919084927_make_account_associations_optional.rb +6 -1
- data/lib/dscf/banking/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 15401decf84bf542c773e447b403a9bf49631c9d0a566b81b0301dfddb880ff4
|
4
|
+
data.tar.gz: 5f5cc744a1fadafbd69fd740167aad3ab668c0aa37951ce8ff0a8842e0881e5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57fbc8692e1d4767bb48be19d29c7ec5350239cbfdaaa18c9ee0349acd43246e83b8a8343d24d0788a9be475a250bce445f3740ffab362e1eb90c438a889a74a
|
7
|
+
data.tar.gz: 9a5eff19db2c9e2d1379c699a83d7409e339efb92d6bc8f761a92630912bfd58b2881743abc024f3809e2860fc044623dad1e8d53dfaece60670f06af1c986cb
|
@@ -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, 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, reviews: { reviewed_by: :user_profile }],
|
62
|
+
show: [:user, :virtual_account_product, :account, reviews: { reviewed_by: :user_profile }],
|
63
|
+
create: [:reviews],
|
64
|
+
update: [:user, :virtual_account_product, :account, reviews: { reviewed_by: :user_profile }]
|
110
65
|
}
|
111
66
|
end
|
112
67
|
end
|
@@ -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,6 +1,7 @@
|
|
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
|
@@ -47,6 +48,14 @@ module Dscf::Banking
|
|
47
48
|
end
|
48
49
|
end
|
49
50
|
|
51
|
+
def self.ransackable_attributes(auth_object = nil)
|
52
|
+
%w[id application_number status submitted_at completed_at created_at updated_at]
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.ransackable_associations(auth_object = nil)
|
56
|
+
%w[user virtual_account_product account reviews]
|
57
|
+
end
|
58
|
+
|
50
59
|
private
|
51
60
|
|
52
61
|
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,7 @@ 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
|
11
12
|
|
12
13
|
def has_account?
|
13
14
|
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,8 +23,10 @@ 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
|
24
31
|
end
|
25
32
|
|
@@ -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/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.2
|
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-11 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: rails
|
@@ -480,6 +480,7 @@ files:
|
|
480
480
|
- app/services/dscf/banking/deposit_service.rb
|
481
481
|
- app/services/dscf/banking/transfer_service.rb
|
482
482
|
- app/services/dscf/banking/withdrawal_service.rb
|
483
|
+
- config/locales/en.yml
|
483
484
|
- config/routes.rb
|
484
485
|
- db/migrate/20250830211002_create_dscf_banking_product_categories.rb
|
485
486
|
- db/migrate/20250830211027_create_dscf_banking_interest_rate_types.rb
|