mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-11-29 10:24:20 +01:00
21 lines
612 B
Ruby
21 lines
612 B
Ruby
# frozen_string_literal: true
|
|
|
|
# Order is a model for the user hold information of order
|
|
class Order < ApplicationRecord
|
|
belongs_to :statistic_profile
|
|
has_many :order_items, dependent: :destroy
|
|
|
|
ALL_STATES = %w[cart in_progress ready canceled return].freeze
|
|
enum state: ALL_STATES.zip(ALL_STATES).to_h
|
|
|
|
PAYMENT_STATES = %w[paid failed refunded].freeze
|
|
enum payment_state: PAYMENT_STATES.zip(PAYMENT_STATES).to_h
|
|
|
|
validates :token, :state, presence: true
|
|
|
|
def set_wallet_transaction(amount, transaction_id)
|
|
self.wallet_amount = amount
|
|
self.wallet_transaction_id = transaction_id
|
|
end
|
|
end
|