dscf-banking 0.2.2 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 15401decf84bf542c773e447b403a9bf49631c9d0a566b81b0301dfddb880ff4
4
- data.tar.gz: 5f5cc744a1fadafbd69fd740167aad3ab668c0aa37951ce8ff0a8842e0881e5c
3
+ metadata.gz: 1b7834f2745a3928e7857c8460f4f85ef499ea7a760b1ca8d3dabeb3545886b8
4
+ data.tar.gz: 373cb2daa82e54960ee7e0219bd9cbc61576246e5516600f1796369ad9431395
5
5
  SHA512:
6
- metadata.gz: 57fbc8692e1d4767bb48be19d29c7ec5350239cbfdaaa18c9ee0349acd43246e83b8a8343d24d0788a9be475a250bce445f3740ffab362e1eb90c438a889a74a
7
- data.tar.gz: 9a5eff19db2c9e2d1379c699a83d7409e339efb92d6bc8f761a92630912bfd58b2881743abc024f3809e2860fc044623dad1e8d53dfaece60670f06af1c986cb
6
+ metadata.gz: 1f7ab2f858766b2b722baa9fdc837646dbb686e18066e92f997a7e2cb5e80b8089d6ec1eedd109428a456ec8d4a4a6a6c8f79b7eb9268a92fb17074bd2b54b67
7
+ data.tar.gz: 347cfd2b812e210a23bd255be66429a73fc492f28d74cb112a8d93672c9acd60e1fa2236ed65beadf38a75c96d1c6118b80da441ab070b048d02b726a8f12804
@@ -210,6 +210,7 @@ module Dscf::Banking
210
210
  minimum_balance: account.minimum_balance,
211
211
  currency: account.currency,
212
212
  active: account.active,
213
+ system_account: account.system_account,
213
214
  application_id: account.application_id,
214
215
  virtual_account_product_id: account.virtual_account_product_id,
215
216
  account_properties: account.account_properties,
@@ -231,6 +232,7 @@ module Dscf::Banking
231
232
  :minimum_balance,
232
233
  :currency,
233
234
  :active,
235
+ :system_account,
234
236
  account_properties: {}
235
237
  )
236
238
  end
@@ -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
@@ -2,6 +2,14 @@ module Dscf::Banking
2
2
  class TransactionsController < ApplicationController
3
3
  include Dscf::Core::Common
4
4
 
5
+ rescue_from ActiveRecord::RecordNotFound do |exception|
6
+ render json: {
7
+ success: false,
8
+ error: "Transaction not found",
9
+ errors: ["Transaction with ID #{params[:id]} not found"]
10
+ }, status: :not_found
11
+ end
12
+
5
13
  # Transfer money between accounts (from test cases)
6
14
  def transfer
7
15
  debit_account = Dscf::Banking::Account.find_by(account_number: transfer_params[:debit_account_number])
@@ -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,6 +27,8 @@ 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
33
  end
32
34
 
data/db/seeds.rb CHANGED
@@ -48,4 +48,30 @@ user7 = User.create(name: "Fikirte Alemayehu", email: "fikirte@example.com", pas
48
48
  user7.roles << branch_manager_role
49
49
  puts "Created user: #{user7.name}"
50
50
 
51
+ # Seed system accounts for transaction processing
52
+ puts "Seeding system accounts..."
53
+ system_deposit_account = Dscf::Banking::Account.find_or_create_by(
54
+ name: "System Deposit Account",
55
+ system_account: true
56
+ ) do |account|
57
+ account.currency = "ETB"
58
+ account.status = :active
59
+ account.current_balance = 0
60
+ account.available_balance = 0
61
+ account.minimum_balance = 0
62
+ end
63
+ puts "Created system deposit account: #{system_deposit_account.name}"
64
+
65
+ system_withdrawal_account = Dscf::Banking::Account.find_or_create_by(
66
+ name: "System Withdrawal Account",
67
+ system_account: true
68
+ ) do |account|
69
+ account.currency = "ETB"
70
+ account.status = :active
71
+ account.current_balance = 0
72
+ account.available_balance = 0
73
+ account.minimum_balance = 0
74
+ end
75
+ puts "Created system withdrawal account: #{system_withdrawal_account.name}"
76
+
51
77
  puts "Seeding completed successfully."
@@ -1,5 +1,5 @@
1
1
  module Dscf
2
2
  module Banking
3
- VERSION = "0.2.2"
3
+ VERSION = "0.2.4"
4
4
  end
5
5
  end
@@ -0,0 +1,10 @@
1
+ FactoryBot.define do
2
+ factory :dscf_banking_document, class: "Dscf::Core::Document" do
3
+ association :documentable, factory: :application
4
+ document_type { :business_license }
5
+ verified_by { nil }
6
+
7
+ # For file attachment, we can use a simple fixture or skip it in basic tests
8
+ # file { Rack::Test::UploadedFile.new(Rails.root.join('spec', 'fixtures', 'test.pdf'), 'application/pdf') }
9
+ end
10
+ 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.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-11 00:00:00.000000000 Z
10
+ date: 2025-10-13 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rails
@@ -442,6 +442,7 @@ files:
442
442
  - app/controllers/dscf/banking/accounts_controller.rb
443
443
  - app/controllers/dscf/banking/application_controller.rb
444
444
  - app/controllers/dscf/banking/applications_controller.rb
445
+ - app/controllers/dscf/banking/documents_controller.rb
445
446
  - app/controllers/dscf/banking/interest_configurations_controller.rb
446
447
  - app/controllers/dscf/banking/interest_rate_tiers_controller.rb
447
448
  - app/controllers/dscf/banking/interest_rate_types_controller.rb
@@ -467,6 +468,7 @@ files:
467
468
  - app/models/dscf/banking/virtual_account_product.rb
468
469
  - app/serializers/dscf/banking/account_serializer.rb
469
470
  - app/serializers/dscf/banking/application_serializer.rb
471
+ - app/serializers/dscf/banking/document_serializer.rb
470
472
  - app/serializers/dscf/banking/interest_configuration_serializer.rb
471
473
  - app/serializers/dscf/banking/interest_rate_tier_serializer.rb
472
474
  - app/serializers/dscf/banking/interest_rate_type_serializer.rb
@@ -504,6 +506,7 @@ files:
504
506
  - lib/tasks/dscf/banking_tasks.rake
505
507
  - spec/factories/dscf/banking/accounts.rb
506
508
  - spec/factories/dscf/banking/applications.rb
509
+ - spec/factories/dscf/banking/documents.rb
507
510
  - spec/factories/dscf/banking/interest_configurations.rb
508
511
  - spec/factories/dscf/banking/interest_rate_tiers.rb
509
512
  - spec/factories/dscf/banking/interest_rate_types.rb