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 +4 -4
- data/app/models/bscf/core/marketplace_listing.rb +2 -1
- data/app/models/bscf/core/order.rb +1 -1
- data/app/models/bscf/core/virtual_account.rb +1 -2
- data/app/models/bscf/core/voucher.rb +2 -2
- data/db/migrate/20250524081221_create_bscf_core_vouchers.rb +1 -1
- data/db/migrate/20250606100158_add_product_to_market_place_listings.rb +9 -0
- data/lib/bscf/core/version.rb +1 -1
- data/spec/factories/bscf/core/marketplace_listings.rb +2 -0
- data/spec/factories/bscf/core/orders.rb +1 -1
- data/spec/factories/bscf/core/virtual_accounts.rb +1 -1
- data/spec/factories/bscf/core/vouchers.rb +3 -5
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ba4cb08d046b4bcef3b55100146f08c64fa32d7b97f59302ffdf8ef1a804737
|
4
|
+
data.tar.gz: da7bd6abdf23ec993e8442e998853118533d2f2d7773de25155aca33c6569c22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Bscf
|
2
2
|
module Core
|
3
3
|
class Voucher < ApplicationRecord
|
4
|
-
belongs_to :issued_by, class_name:
|
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
|
data/lib/bscf/core/version.rb
CHANGED
@@ -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.
|
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
|