mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-11-29 10:24:20 +01:00
(quality) lint wallet transaction
This commit is contained in:
parent
b4f3f7f737
commit
da11a592e8
@ -8,17 +8,14 @@ class WalletTransaction < ApplicationRecord
|
||||
belongs_to :wallet
|
||||
belongs_to :reservation
|
||||
# what was paid with the wallet
|
||||
has_one :invoice
|
||||
has_one :payment_schedule
|
||||
has_one :invoice, dependent: :nullify
|
||||
has_one :payment_schedule, dependent: :nullify
|
||||
# how the wallet was credited
|
||||
has_one :invoice_item, as: :object, dependent: :destroy
|
||||
|
||||
validates_inclusion_of :transaction_type, in: %w[credit debit]
|
||||
validates :invoicing_profile, :wallet, presence: true
|
||||
validates :transaction_type, inclusion: { in: %w[credit debit] }
|
||||
|
||||
def user
|
||||
invoicing_profile.user
|
||||
end
|
||||
delegate :user, to: :invoicing_profile
|
||||
|
||||
def original_invoice
|
||||
invoice_item.invoice
|
||||
|
0
test/fixtures/order_activities.yml
vendored
Normal file
0
test/fixtures/order_activities.yml
vendored
Normal file
130
test/fixtures/order_items.yml
vendored
Normal file
130
test/fixtures/order_items.yml
vendored
Normal file
@ -0,0 +1,130 @@
|
||||
order_item_1:
|
||||
id: 1
|
||||
order_id: 1
|
||||
orderable_type: Product
|
||||
orderable_id: 18
|
||||
amount: 4000
|
||||
quantity: 1
|
||||
is_offered:
|
||||
created_at: '2022-09-20 15:14:05.605885'
|
||||
updated_at: '2022-09-20 15:14:05.605885'
|
||||
order_item_2:
|
||||
id: 2
|
||||
order_id: 1
|
||||
orderable_type: Product
|
||||
orderable_id: 13
|
||||
amount: 500
|
||||
quantity: 1
|
||||
is_offered:
|
||||
created_at: '2022-09-20 15:14:09.022448'
|
||||
updated_at: '2022-09-20 15:14:09.022448'
|
||||
order_item_3:
|
||||
id: 3
|
||||
order_id: 2
|
||||
orderable_type: Product
|
||||
orderable_id: 15
|
||||
amount: 1500
|
||||
quantity: 4
|
||||
is_offered:
|
||||
created_at: '2022-09-20 15:14:34.899658'
|
||||
updated_at: '2022-09-20 15:14:34.899658'
|
||||
order_item_11:
|
||||
id: 11
|
||||
order_id: 5
|
||||
orderable_type: Product
|
||||
orderable_id: 18
|
||||
amount: 4000
|
||||
quantity: 3
|
||||
is_offered:
|
||||
created_at: '2022-09-28 08:31:30.377083'
|
||||
updated_at: '2022-10-04 08:34:25.130457'
|
||||
order_item_16:
|
||||
id: 16
|
||||
order_id: 9
|
||||
orderable_type: Product
|
||||
orderable_id: 23
|
||||
amount: 119
|
||||
quantity: 1
|
||||
is_offered:
|
||||
created_at: '2022-10-04 12:35:39.730968'
|
||||
updated_at: '2022-10-04 12:35:39.730968'
|
||||
order_item_17:
|
||||
id: 17
|
||||
order_id: 9
|
||||
orderable_type: Product
|
||||
orderable_id: 22
|
||||
amount: 200
|
||||
quantity: 1
|
||||
is_offered:
|
||||
created_at: '2022-10-04 12:35:40.562076'
|
||||
updated_at: '2022-10-04 12:35:40.562076'
|
||||
order_item_18:
|
||||
id: 18
|
||||
order_id: 10
|
||||
orderable_type: Product
|
||||
orderable_id: 23
|
||||
amount: 119
|
||||
quantity: 1
|
||||
is_offered:
|
||||
created_at: '2022-10-04 13:54:19.042858'
|
||||
updated_at: '2022-10-04 13:54:19.042858'
|
||||
order_item_19:
|
||||
id: 19
|
||||
order_id: 10
|
||||
orderable_type: Product
|
||||
orderable_id: 15
|
||||
amount: 1500
|
||||
quantity: 1
|
||||
is_offered:
|
||||
created_at: '2022-10-04 13:54:22.649153'
|
||||
updated_at: '2022-10-04 13:54:22.649153'
|
||||
order_item_20:
|
||||
id: 20
|
||||
order_id: 11
|
||||
orderable_type: Product
|
||||
orderable_id: 11
|
||||
amount: 1000
|
||||
quantity: 1
|
||||
is_offered:
|
||||
created_at: '2022-10-04 14:03:59.721736'
|
||||
updated_at: '2022-10-04 14:03:59.721736'
|
||||
order_item_21:
|
||||
id: 21
|
||||
order_id: 12
|
||||
orderable_type: Product
|
||||
orderable_id: 20
|
||||
amount: 1
|
||||
quantity: 2
|
||||
is_offered:
|
||||
created_at: '2022-10-04 14:05:23.583721'
|
||||
updated_at: '2022-10-04 14:17:41.866526'
|
||||
order_item_22:
|
||||
id: 22
|
||||
order_id: 12
|
||||
orderable_type: Product
|
||||
orderable_id: 18
|
||||
amount: 4000
|
||||
quantity: 1
|
||||
is_offered:
|
||||
created_at: '2022-10-04 14:17:33.257776'
|
||||
updated_at: '2022-10-04 14:17:33.257776'
|
||||
order_item_23:
|
||||
id: 23
|
||||
order_id: 14
|
||||
orderable_type: Product
|
||||
orderable_id: 18
|
||||
amount: 4000
|
||||
quantity: 3
|
||||
is_offered:
|
||||
created_at: '2022-10-04 14:31:51.106853'
|
||||
updated_at: '2022-10-04 14:31:54.194063'
|
||||
order_item_24:
|
||||
id: 24
|
||||
order_id: 15
|
||||
orderable_type: Product
|
||||
orderable_id: 17
|
||||
amount: 3000
|
||||
quantity: 1
|
||||
is_offered:
|
||||
created_at: '2022-10-04 14:35:29.003092'
|
||||
updated_at: '2022-10-04 14:35:29.003092'
|
0
test/fixtures/orders.yml
vendored
Normal file
0
test/fixtures/orders.yml
vendored
Normal file
0
test/fixtures/product_categories.yml
vendored
Normal file
0
test/fixtures/product_categories.yml
vendored
Normal file
0
test/fixtures/product_stock_movements.yml
vendored
Normal file
0
test/fixtures/product_stock_movements.yml
vendored
Normal file
0
test/fixtures/products.yml
vendored
Normal file
0
test/fixtures/products.yml
vendored
Normal file
Loading…
Reference in New Issue
Block a user