Class: PaymentNotificationObserver

Inherits:
ActiveRecord::Observer
  • Object
show all
Defined in:
app/observers/payment_notification_observer.rb

Instance Method Summary collapse

Instance Method Details

#before_save(payment_notification) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'app/observers/payment_notification_observer.rb', line 4

def before_save(payment_notification)
  return unless payment_notification.extra_data
  if payment_notification.extra_data['status_pagamento'] == '6' #payment is being processed
    Notification.create_notification_once(:processing_payment,
      payment_notification.backer.user,
      {backer_id: payment_notification.backer.id},
      backer: payment_notification.backer,
      project_name: payment_notification.backer.project.name,
      payment_method: payment_notification.backer.payment_method)
  end
end