snf_core 0.2.94 → 0.2.97

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.
Files changed (145) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/snf_core/auth_controller.rb +12 -44
  3. data/app/models/snf_core/account_transfer.rb +37 -0
  4. data/app/models/snf_core/item_request.rb +27 -0
  5. data/app/models/snf_core/quotation.rb +41 -0
  6. data/app/models/snf_core/user.rb +18 -18
  7. data/app/models/snf_core/virtual_account.rb +41 -0
  8. data/app/models/snf_core/virtual_account_transaction.rb +52 -0
  9. data/config/routes.rb +0 -3
  10. data/db/migrate/20250310122954_create_snf_core_virtual_accounts.rb +22 -0
  11. data/db/migrate/20250310123127_add_kyc_attributes_to_user.rb +17 -0
  12. data/db/migrate/20250310133249_create_snf_core_virtual_account_transactions.rb +18 -0
  13. data/db/migrate/20250310143604_create_snf_core_item_requests.rb +14 -0
  14. data/db/migrate/20250311000000_create_snf_core_account_transfers.rb +21 -0
  15. data/db/migrate/20250312043359_create_snf_core_quotations.rb +14 -0
  16. data/lib/snf_core/version.rb +1 -1
  17. data/spec/dummy/db/schema.rb +130 -27
  18. data/spec/dummy/log/development.log +2618 -0
  19. data/spec/dummy/log/test.log +110127 -0
  20. data/spec/dummy/tmp/storage/00/ch/00ch4m884d5bnelqgd2ld1qig6ey +0 -0
  21. data/spec/dummy/tmp/storage/0s/ba/0sbase6mg5sgich6or97cg1faxlw +0 -0
  22. data/spec/dummy/tmp/storage/0x/uy/0xuyfqa0t08zr8vfm8p123o0s34t +0 -0
  23. data/spec/dummy/tmp/storage/1o/ts/1otsbrqkd6n4qiht1wabl7fhjnt3 +0 -0
  24. data/spec/dummy/tmp/storage/1v/54/1v542i134jpb9iwbq9m1v801y0ls +0 -0
  25. data/spec/dummy/tmp/storage/1y/46/1y4617uv2nrk9fa58zfv9xyixmfk +0 -0
  26. data/spec/dummy/tmp/storage/24/kq/24kq40q48k7jry3npyah0td4uend +0 -0
  27. data/spec/dummy/tmp/storage/28/ye/28yeusf04wxopqkg0bxki7mqo9ph +0 -0
  28. data/spec/dummy/tmp/storage/2r/hv/2rhvs6uca2ozrojfuub5d4qk0ugy +0 -0
  29. data/spec/dummy/tmp/storage/2w/r1/2wr14buxnrx4cee19gj6sefnbby5 +0 -0
  30. data/spec/dummy/tmp/storage/3k/7z/3k7zlcd9fm2jwn99kinxpahrmm4u +0 -0
  31. data/spec/dummy/tmp/storage/3o/2a/3o2ahddfby8aqgutow91vo4asm4f +0 -0
  32. data/spec/dummy/tmp/storage/46/zj/46zjkljy84qmg4ebes40e2zolzp7 +0 -0
  33. data/spec/dummy/tmp/storage/4f/fl/4fflxsg2pissq4960wfazyv9mgp1 +0 -0
  34. data/spec/dummy/tmp/storage/4l/6a/4l6ap3t705ektu02kabqobaq8huf +0 -0
  35. data/spec/dummy/tmp/storage/4m/3n/4m3n3r5zl2jevvvw3alq0omnnowk +0 -0
  36. data/spec/dummy/tmp/storage/4t/qc/4tqc587gmu2g7hgntrgjnhkw0e1u +0 -0
  37. data/spec/dummy/tmp/storage/4w/76/4w7656628v1p4mp87fqz3okc6ix4 +0 -0
  38. data/spec/dummy/tmp/storage/50/ct/50ctjwt8y93spjaef1b3rfnav9gb +0 -0
  39. data/spec/dummy/tmp/storage/5m/0k/5m0k5zx08ouqos7rs09bpgmalspu +0 -0
  40. data/spec/dummy/tmp/storage/5m/4n/5m4nvbe3vqwrdpy6hujr1oq5nolv +0 -0
  41. data/spec/dummy/tmp/storage/5m/j8/5mj8ypl6zxx8g3h7vqmu4p2la4pk +0 -0
  42. data/spec/dummy/tmp/storage/5r/tv/5rtv2agppt9e52eg0oc81svs896e +0 -0
  43. data/spec/dummy/tmp/storage/5s/b6/5sb6kux9jtdj4du9ihu32tc82s12 +0 -0
  44. data/spec/dummy/tmp/storage/5t/84/5t84ncnwqnv83rndaztqz1dsae3v +0 -0
  45. data/spec/dummy/tmp/storage/6h/9a/6h9a6bxecnlwx7zbb4dc33rmftee +0 -0
  46. data/spec/dummy/tmp/storage/6h/pd/6hpdw0r7w6vpcotirwqz1fv640kk +0 -0
  47. data/spec/dummy/tmp/storage/6i/dm/6idmnfdfriqdmvcvgreyeho4xgra +0 -0
  48. data/spec/dummy/tmp/storage/6n/3b/6n3bufdfx1tvls9lzm3g625l1lyk +0 -0
  49. data/spec/dummy/tmp/storage/78/5u/785ub96ra353qygeubpq4vlifjas +0 -0
  50. data/spec/dummy/tmp/storage/7v/55/7v55c4y5xdiw6qrvbdpmd63v4toz +0 -0
  51. data/spec/dummy/tmp/storage/83/yi/83yiflnj2evgqahmzgiavbywle7h +0 -0
  52. data/spec/dummy/tmp/storage/8a/02/8a02q8tcm3lowda8cvcjh18tka7i +0 -0
  53. data/spec/dummy/tmp/storage/8g/4a/8g4aarquz0mos9gxzq6j7xzwli09 +0 -0
  54. data/spec/dummy/tmp/storage/8k/0m/8k0mv7xql5lr89d0172izqplypwx +0 -0
  55. data/spec/dummy/tmp/storage/8n/lz/8nlzdb800dgr9iax1ez2ko4euh02 +0 -0
  56. data/spec/dummy/tmp/storage/8y/y2/8yy2kqz8sa11vh7naiomyofj30ox +0 -0
  57. data/spec/dummy/tmp/storage/92/hz/92hz15r26fs5wymc6tced4b08bh6 +0 -0
  58. data/spec/dummy/tmp/storage/9k/wj/9kwjdz4yw0jyzddj32u97xciot47 +0 -0
  59. data/spec/dummy/tmp/storage/a0/ve/a0veqfafcpy1hl6jvg6jc4qt08kr +0 -0
  60. data/spec/dummy/tmp/storage/ak/g9/akg9bg7fdwisycbclvmikbzl676j +0 -0
  61. data/spec/dummy/tmp/storage/ap/fs/apfsy6cp4mt4jsyiyscutqhv36id +0 -0
  62. data/spec/dummy/tmp/storage/b2/ux/b2uxv1pu0hjqty7779grby8qxzoo +0 -0
  63. data/spec/dummy/tmp/storage/bh/s1/bhs1yc1jo5vhc1u8lz7zme0sowln +0 -0
  64. data/spec/dummy/tmp/storage/c6/29/c6299u91u1tc5bc7eb24yq8k7xgk +0 -0
  65. data/spec/dummy/tmp/storage/cb/dh/cbdhbsxm7irfbsrniqvxnfukotka +0 -0
  66. data/spec/dummy/tmp/storage/dj/zr/djzriitbyq5sebmjs7nf0wqijzl2 +0 -0
  67. data/spec/dummy/tmp/storage/dk/z6/dkz6yvma826vmeofy924nzacyi6a +0 -0
  68. data/spec/dummy/tmp/storage/dw/75/dw75t7gej4irzb3hcqssl8w5vhde +0 -0
  69. data/spec/dummy/tmp/storage/dz/dq/dzdq3gkuy7tdiue1yqmciu86nzfg +0 -0
  70. data/spec/dummy/tmp/storage/e6/5h/e65haeyr0sglopfuo5chz55thi9z +0 -0
  71. data/spec/dummy/tmp/storage/ez/kd/ezkdx2jgksxsm9fdwpx5qw8qd6hb +0 -0
  72. data/spec/dummy/tmp/storage/ft/pz/ftpzprhag9awyjvcac1xiqv9qngf +0 -0
  73. data/spec/dummy/tmp/storage/g1/fp/g1fprpwzsoltdd9atheqqbmt75w1 +0 -0
  74. data/spec/dummy/tmp/storage/g6/7r/g67rz6k8b5kmrfsk91e77d37vnfg +0 -0
  75. data/spec/dummy/tmp/storage/ik/r8/ikr86smhkvxy0yrqxjr0iubcuy5s +0 -0
  76. data/spec/dummy/tmp/storage/ip/yy/ipyyodp4f221bzp384ncz3alga7l +0 -0
  77. data/spec/dummy/tmp/storage/j4/ln/j4lnbjjufbp59yxsdetbqs0cyjia +0 -0
  78. data/spec/dummy/tmp/storage/jc/jk/jcjkdsojvg0n7abwcfpscbkrlvoj +0 -0
  79. data/spec/dummy/tmp/storage/jd/ik/jdik45lk030wwyyfs9xy6m4q0sv9 +0 -0
  80. data/spec/dummy/tmp/storage/jo/34/jo34sgi1pzpkbryh3z6bmeccbada +0 -0
  81. data/spec/dummy/tmp/storage/jw/gm/jwgmfnb1z5jahut7upw5lwnh6orj +0 -0
  82. data/spec/dummy/tmp/storage/kv/7m/kv7mdo1kvqnagfcp1dit4pzrlugm +0 -0
  83. data/spec/dummy/tmp/storage/kz/ao/kzao8av3jxls3bjeal7bv2qefcq2 +0 -0
  84. data/spec/dummy/tmp/storage/l8/1u/l81unawd0p9c61x8k6ofq0y227yt +0 -0
  85. data/spec/dummy/tmp/storage/lp/iz/lpizuy9o61mj9a6nsp66uhxmwifn +0 -0
  86. data/spec/dummy/tmp/storage/lu/ge/lugetp9a4lxzimpwttg2bkmrv1tf +0 -0
  87. data/spec/dummy/tmp/storage/m0/hl/m0hl9jcc1ra6ogfep0yxwon1n8e4 +0 -0
  88. data/spec/dummy/tmp/storage/md/94/md943ike1q6c3z19js6h89ghdqpd +0 -0
  89. data/spec/dummy/tmp/storage/mi/y2/miy2op7reeft1521or0hx3sa03qi +0 -0
  90. data/spec/dummy/tmp/storage/n4/6y/n46y5dyl1uf9ihlyp79fzdxny80f +0 -0
  91. data/spec/dummy/tmp/storage/ng/sy/ngsy8siky5us2x8cr54uxlzwoji5 +0 -0
  92. data/spec/dummy/tmp/storage/nq/9r/nq9rfa8upvcoyx92za4fhzrmob0t +0 -0
  93. data/spec/dummy/tmp/storage/nz/h5/nzh5f9vo9icpp0qvxvvm57ivsy85 +0 -0
  94. data/spec/dummy/tmp/storage/o3/3e/o33eo1zb3spyqgqbtugs43olucmj +0 -0
  95. data/spec/dummy/tmp/storage/oc/zy/oczyqb5chp2fvo9kdu62c3y7pl5i +0 -0
  96. data/spec/dummy/tmp/storage/of/zt/ofzt1knekv9ft8direbw6fiaacvc +0 -0
  97. data/spec/dummy/tmp/storage/oh/ls/ohlsxs36tio52r2ydrbzez1u0w26 +0 -0
  98. data/spec/dummy/tmp/storage/ol/u8/olu875ti78gguc82spdkt9z8tpii +0 -0
  99. data/spec/dummy/tmp/storage/pe/xm/pexmtjvhiiepbza9928j2j0uo6ub +0 -0
  100. data/spec/dummy/tmp/storage/q4/wp/q4wpnk0ajsmg3nnpj2xja15tc1az +0 -0
  101. data/spec/dummy/tmp/storage/q7/48/q748a4a7d3qk28vajhbkli5tttsj +0 -0
  102. data/spec/dummy/tmp/storage/qg/qu/qgquu27ysijim1jv06k39a3c3opr +0 -0
  103. data/spec/dummy/tmp/storage/qo/zx/qozxdnemk1fwxcvhe1j10ys7mxcq +0 -0
  104. data/spec/dummy/tmp/storage/qq/vt/qqvtf3h8ge74ce67gghth8ivch0g +0 -0
  105. data/spec/dummy/tmp/storage/rg/hw/rghwbui1nfqvuuja4hqvzvwofucm +0 -0
  106. data/spec/dummy/tmp/storage/rj/4a/rj4a0t2xebuf22tyhuitu7x0h0ct +0 -0
  107. data/spec/dummy/tmp/storage/ro/gg/roggtjpn82v1pf5hi9c72ta6uxt7 +0 -0
  108. data/spec/dummy/tmp/storage/sd/b5/sdb5dbqjlz1nng8qaejdmh94h5kh +0 -0
  109. data/spec/dummy/tmp/storage/t6/h0/t6h0whv9denben7ktf5maaohv9dg +0 -0
  110. data/spec/dummy/tmp/storage/u8/dc/u8dc1at72gpsq6d2fqb81rku7xq9 +0 -0
  111. data/spec/dummy/tmp/storage/v5/c9/v5c9opt3yikmy2gwg4ftmde0vyt5 +0 -0
  112. data/spec/dummy/tmp/storage/v8/cs/v8csqmcgvc4z177g5hfmp7twf6ay +0 -0
  113. data/spec/dummy/tmp/storage/vb/z1/vbz124po6xcx6fbh4nefle8r6of3 +0 -0
  114. data/spec/dummy/tmp/storage/vc/0v/vc0vb76xhipq8d5xrmqnnvlkbxhi +0 -0
  115. data/spec/dummy/tmp/storage/vc/eu/vceu8un4vczdune7r9oaihtx3l09 +0 -0
  116. data/spec/dummy/tmp/storage/vg/qn/vgqnfl62z1s3940ei2s9ifrjufiz +0 -0
  117. data/spec/dummy/tmp/storage/vz/qz/vzqz49sc3hfzbcaawqw6yuqzpocv +0 -0
  118. data/spec/dummy/tmp/storage/w1/9e/w19epnmenhmu0y14exloj2oskf53 +0 -0
  119. data/spec/dummy/tmp/storage/w4/k8/w4k8g0iv6qtdhzyw454un1d048hp +0 -0
  120. data/spec/dummy/tmp/storage/wv/8i/wv8iai6dxxh2wqwnj667p5rre1tn +0 -0
  121. data/spec/dummy/tmp/storage/xd/fp/xdfpr9gw2neskzyq6cfxyj2lsa47 +0 -0
  122. data/spec/dummy/tmp/storage/xh/4e/xh4e0tnk5ysrfndrhyu9u0ywueku +0 -0
  123. data/spec/dummy/tmp/storage/xj/d2/xjd2s558zk0eduk4f25ul4t29b2r +0 -0
  124. data/spec/dummy/tmp/storage/yi/r2/yir26w0pcj2268kp8biw0lcrnimz +0 -0
  125. data/spec/dummy/tmp/storage/yj/d7/yjd7k0ea2d8y6yjp8syfudd0qvhr +0 -0
  126. data/spec/dummy/tmp/storage/z0/il/z0ilfyp3hmqqn6alkocrt7y949ee +0 -0
  127. data/spec/dummy/tmp/storage/za/ov/zaov1yasuhakxa5olzoed94khnf8 +0 -0
  128. data/spec/dummy/tmp/storage/zc/d6/zcd6d4lsb12obz7m7r6240qka8xw +0 -0
  129. data/spec/dummy/tmp/storage/zc/i3/zci3kt86sywh9q6u7xv7yt38xznu +0 -0
  130. data/spec/examples.txt +199 -128
  131. data/spec/factories/snf_core/account_transfers.rb +27 -0
  132. data/spec/factories/snf_core/addresses.rb +1 -0
  133. data/spec/factories/snf_core/item_requests.rb +26 -0
  134. data/spec/factories/snf_core/quotations.rb +10 -0
  135. data/spec/factories/snf_core/users.rb +10 -1
  136. data/spec/factories/snf_core/virtual_account_transactions.rb +33 -0
  137. data/spec/factories/snf_core/virtual_accounts.rb +32 -0
  138. data/spec/models/snf_core/account_transfer_spec.rb +29 -0
  139. data/spec/models/snf_core/item_request_spec.rb +44 -0
  140. data/spec/models/snf_core/quotation_spec.rb +54 -0
  141. data/spec/models/snf_core/user_spec.rb +18 -22
  142. data/spec/models/snf_core/virtual_account_spec.rb +85 -0
  143. data/spec/models/snf_core/virtual_account_transaction_spec.rb +72 -0
  144. data/spec/requests/snf_core/auth_spec.rb +11 -85
  145. metadata +133 -2
@@ -10,7 +10,7 @@
10
10
  #
11
11
  # It's strongly recommended that you check this file into your version control system.
12
12
 
13
- ActiveRecord::Schema[8.0].define(version: 2025_03_06_074713) do
13
+ ActiveRecord::Schema[8.0].define(version: 2025_03_12_043359) do
14
14
  # These are extensions that must be enabled in order to support this database
15
15
  enable_extension "pg_catalog.plpgsql"
16
16
 
@@ -20,8 +20,8 @@ ActiveRecord::Schema[8.0].define(version: 2025_03_06_074713) do
20
20
  t.bigint "record_id", null: false
21
21
  t.bigint "blob_id", null: false
22
22
  t.datetime "created_at", null: false
23
- t.index [ "blob_id" ], name: "index_active_storage_attachments_on_blob_id"
24
- t.index [ "record_type", "record_id", "name", "blob_id" ], name: "index_active_storage_attachments_uniqueness", unique: true
23
+ t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id"
24
+ t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true
25
25
  end
26
26
 
27
27
  create_table "active_storage_blobs", force: :cascade do |t|
@@ -33,13 +33,37 @@ ActiveRecord::Schema[8.0].define(version: 2025_03_06_074713) do
33
33
  t.bigint "byte_size", null: false
34
34
  t.string "checksum"
35
35
  t.datetime "created_at", null: false
36
- t.index [ "key" ], name: "index_active_storage_blobs_on_key", unique: true
36
+ t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true
37
37
  end
38
38
 
39
39
  create_table "active_storage_variant_records", force: :cascade do |t|
40
40
  t.bigint "blob_id", null: false
41
41
  t.string "variation_digest", null: false
42
- t.index [ "blob_id", "variation_digest" ], name: "index_active_storage_variant_records_uniqueness", unique: true
42
+ t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true
43
+ end
44
+
45
+ create_table "snf_core_account_transfers", force: :cascade do |t|
46
+ t.string "source_account_type", null: false
47
+ t.bigint "source_account_id", null: false
48
+ t.string "destination_account_type", null: false
49
+ t.bigint "destination_account_id", null: false
50
+ t.bigint "user_id", null: false
51
+ t.decimal "amount", precision: 15, scale: 2, null: false
52
+ t.string "reference_number", null: false
53
+ t.integer "status", default: 0, null: false
54
+ t.integer "transfer_type", null: false
55
+ t.text "description"
56
+ t.text "failure_reason"
57
+ t.datetime "completed_at"
58
+ t.bigint "reversal_transfer_id"
59
+ t.jsonb "cbs_response_data"
60
+ t.datetime "created_at", null: false
61
+ t.datetime "updated_at", null: false
62
+ t.index ["destination_account_type", "destination_account_id"], name: "index_snf_core_account_transfers_on_destination_account"
63
+ t.index ["reference_number"], name: "index_snf_core_account_transfers_on_reference_number", unique: true
64
+ t.index ["reversal_transfer_id"], name: "index_snf_core_account_transfers_on_reversal_transfer_id"
65
+ t.index ["source_account_type", "source_account_id"], name: "index_snf_core_account_transfers_on_source_account"
66
+ t.index ["user_id"], name: "index_snf_core_account_transfers_on_user_id"
43
67
  end
44
68
 
45
69
  create_table "snf_core_addresses", force: :cascade do |t|
@@ -51,6 +75,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_03_06_074713) do
51
75
  t.decimal "longitude", null: false
52
76
  t.datetime "created_at", null: false
53
77
  t.datetime "updated_at", null: false
78
+ t.string "house_number"
54
79
  end
55
80
 
56
81
  create_table "snf_core_business_documents", force: :cascade do |t|
@@ -62,8 +87,8 @@ ActiveRecord::Schema[8.0].define(version: 2025_03_06_074713) do
62
87
  t.boolean "is_verified", default: false, null: false
63
88
  t.datetime "created_at", null: false
64
89
  t.datetime "updated_at", null: false
65
- t.index [ "business_id" ], name: "index_snf_core_business_documents_on_business_id"
66
- t.index [ "verified_by_id" ], name: "index_snf_core_business_documents_on_verified_by_id"
90
+ t.index ["business_id"], name: "index_snf_core_business_documents_on_business_id"
91
+ t.index ["verified_by_id"], name: "index_snf_core_business_documents_on_verified_by_id"
67
92
  end
68
93
 
69
94
  create_table "snf_core_businesses", force: :cascade do |t|
@@ -75,7 +100,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_03_06_074713) do
75
100
  t.integer "verification_status", default: 0, null: false
76
101
  t.datetime "created_at", null: false
77
102
  t.datetime "updated_at", null: false
78
- t.index [ "user_id" ], name: "index_snf_core_businesses_on_user_id"
103
+ t.index ["user_id"], name: "index_snf_core_businesses_on_user_id"
79
104
  end
80
105
 
81
106
  create_table "snf_core_categories", force: :cascade do |t|
@@ -84,7 +109,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_03_06_074713) do
84
109
  t.bigint "parent_id"
85
110
  t.datetime "created_at", null: false
86
111
  t.datetime "updated_at", null: false
87
- t.index [ "parent_id" ], name: "index_snf_core_categories_on_parent_id"
112
+ t.index ["parent_id"], name: "index_snf_core_categories_on_parent_id"
88
113
  end
89
114
 
90
115
  create_table "snf_core_customer_groups", force: :cascade do |t|
@@ -95,8 +120,8 @@ ActiveRecord::Schema[8.0].define(version: 2025_03_06_074713) do
95
120
  t.bigint "customer_id", null: false
96
121
  t.datetime "created_at", null: false
97
122
  t.datetime "updated_at", null: false
98
- t.index [ "customer_id" ], name: "index_snf_core_customer_groups_on_customer_id"
99
- t.index [ "group_id" ], name: "index_snf_core_customer_groups_on_group_id"
123
+ t.index ["customer_id"], name: "index_snf_core_customer_groups_on_customer_id"
124
+ t.index ["group_id"], name: "index_snf_core_customer_groups_on_group_id"
100
125
  end
101
126
 
102
127
  create_table "snf_core_delivery_orders", force: :cascade do |t|
@@ -109,7 +134,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_03_06_074713) do
109
134
  t.integer "status", null: false
110
135
  t.datetime "created_at", null: false
111
136
  t.datetime "updated_at", null: false
112
- t.index [ "order_id" ], name: "index_snf_core_delivery_orders_on_order_id"
137
+ t.index ["order_id"], name: "index_snf_core_delivery_orders_on_order_id"
113
138
  end
114
139
 
115
140
  create_table "snf_core_groups", force: :cascade do |t|
@@ -117,7 +142,20 @@ ActiveRecord::Schema[8.0].define(version: 2025_03_06_074713) do
117
142
  t.bigint "business_id", null: false
118
143
  t.datetime "created_at", null: false
119
144
  t.datetime "updated_at", null: false
120
- t.index [ "business_id" ], name: "index_snf_core_groups_on_business_id"
145
+ t.index ["business_id"], name: "index_snf_core_groups_on_business_id"
146
+ end
147
+
148
+ create_table "snf_core_item_requests", force: :cascade do |t|
149
+ t.bigint "user_id", null: false
150
+ t.bigint "product_id", null: false
151
+ t.integer "quantity", null: false
152
+ t.date "requested_delivery_date", null: false
153
+ t.text "notes"
154
+ t.integer "status", default: 0, null: false
155
+ t.datetime "created_at", null: false
156
+ t.datetime "updated_at", null: false
157
+ t.index ["product_id"], name: "index_snf_core_item_requests_on_product_id"
158
+ t.index ["user_id"], name: "index_snf_core_item_requests_on_user_id"
121
159
  end
122
160
 
123
161
  create_table "snf_core_order_items", force: :cascade do |t|
@@ -128,8 +166,8 @@ ActiveRecord::Schema[8.0].define(version: 2025_03_06_074713) do
128
166
  t.decimal "subtotal", null: false
129
167
  t.datetime "created_at", null: false
130
168
  t.datetime "updated_at", null: false
131
- t.index [ "order_id" ], name: "index_snf_core_order_items_on_order_id"
132
- t.index [ "store_inventory_id" ], name: "index_snf_core_order_items_on_store_inventory_id"
169
+ t.index ["order_id"], name: "index_snf_core_order_items_on_order_id"
170
+ t.index ["store_inventory_id"], name: "index_snf_core_order_items_on_store_inventory_id"
133
171
  end
134
172
 
135
173
  create_table "snf_core_orders", force: :cascade do |t|
@@ -139,8 +177,8 @@ ActiveRecord::Schema[8.0].define(version: 2025_03_06_074713) do
139
177
  t.decimal "total_amount", default: "0.0", null: false
140
178
  t.datetime "created_at", null: false
141
179
  t.datetime "updated_at", null: false
142
- t.index [ "store_id" ], name: "index_snf_core_orders_on_store_id"
143
- t.index [ "user_id" ], name: "index_snf_core_orders_on_user_id"
180
+ t.index ["store_id"], name: "index_snf_core_orders_on_store_id"
181
+ t.index ["user_id"], name: "index_snf_core_orders_on_user_id"
144
182
  end
145
183
 
146
184
  create_table "snf_core_products", force: :cascade do |t|
@@ -151,7 +189,19 @@ ActiveRecord::Schema[8.0].define(version: 2025_03_06_074713) do
151
189
  t.float "base_price"
152
190
  t.datetime "created_at", null: false
153
191
  t.datetime "updated_at", null: false
154
- t.index [ "category_id" ], name: "index_snf_core_products_on_category_id"
192
+ t.index ["category_id"], name: "index_snf_core_products_on_category_id"
193
+ end
194
+
195
+ create_table "snf_core_quotations", force: :cascade do |t|
196
+ t.bigint "item_request_id", null: false
197
+ t.decimal "price", null: false
198
+ t.date "delivery_date", null: false
199
+ t.datetime "valid_until", null: false
200
+ t.integer "status", default: 0, null: false
201
+ t.text "notes"
202
+ t.datetime "created_at", null: false
203
+ t.datetime "updated_at", null: false
204
+ t.index ["item_request_id"], name: "index_snf_core_quotations_on_item_request_id"
155
205
  end
156
206
 
157
207
  create_table "snf_core_roles", force: :cascade do |t|
@@ -167,9 +217,9 @@ ActiveRecord::Schema[8.0].define(version: 2025_03_06_074713) do
167
217
  t.datetime "created_at", null: false
168
218
  t.datetime "updated_at", null: false
169
219
  t.integer "status", default: 0, null: false
170
- t.index [ "product_id" ], name: "index_snf_core_store_inventories_on_product_id"
171
- t.index [ "store_id", "product_id" ], name: "index_snf_core_store_inventories_on_store_id_and_product_id", unique: true
172
- t.index [ "store_id" ], name: "index_snf_core_store_inventories_on_store_id"
220
+ t.index ["product_id"], name: "index_snf_core_store_inventories_on_product_id"
221
+ t.index ["store_id", "product_id"], name: "index_snf_core_store_inventories_on_store_id_and_product_id", unique: true
222
+ t.index ["store_id"], name: "index_snf_core_store_inventories_on_store_id"
173
223
  end
174
224
 
175
225
  create_table "snf_core_stores", force: :cascade do |t|
@@ -180,8 +230,8 @@ ActiveRecord::Schema[8.0].define(version: 2025_03_06_074713) do
180
230
  t.bigint "address_id", null: false
181
231
  t.datetime "created_at", null: false
182
232
  t.datetime "updated_at", null: false
183
- t.index [ "address_id" ], name: "index_snf_core_stores_on_address_id"
184
- t.index [ "business_id" ], name: "index_snf_core_stores_on_business_id"
233
+ t.index ["address_id"], name: "index_snf_core_stores_on_address_id"
234
+ t.index ["business_id"], name: "index_snf_core_stores_on_business_id"
185
235
  end
186
236
 
187
237
  create_table "snf_core_user_roles", force: :cascade do |t|
@@ -189,8 +239,8 @@ ActiveRecord::Schema[8.0].define(version: 2025_03_06_074713) do
189
239
  t.bigint "role_id", null: false
190
240
  t.datetime "created_at", null: false
191
241
  t.datetime "updated_at", null: false
192
- t.index [ "role_id" ], name: "index_snf_core_user_roles_on_role_id"
193
- t.index [ "user_id" ], name: "index_snf_core_user_roles_on_user_id"
242
+ t.index ["role_id"], name: "index_snf_core_user_roles_on_role_id"
243
+ t.index ["user_id"], name: "index_snf_core_user_roles_on_user_id"
194
244
  end
195
245
 
196
246
  create_table "snf_core_users", force: :cascade do |t|
@@ -204,6 +254,50 @@ ActiveRecord::Schema[8.0].define(version: 2025_03_06_074713) do
204
254
  t.string "password_digest", null: false
205
255
  t.boolean "password_changed", default: false
206
256
  t.string "reset_password_token"
257
+ t.date "date_of_birth", null: false
258
+ t.string "nationality", null: false
259
+ t.string "occupation"
260
+ t.string "source_of_funds"
261
+ t.integer "kyc_status"
262
+ t.integer "gender"
263
+ t.datetime "verified_at"
264
+ t.bigint "verified_by_id"
265
+ t.bigint "address_id"
266
+ end
267
+
268
+ create_table "snf_core_virtual_account_transactions", force: :cascade do |t|
269
+ t.bigint "from_account_id"
270
+ t.bigint "to_account_id"
271
+ t.decimal "amount", null: false
272
+ t.integer "transaction_type", null: false
273
+ t.integer "status", default: 0, null: false
274
+ t.string "reference_number", null: false
275
+ t.text "description"
276
+ t.datetime "created_at", null: false
277
+ t.datetime "updated_at", null: false
278
+ t.index ["created_at"], name: "index_snf_core_virtual_account_transactions_on_created_at"
279
+ t.index ["from_account_id"], name: "index_snf_core_virtual_account_transactions_on_from_account_id"
280
+ t.index ["reference_number"], name: "idx_on_reference_number_bd9be00f20", unique: true
281
+ t.index ["to_account_id"], name: "index_snf_core_virtual_account_transactions_on_to_account_id"
282
+ end
283
+
284
+ create_table "snf_core_virtual_accounts", force: :cascade do |t|
285
+ t.bigint "user_id", null: false
286
+ t.string "account_number", limit: 11, null: false
287
+ t.string "cbs_account_number", null: false
288
+ t.decimal "balance", default: "0.0", null: false
289
+ t.decimal "interest_rate", default: "0.0", null: false
290
+ t.integer "interest_type", default: 0, null: false
291
+ t.boolean "active", default: true, null: false
292
+ t.string "branch_code", limit: 3, null: false
293
+ t.string "product_scheme", limit: 1, null: false
294
+ t.string "voucher_type", limit: 1, null: false
295
+ t.datetime "created_at", null: false
296
+ t.datetime "updated_at", null: false
297
+ t.index ["account_number"], name: "index_snf_core_virtual_accounts_on_account_number", unique: true
298
+ t.index ["branch_code", "product_scheme", "voucher_type"], name: "idx_on_branch_code_product_scheme_voucher_type_b7038b3d5f"
299
+ t.index ["cbs_account_number"], name: "index_snf_core_virtual_accounts_on_cbs_account_number", unique: true
300
+ t.index ["user_id"], name: "index_snf_core_virtual_accounts_on_user_id"
207
301
  end
208
302
 
209
303
  create_table "snf_core_wallets", force: :cascade do |t|
@@ -213,12 +307,13 @@ ActiveRecord::Schema[8.0].define(version: 2025_03_06_074713) do
213
307
  t.boolean "is_active", default: true, null: false
214
308
  t.datetime "created_at", null: false
215
309
  t.datetime "updated_at", null: false
216
- t.index [ "user_id" ], name: "index_snf_core_wallets_on_user_id"
217
- t.index [ "wallet_number" ], name: "index_snf_core_wallets_on_wallet_number", unique: true
310
+ t.index ["user_id"], name: "index_snf_core_wallets_on_user_id"
311
+ t.index ["wallet_number"], name: "index_snf_core_wallets_on_wallet_number", unique: true
218
312
  end
219
313
 
220
314
  add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
221
315
  add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
316
+ add_foreign_key "snf_core_account_transfers", "snf_core_users", column: "user_id"
222
317
  add_foreign_key "snf_core_business_documents", "snf_core_businesses", column: "business_id"
223
318
  add_foreign_key "snf_core_business_documents", "snf_core_users", column: "verified_by_id"
224
319
  add_foreign_key "snf_core_businesses", "snf_core_users", column: "user_id"
@@ -227,16 +322,24 @@ ActiveRecord::Schema[8.0].define(version: 2025_03_06_074713) do
227
322
  add_foreign_key "snf_core_customer_groups", "snf_core_users", column: "customer_id"
228
323
  add_foreign_key "snf_core_delivery_orders", "snf_core_orders", column: "order_id"
229
324
  add_foreign_key "snf_core_groups", "snf_core_businesses", column: "business_id"
325
+ add_foreign_key "snf_core_item_requests", "snf_core_products", column: "product_id"
326
+ add_foreign_key "snf_core_item_requests", "snf_core_users", column: "user_id"
230
327
  add_foreign_key "snf_core_order_items", "snf_core_orders", column: "order_id"
231
328
  add_foreign_key "snf_core_order_items", "snf_core_store_inventories", column: "store_inventory_id"
232
329
  add_foreign_key "snf_core_orders", "snf_core_stores", column: "store_id"
233
330
  add_foreign_key "snf_core_orders", "snf_core_users", column: "user_id"
234
331
  add_foreign_key "snf_core_products", "snf_core_categories", column: "category_id"
332
+ add_foreign_key "snf_core_quotations", "snf_core_item_requests", column: "item_request_id"
235
333
  add_foreign_key "snf_core_store_inventories", "snf_core_products", column: "product_id"
236
334
  add_foreign_key "snf_core_store_inventories", "snf_core_stores", column: "store_id"
237
335
  add_foreign_key "snf_core_stores", "snf_core_addresses", column: "address_id"
238
336
  add_foreign_key "snf_core_stores", "snf_core_businesses", column: "business_id"
239
337
  add_foreign_key "snf_core_user_roles", "snf_core_roles", column: "role_id"
240
338
  add_foreign_key "snf_core_user_roles", "snf_core_users", column: "user_id"
339
+ add_foreign_key "snf_core_users", "snf_core_addresses", column: "address_id"
340
+ add_foreign_key "snf_core_users", "snf_core_users", column: "verified_by_id", on_delete: :nullify
341
+ add_foreign_key "snf_core_virtual_account_transactions", "snf_core_virtual_accounts", column: "from_account_id"
342
+ add_foreign_key "snf_core_virtual_account_transactions", "snf_core_virtual_accounts", column: "to_account_id"
343
+ add_foreign_key "snf_core_virtual_accounts", "snf_core_users", column: "user_id"
241
344
  add_foreign_key "snf_core_wallets", "snf_core_users", column: "user_id"
242
345
  end