dscf-banking 0.2.7 → 0.2.8
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd6bfb0114ad393bd22ae2bf1db82507a7e50299aa6f7ac0c433e53ae3a24e91
|
4
|
+
data.tar.gz: 97773b5c82e95ab7d227d9473ce82658ce4df88966506d0354ee10d360749023
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41ff719fa8dceb6e423d57c80bc8d9b96aeb2ab619ab94eccffb24bc1cbe4ce852b160ecde131084e11902aedf95df074af6b3589ffe3335f28cfcf10abccdcc
|
7
|
+
data.tar.gz: 5db3b15472498d3509cfe556ade8bf5e64ff7261cd3e0a338f898351c8a59110fddba5d4a04f1857a106508a5154c88d8dcd3964fbcaa5b22800478ede721e49
|
@@ -22,9 +22,33 @@ module Dscf::Banking
|
|
22
22
|
resubmit: { status: "submitted", update_model: true }
|
23
23
|
}
|
24
24
|
|
25
|
+
# Override perform_review_action to sync application status with review status
|
26
|
+
def perform_review_action(action_name, action_config, context_name)
|
27
|
+
result = super
|
28
|
+
|
29
|
+
# After successful review action, update the application's status to match
|
30
|
+
if result.is_a?(Hash) && result[:success] && @obj
|
31
|
+
review_status = @obj.review_status
|
32
|
+
application_status_map = {
|
33
|
+
"submitted" => "submitted",
|
34
|
+
"under_review" => "under_review",
|
35
|
+
"approved" => "approved",
|
36
|
+
"rejected" => "rejected",
|
37
|
+
"request_modification" => "request_modification"
|
38
|
+
}
|
39
|
+
|
40
|
+
new_status = application_status_map[review_status]
|
41
|
+
if new_status && @obj.status != new_status
|
42
|
+
@obj.update_column(:status, Application.statuses[new_status])
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
result
|
47
|
+
end
|
48
|
+
|
25
49
|
private
|
26
50
|
|
27
|
-
|
51
|
+
def application_data(application)
|
28
52
|
{
|
29
53
|
id: application.id,
|
30
54
|
application_number: application.application_number,
|
@@ -52,7 +76,7 @@ module Dscf::Banking
|
|
52
76
|
end
|
53
77
|
|
54
78
|
def eager_loaded_associations
|
55
|
-
[ :user, :virtual_account_product, :documents, reviews: { reviewed_by: :user_profile } ]
|
79
|
+
[ :user, :virtual_account_product, :account, :documents, reviews: { reviewed_by: :user_profile } ]
|
56
80
|
end
|
57
81
|
|
58
82
|
def allowed_order_columns
|
@@ -21,7 +21,7 @@ module Dscf::Banking
|
|
21
21
|
|
22
22
|
before_validation :generate_application_number, if: -> { new_record? && application_number.blank? }
|
23
23
|
before_update :set_timestamps_on_status_change
|
24
|
-
|
24
|
+
after_commit :create_account_if_approved, on: :update
|
25
25
|
|
26
26
|
def approve!(approved_by = nil)
|
27
27
|
update!(status: :approved, completed_at: Time.current)
|
@@ -48,12 +48,6 @@ module Dscf::Banking
|
|
48
48
|
latest_review&.status || status
|
49
49
|
end
|
50
50
|
|
51
|
-
def create_account_if_approved
|
52
|
-
if review_status == "approved" && !has_account?
|
53
|
-
AccountCreationService.call(self)
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
51
|
def self.ransackable_attributes(auth_object = nil)
|
58
52
|
%w[id application_number status submitted_at completed_at created_at updated_at]
|
59
53
|
end
|
@@ -81,5 +75,12 @@ module Dscf::Banking
|
|
81
75
|
end
|
82
76
|
end
|
83
77
|
end
|
78
|
+
|
79
|
+
def create_account_if_approved
|
80
|
+
return unless review_status == "approved"
|
81
|
+
return if has_account?
|
82
|
+
|
83
|
+
AccountCreationService.call(self)
|
84
|
+
end
|
84
85
|
end
|
85
86
|
end
|
data/lib/dscf/banking/version.rb
CHANGED