Class: Effective::EventAddon

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/effective/event_addon.rb

Instance Method Summary collapse

Instance Method Details

#last_first_nameObject



75
76
77
# File 'app/models/effective/event_addon.rb', line 75

def last_first_name
  "#{last_name}, #{first_name}"
end

#mark_registered!Object

This is the Admin Save and Mark Registered historic action



92
93
94
95
96
97
98
99
100
101
# File 'app/models/effective/event_addon.rb', line 92

def mark_registered!
  raise('expected a blank event registration') if event_registration.present?

  save!

  order = Effective::Order.new(items: self, user: owner)
  order.purchase!(skip_buyer_validations: true, email: false)

  true
end

#nameObject



71
72
73
# File 'app/models/effective/event_addon.rb', line 71

def name
  "#{first_name} #{last_name}"
end

#qb_item_nameObject



83
84
85
# File 'app/models/effective/event_addon.rb', line 83

def qb_item_name
  event_product.qb_item_name
end

#registered?Boolean

Returns:

  • (Boolean)


87
88
89
# File 'app/models/effective/event_addon.rb', line 87

def registered?
  purchased_or_deferred?
end

#tax_exemptObject



79
80
81
# File 'app/models/effective/event_addon.rb', line 79

def tax_exempt
  event_product.tax_exempt
end

#titleObject



66
67
68
69
# File 'app/models/effective/event_addon.rb', line 66

def title
  return event_product.to_s unless first_name.present? && last_name.present?
  "#{event_product} - #{last_first_name}"
end

#to_sObject



62
63
64
# File 'app/models/effective/event_addon.rb', line 62

def to_s
  persisted? ? title : 'addon'
end