dscf-banking 0.2.4 → 0.2.6

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: 1b7834f2745a3928e7857c8460f4f85ef499ea7a760b1ca8d3dabeb3545886b8
4
- data.tar.gz: 373cb2daa82e54960ee7e0219bd9cbc61576246e5516600f1796369ad9431395
3
+ metadata.gz: 318c6e93b2062a45adb19d98709d9f0812788e0137bea60f9b56d66d2617b56a
4
+ data.tar.gz: 910120a3392d73f497aa511c3f971da9326a4a7ddc45d5820430d908b0959c05
5
5
  SHA512:
6
- metadata.gz: 1f7ab2f858766b2b722baa9fdc837646dbb686e18066e92f997a7e2cb5e80b8089d6ec1eedd109428a456ec8d4a4a6a6c8f79b7eb9268a92fb17074bd2b54b67
7
- data.tar.gz: 347cfd2b812e210a23bd255be66429a73fc492f28d74cb112a8d93672c9acd60e1fa2236ed65beadf38a75c96d1c6118b80da441ab070b048d02b726a8f12804
6
+ metadata.gz: 2195accd89bcc4f487e514e8209c31131c011bb5d676729d5ea18c68955d2bfd98a179a85e018c8e54901a473ee9c16da8179feb1c3580534fea68c273bc26c6
7
+ data.tar.gz: 28a117bad46972db2b9759dcfeee8c3d9bba034bada79f924058b096a6873a93d84a1fd4f39942f3857bc8a94feef3462374f2334a82a2c28a470a8b9cdc86f7
@@ -6,7 +6,7 @@ module Dscf::Banking
6
6
  # Custom default context for applications
7
7
  reviewable_context :default,
8
8
  statuses: %w[draft submitted under_review approved rejected request_modification],
9
- initial_status: "submitted",
9
+ initial_status: "draft",
10
10
  transitions: {
11
11
  "draft" => %w[submitted],
12
12
  "submitted" => %w[under_review approved rejected request_modification],
@@ -16,7 +16,7 @@ module Dscf::Banking
16
16
  validates :rejection_reason, presence: true, if: -> { status == "rejected" }
17
17
 
18
18
  enum :applicant_type, { individual: 0, business: 1 }, prefix: :applicant_type
19
- enum :status, { draft: 0, submitted: 1, under_review: 2, approved: 3, rejected: 4 }, prefix: :status
19
+ enum :status, { draft: 0, submitted: 1, under_review: 2, approved: 3, rejected: 4, request_modification: 5 }, prefix: :status
20
20
 
21
21
  before_validation :generate_application_number, if: -> { new_record? && application_number.blank? }
22
22
  before_update :set_timestamps_on_status_change
@@ -42,8 +42,13 @@ module Dscf::Banking
42
42
  Account.exists?(application: self)
43
43
  end
44
44
 
45
+ def review_status
46
+ latest_review = reviews.where(context: 'default').order(created_at: :desc).first
47
+ latest_review&.status || status
48
+ end
49
+
45
50
  def create_account_if_approved
46
- if saved_change_to_status? && status_approved?
51
+ if review_status == 'approved' && !has_account?
47
52
  AccountCreationService.call(self)
48
53
  end
49
54
  end
@@ -9,7 +9,7 @@ module Dscf::Banking
9
9
  end
10
10
 
11
11
  def call
12
- return nil unless @application.status_approved?
12
+ return nil unless @application.review_status == 'approved'
13
13
  return nil if account_already_exists?
14
14
 
15
15
  create_account
@@ -1,5 +1,5 @@
1
1
  module Dscf
2
2
  module Banking
3
- VERSION = "0.2.4"
3
+ VERSION = "0.2.6"
4
4
  end
5
5
  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
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eyosiyas Mekbib
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-10-13 00:00:00.000000000 Z
10
+ date: 2025-10-14 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rails