def self.purchase_as_guest_with_data(data)
s = create_student_from_data(data)
p = create_parent_from_data(data)
s_user = User.new
s_user.contact = s
s_user.email = s.email
s_user.password = data[:student][:password]
p_user = User.new
p_user.contact = p
p_user.email = p.email
p_user.password = data[:student][:password]
tickets = data[:ticket_allocation_ids].map do |id|
t = Ticket.new
t.ticket_allocation_id = id
t.contact = s
t.purchase_date = Date.today
t
end
ActiveRecord::Base.transaction do
s.save!
p.save!
s_user.save!
p_user.save!
tickets.each { |t| t.save! }
end
return [s, p, s_user, p_user] + tickets