Sha256: 7cff0edf7aa18057c6071c644b5055e6350bd24da0b902d562cf3551fc45035b

Contents?: true

Size: 677 Bytes

Versions: 12

Compression:

Stored size: 677 Bytes

Contents

module Spree
  class PaymentNotification < ActiveRecord::Base
    belongs_to :order
    serialize :params
    
    def self.create_from_params(params)
      email = Order.pag_seguro_payment_method.preferred_email
      token = Order.pag_seguro_payment_method.preferred_token
      notification_code = params[:notificationCode]
      notification = ::PagSeguro::Notification.new(email, token, notification_code)

      self.create!(
        params: params,
        order_id: notification.id,
        status: notification.status,
        transaction_id: notification.transaction_id,
        notification_code: notification_code
      )
      
      notification
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
spree_pag_seguro-1.0.6 app/models/spree/payment_notification.rb
spree_pag_seguro-1.0.5 app/models/spree/payment_notification.rb
spree_pag_seguro-1.0.4 app/models/spree/payment_notification.rb
spree_pag_seguro-1.0.3 app/models/spree/payment_notification.rb
spree_pag_seguro-1.0.2 app/models/spree/payment_notification.rb
spree_pag_seguro-1.0.1 app/models/spree/payment_notification.rb
spree_pag_seguro-1.0.0.rc6 app/models/spree/payment_notification.rb
spree_pag_seguro-1.0.0.rc5 app/models/spree/payment_notification.rb
spree_pag_seguro-1.0.0.rc4 app/models/spree/payment_notification.rb
spree_pag_seguro-1.0.0.rc3 app/models/spree/payment_notification.rb
spree_pag_seguro-1.0.0.rc2 app/models/spree/payment_notification.rb
spree_pag_seguro-1.0.0.rc1 app/models/spree/payment_notification.rb