bscf-core 0.3.98 → 0.3.99

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: 5d6e29a6fe52791c63a6ac04626a7b35f11b4648fcd554c8c4d5e8241b4107fa
4
- data.tar.gz: 6f5fe2859090c771bd496335e49969fcff65800e3173918a8714a3b1f1eedd5e
3
+ metadata.gz: 7ba4cb08d046b4bcef3b55100146f08c64fa32d7b97f59302ffdf8ef1a804737
4
+ data.tar.gz: da7bd6abdf23ec993e8442e998853118533d2f2d7773de25155aca33c6569c22
5
5
  SHA512:
6
- metadata.gz: ebd0b053b1456de1e56d3a369441c1d5fb134531f35c70cbab87430063979a6ea0fa9117ed85d4fcad8bb65cb0bdfe00cd85fe34d6ef20afdc0d89aab288c045
7
- data.tar.gz: 6265ca3093db1bae9d6205b5e0eee1d97b583b42cc8d13b3d17abadcf9d46e4ead1f202fdacb09320f33e9cdbb82e62485b1ce5ceca46002f11b656b33945183
6
+ metadata.gz: 7eca0f066d06df32ff1fcbf12c1056331ada9eef7f5f5cd18d37becc26dfad27a3576e9afc97e157bd7bd133a5c28534c70aeb2c74592c325b67b51bcf42f6e4
7
+ data.tar.gz: 35654a8b5fab7cb7b4bfdaa124014cbf80e9c1b640079ec43a2d95800672d34db54e7ee89c3cacf31eff19f6b627b7e56f8a5f335d70a9308939a19b4932b0b3
@@ -3,8 +3,9 @@ module Bscf
3
3
  class MarketplaceListing < ApplicationRecord
4
4
  belongs_to :user
5
5
  belongs_to :address
6
+ belongs_to :product
6
7
 
7
- validates :listing_type, :status, :is_active, presence: true
8
+ validates :listing_type, :status, :is_active, :price, presence: true
8
9
 
9
10
  enum :listing_type, { buy: 0, sell: 1 }
10
11
  enum :status, { open: 0, partially_matched: 1, matched: 2, completed: 3, cancelled: 4 }
@@ -4,7 +4,7 @@ module Bscf
4
4
  belongs_to :ordered_by, class_name: "Bscf::Core::User", optional: true
5
5
  belongs_to :ordered_to, class_name: "Bscf::Core::User", optional: true
6
6
  belongs_to :quotation, optional: true
7
- belongs_to :delivery_order, optional: true
7
+ belongs_to :delivery_order, optional: true
8
8
  has_many :order_items, dependent: :destroy
9
9
  validates :order_type, :status, presence: true
10
10
 
@@ -88,10 +88,9 @@ module Bscf
88
88
  amount: amount,
89
89
  transaction_type: :transfer
90
90
  )
91
-
91
+
92
92
  transaction.process!
93
93
  end
94
94
  end
95
95
  end
96
96
  end
97
-
@@ -1,7 +1,7 @@
1
1
  module Bscf
2
2
  module Core
3
3
  class Voucher < ApplicationRecord
4
- belongs_to :issued_by, class_name: 'Bscf::Core::User'
4
+ belongs_to :issued_by, class_name: "Bscf::Core::User"
5
5
 
6
6
  validates :full_name, presence: true
7
7
  validates :phone_number, presence: true
@@ -21,7 +21,7 @@ module Bscf
21
21
  before_validation :generate_code, on: :create
22
22
  before_create :set_default_expiry
23
23
  after_create :lock_issuer_amount
24
- after_commit :unlock_issuer_amount, on: [:update], if: :should_unlock_amount?
24
+ after_commit :unlock_issuer_amount, on: [ :update ], if: :should_unlock_amount?
25
25
 
26
26
  def redeem!(to_account)
27
27
  return false unless active?
@@ -8,7 +8,7 @@ class CreateBscfCoreVouchers < ActiveRecord::Migration[8.0]
8
8
  t.string :code, null: false
9
9
  t.integer :status, null: false, default: 0
10
10
  t.datetime :expires_at
11
- t.references :issued_by, null: false, foreign_key: {to_table: :bscf_core_users}
11
+ t.references :issued_by, null: false, foreign_key: { to_table: :bscf_core_users }
12
12
  t.datetime :redeemed_at
13
13
  t.datetime :returned_at
14
14
 
@@ -0,0 +1,9 @@
1
+ class AddProductToMarketPlaceListings < ActiveRecord::Migration[8.0]
2
+ def change
3
+ add_column :bscf_core_marketplace_listings, :product_id, :bigint
4
+ add_column :bscf_core_marketplace_listings, :price, :float
5
+ change_column_null :bscf_core_marketplace_listings, :product_id, false
6
+ add_foreign_key :bscf_core_marketplace_listings, :bscf_core_products, column: :product_id
7
+ add_index :bscf_core_marketplace_listings, :product_id, name: "p_on_bscf_core_mpl_index"
8
+ end
9
+ end
@@ -1,5 +1,5 @@
1
1
  module Bscf
2
2
  module Core
3
- VERSION = "0.3.98"
3
+ VERSION = "0.3.99"
4
4
  end
5
5
  end
@@ -7,6 +7,8 @@ FactoryBot.define do
7
7
  expires_at { DateTime.now.advance(days: 5) }
8
8
  is_active { true }
9
9
  status { 1 }
10
+ price { Faker::Commerce.price }
11
+ product
10
12
  address
11
13
  end
12
14
  end
@@ -6,6 +6,6 @@ FactoryBot.define do
6
6
  order_type { :order_from_quote }
7
7
  status { :draft }
8
8
  total_amount { Faker::Number.between(from: 100, to: 1000) }
9
- delivery_order { nil }
9
+ delivery_order { nil }
10
10
  end
11
11
  end
@@ -1,7 +1,7 @@
1
1
  FactoryBot.define do
2
2
  factory :virtual_account, class: 'Bscf::Core::VirtualAccount' do
3
3
  association :user, factory: :user
4
-
4
+
5
5
  sequence(:cbs_account_number) { |n| "CBS#{n.to_s.rjust(8, '0')}" }
6
6
  branch_code { "BR001" }
7
7
  product_scheme { "SAVINGS" }
@@ -1,11 +1,11 @@
1
1
  FactoryBot.define do
2
2
  factory :voucher, class: 'Bscf::Core::Voucher' do
3
3
  association :issued_by, factory: :user
4
-
4
+
5
5
  after(:build) do |voucher|
6
6
  create(:virtual_account, user: voucher.issued_by, balance: 1000.0) unless voucher.issued_by.virtual_account
7
7
  end
8
-
8
+
9
9
  full_name { Faker::Name.name }
10
10
  phone_number { Faker::PhoneNumber.cell_phone }
11
11
  amount { Faker::Number.decimal(l_digits: 3, r_digits: 2) }
@@ -45,7 +45,5 @@ FactoryBot.define do
45
45
  voucher.issued_by.virtual_account.update!(balance: voucher.amount + 1000)
46
46
  end
47
47
  end
48
-
49
-
50
48
  end
51
- end
49
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bscf-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.98
4
+ version: 0.3.99
5
5
  platform: ruby
6
6
  authors:
7
7
  - Asrat
@@ -344,6 +344,7 @@ files:
344
344
  - db/migrate/20250524073441_remove_order_id_from_delivery_orders_and_add_delivery_order_id_to_orders.rb
345
345
  - db/migrate/20250524081221_create_bscf_core_vouchers.rb
346
346
  - db/migrate/20250524151346_add_locked_amount_to_virtual_accounts.rb
347
+ - db/migrate/20250606100158_add_product_to_market_place_listings.rb
347
348
  - lib/bscf/core.rb
348
349
  - lib/bscf/core/engine.rb
349
350
  - lib/bscf/core/version.rb