app/models/job/order_processor.rb in artfully_ose-1.2.0 vs app/models/job/order_processor.rb in artfully_ose-1.3.0.pre1

- old
+ new

@@ -31,30 +31,41 @@ process_passes end generate_qr_codes_and_pdf send_confirmation + send_donation_notification end def generate_qr_codes_and_pdf begin order.tickets.each do |item| item.product.generate_qr_code_without_delay generate_pdf if order.organization.can? :access, :scannable_tickets end rescue Exception => e - Exceptional.context(:order_id => order.id) - Exceptional.handle(e, "Could not generate PDF for order") + Airbrake.notify(e, :parameters => {:error_message => "Could not generate PDF for order", :order_id => order.id}) end end def send_confirmation begin OrderMailer.confirmation_for(order).deliver unless skip_email + rescue Exception => e + Airbrake.notify(e, :parameters => {:error_message => "Could not send confirmation for order", :order_id => order.id}) + end + end + + def send_donation_notification + begin + organization = order.organization + if !skip_email && organization.has_kit?(:regular_donation) && order.donations.any? + recipients = organization.donation_notification_recipients.collect(&:email) + recipients.each {|to| ProducerMailer.donation_notification(order, to).deliver} + end rescue Exception => e - Exceptional.context(:order_id => order.id) - Exceptional.handle(e, "Could not send order confirmation for order") + Airbrake.notify(e, :parameters => {:error_message => "Could not send donation notification for order", :order_id => order.id}) end end def skip_actions self.options[:skip_actions] == true @@ -67,20 +78,20 @@ def process_memberships unless self.order.memberships.empty? self.order.memberships.each do |membership_item| Member.for(membership_item.product, self.order.person) end - self.order.create_generic_action("memberships") + self.order.create_generic_action("memberships") unless skip_actions end end def process_passes unless self.order.passes.empty? || order.is_a?(RefundOrder) self.order.passes.each do |pass_item| pass_item.product.person = self.order.person pass_item.product.save end - self.order.create_generic_action("passes") + self.order.create_generic_action("passes") unless skip_actions PassMailer.pass_info_for(self.order.person, self.order.organization.email,self.order.passes.collect(&:product)).deliver end end def generate_pdf