Module: Ticket::Pricing

Extended by:
ActiveSupport::Concern
Included in:
Ticket
Defined in:
app/models/ticket/pricing.rb

Instance Method Summary collapse

Instance Method Details

#change_price(new_price) ⇒ Object



50
51
52
# File 'app/models/ticket/pricing.rb', line 50

def change_price(new_price)
  raise "Gone"
end

#exchange_prices_from(old_ticket) ⇒ Object



36
37
38
39
40
41
42
43
44
# File 'app/models/ticket/pricing.rb', line 36

def exchange_prices_from(old_ticket)
  raise "Cannot exchange prices without a ticket type set on current ticket" if self.ticket_type.nil?
  self.sold_price       = old_ticket.sold_price
  self.cart_price       = old_ticket.sold_price
  self.discount_id      = old_ticket.discount_id
  self.service_fee      = old_ticket.service_fee
  self.cart_id          = nil
  self.save
end

#prepare_for_cart_change!Object



8
9
10
11
12
13
14
15
# File 'app/models/ticket/pricing.rb', line 8

def prepare_for_cart_change!
  return false if sold?
  self.discount = nil
  self.pass = nil
  self.sold_price = nil
  self.cart_price = self.price
  self.save
end

#prepare_for_discount!Object



17
18
19
# File 'app/models/ticket/pricing.rb', line 17

def prepare_for_discount!
  prepare_for_cart_change!
end

#prepare_for_pass!Object



21
22
23
# File 'app/models/ticket/pricing.rb', line 21

def prepare_for_pass!
  prepare_for_cart_change!
end

#remove_from_cartObject



4
5
6
# File 'app/models/ticket/pricing.rb', line 4

def remove_from_cart
  self.update_column(:cart_id, nil)
end

#reset_price!Object



25
26
27
28
29
30
31
32
33
34
# File 'app/models/ticket/pricing.rb', line 25

def reset_price!
  return false if sold?
  self.discount = nil
  self.pass     = nil
  self.ticket_type = nil
  self.sold_price = nil
  self.cart_price = nil
  self.service_fee = nil
  self.save
end

#set_cart_price(price) ⇒ Object



46
47
48
# File 'app/models/ticket/pricing.rb', line 46

def set_cart_price(price)
  self.cart_price = price
end