dscf-banking 0.2.6 → 0.2.7
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 +5 -5
- data/app/controllers/dscf/banking/documents_controller.rb +53 -0
- data/app/controllers/dscf/banking/transactions_controller.rb +1 -1
- data/app/controllers/dscf/banking/virtual_account_products_controller.rb +4 -4
- data/app/models/dscf/banking/application.rb +4 -3
- data/app/serializers/dscf/banking/application_serializer.rb +1 -0
- data/app/serializers/dscf/banking/document_serializer.rb +8 -0
- data/app/services/dscf/banking/account_creation_service.rb +1 -1
- data/config/routes.rb +1 -0
- data/db/seeds.rb +1 -1
- 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: c92f5cf56bdb2b4a3f6d15d1c75cfd1ac51da1e2e525ba7a568e80f289564d8a
|
4
|
+
data.tar.gz: 34962544cd525e20993f49a278655c6d291803c86a411b90eb3946f1aec62aea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12ba4363d0f4ab6b8edf6a432539b325d68a58d7ef49b1a1d0d756ccbe7880d311eeb903e63d19920a4bc25631b1c345abcabf5bb95cd8307ffa3be2b694c43d
|
7
|
+
data.tar.gz: 2b8514d69f366c986b88f393fb8e7102974c71ae3936ab618b21ad59318c2002df6b1b21db304465177351189be07486ce4552f2ac0dbdb556fb4e1010a86b2b
|
@@ -52,7 +52,7 @@ module Dscf::Banking
|
|
52
52
|
end
|
53
53
|
|
54
54
|
def eager_loaded_associations
|
55
|
-
[ :user, :virtual_account_product, reviews: { reviewed_by: :user_profile } ]
|
55
|
+
[ :user, :virtual_account_product, :documents, reviews: { reviewed_by: :user_profile } ]
|
56
56
|
end
|
57
57
|
|
58
58
|
def allowed_order_columns
|
@@ -61,10 +61,10 @@ module Dscf::Banking
|
|
61
61
|
|
62
62
|
def default_serializer_includes
|
63
63
|
{
|
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 }]
|
64
|
+
index: [ :user, :virtual_account_product, :documents, reviews: { reviewed_by: :user_profile } ],
|
65
|
+
show: [ :user, :virtual_account_product, :account, :documents, reviews: { reviewed_by: :user_profile } ],
|
66
|
+
create: [ :reviews, :documents ],
|
67
|
+
update: [ :user, :virtual_account_product, :account, :documents, reviews: { reviewed_by: :user_profile } ]
|
68
68
|
}
|
69
69
|
end
|
70
70
|
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
module Dscf::Banking
|
2
|
+
class DocumentsController < ApplicationController
|
3
|
+
include Dscf::Core::Common
|
4
|
+
|
5
|
+
before_action :find_application
|
6
|
+
|
7
|
+
private
|
8
|
+
|
9
|
+
def find_application
|
10
|
+
@application = Application.find(params[:application_id])
|
11
|
+
end
|
12
|
+
|
13
|
+
def model_class
|
14
|
+
Dscf::Core::Document
|
15
|
+
end
|
16
|
+
|
17
|
+
def collection
|
18
|
+
@application.documents
|
19
|
+
end
|
20
|
+
|
21
|
+
def build_resource
|
22
|
+
@application.documents.build
|
23
|
+
end
|
24
|
+
|
25
|
+
def find_resource
|
26
|
+
@application.documents.find(params[:id])
|
27
|
+
end
|
28
|
+
|
29
|
+
def model_params
|
30
|
+
params.require(:document).permit(
|
31
|
+
:document_type,
|
32
|
+
metadata: {}
|
33
|
+
).merge(documentable: @application)
|
34
|
+
end
|
35
|
+
|
36
|
+
def eager_loaded_associations
|
37
|
+
[]
|
38
|
+
end
|
39
|
+
|
40
|
+
def allowed_order_columns
|
41
|
+
%w[id document_type is_verified verified_at created_at updated_at]
|
42
|
+
end
|
43
|
+
|
44
|
+
def default_serializer_includes
|
45
|
+
{
|
46
|
+
index: [],
|
47
|
+
show: [],
|
48
|
+
create: [],
|
49
|
+
update: []
|
50
|
+
}
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -83,10 +83,10 @@ module Dscf::Banking
|
|
83
83
|
|
84
84
|
def default_serializer_includes
|
85
85
|
{
|
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 }]
|
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 } ]
|
90
90
|
}
|
91
91
|
end
|
92
92
|
end
|
@@ -8,6 +8,7 @@ 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, class_name: "Dscf::Core::Document", as: :documentable, dependent: :destroy
|
11
12
|
|
12
13
|
validates :application_number, presence: true, uniqueness: true, length: { maximum: 50 }
|
13
14
|
validates :applicant_type, presence: true
|
@@ -43,12 +44,12 @@ module Dscf::Banking
|
|
43
44
|
end
|
44
45
|
|
45
46
|
def review_status
|
46
|
-
latest_review = reviews.where(context:
|
47
|
+
latest_review = reviews.where(context: "default").order(created_at: :desc).first
|
47
48
|
latest_review&.status || status
|
48
49
|
end
|
49
50
|
|
50
51
|
def create_account_if_approved
|
51
|
-
if review_status ==
|
52
|
+
if review_status == "approved" && !has_account?
|
52
53
|
AccountCreationService.call(self)
|
53
54
|
end
|
54
55
|
end
|
@@ -58,7 +59,7 @@ module Dscf::Banking
|
|
58
59
|
end
|
59
60
|
|
60
61
|
def self.ransackable_associations(auth_object = nil)
|
61
|
-
%w[user virtual_account_product account reviews]
|
62
|
+
%w[user virtual_account_product account reviews documents]
|
62
63
|
end
|
63
64
|
|
64
65
|
private
|
@@ -9,6 +9,7 @@ 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: DocumentSerializer
|
12
13
|
|
13
14
|
def has_account?
|
14
15
|
object.has_account?
|
@@ -0,0 +1,8 @@
|
|
1
|
+
module Dscf::Banking
|
2
|
+
class DocumentSerializer < ActiveModel::Serializer
|
3
|
+
attributes :id, :document_type, :is_verified, :verified_at, :metadata, :created_at, :updated_at
|
4
|
+
|
5
|
+
# Remove polymorphic association that causes ActiveStorage issues
|
6
|
+
# belongs_to :verified_by, polymorphic: true, optional: true
|
7
|
+
end
|
8
|
+
end
|
data/config/routes.rb
CHANGED
data/db/seeds.rb
CHANGED
@@ -63,7 +63,7 @@ end
|
|
63
63
|
puts "Created system deposit account: #{system_deposit_account.name}"
|
64
64
|
|
65
65
|
system_withdrawal_account = Dscf::Banking::Account.find_or_create_by(
|
66
|
-
name: "System Withdrawal Account",
|
66
|
+
name: "System Withdrawal Account",
|
67
67
|
system_account: true
|
68
68
|
) do |account|
|
69
69
|
account.currency = "ETB"
|
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.7
|
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-15 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: rails
|