1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-12 06:54:19 +01:00

22 lines
675 B
Ruby
Raw Normal View History

2022-08-19 19:59:13 +02:00
# frozen_string_literal: true
# Order is a model for the user hold information of order
class Order < ApplicationRecord
belongs_to :statistic_profile
belongs_to :operator_profile, class_name: 'InvoicingProfile'
2022-08-19 19:59:13 +02:00
has_many :order_items, dependent: :destroy
ALL_STATES = %w[cart in_progress ready canceled return].freeze
2022-08-19 19:59:13 +02:00
enum state: ALL_STATES.zip(ALL_STATES).to_h
PAYMENT_STATES = %w[paid failed refunded].freeze
2022-08-25 08:52:17 +02:00
enum payment_state: PAYMENT_STATES.zip(PAYMENT_STATES).to_h
2022-08-19 19:59:13 +02:00
validates :token, :state, presence: true
2022-08-26 11:19:09 +02:00
def set_wallet_transaction(amount, transaction_id)
self.wallet_amount = amount
self.wallet_transaction_id = transaction_id
end
2022-08-19 19:59:13 +02:00
end