Module: Ticket::Transfers
Instance Method Summary collapse
- #comp_to(buyer, time = Time.now) ⇒ Object
-
#exchange_to(buyer, time = Time.now) ⇒ Object
Deals solely with changing the buyer.
- #return!(and_return_to_inventory = true) ⇒ Object
- #sell_to(buyer, time = Time.now) ⇒ Object
Instance Method Details
#comp_to(buyer, time = Time.now) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'app/models/ticket/transfers.rb', line 34 def comp_to(buyer, time=Time.now) begin self.buyer = buyer self.sold_price = 0 self.sold_at = time self.comp! # moved to order_processor # generate_qr_code self.show.refresh_stats rescue Transitions::InvalidTransition => e puts e return false end end |
#exchange_to(buyer, time = Time.now) ⇒ Object
Deals solely with changing the buyer. Pricing should be handled in exchange_prices_from
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/models/ticket/transfers.rb', line 20 def exchange_to(buyer, time=Time.now) begin self.buyer = buyer self.sold_at = time self.exchange! # moved to order_processor # generate_qr_code self.show.refresh_stats rescue Transitions::InvalidTransition => e puts e return false end end |
#return!(and_return_to_inventory = true) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 |
# File 'app/models/ticket/transfers.rb', line 49 def return!(and_return_to_inventory = true) and_return_to_inventory ? return_to_inventory! : return_off_sale! remove_from_cart self.buyer = nil self.sold_at = nil self.buyer_id = nil self.qr_code = nil self.reset_price! self.show.refresh_stats save end |
#sell_to(buyer, time = Time.now) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'app/models/ticket/transfers.rb', line 4 def sell_to(buyer, time=Time.now) begin self.buyer = buyer self.sold_at = time self.sell! # moved to order_processor # generate_qr_code self.show.refresh_stats rescue Transitions::InvalidTransition return false end end |