Sha256: fab78abb771fdaa747207391f0811f009933eaa16c705ed6b42acc6755f84723

Contents?: true

Size: 643 Bytes

Versions: 3

Compression:

Stored size: 643 Bytes

Contents

module Spree
  class PaymentNotification < ActiveRecord::Base
    belongs_to :order
    serialize :params
    
    def self.create_from_params(params)
      email = Spree::PagSeguro::Config.email
      token = Spree::PagSeguro::Config.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

3 entries across 3 versions & 1 rubygems

Version Path
spree_pag_seguro-1.0.0.beta25 app/models/spree/payment_notification.rb
spree_pag_seguro-1.0.0.beta24 app/models/spree/payment_notification.rb
spree_pag_seguro-1.0.0.beta23 app/models/spree/payment_notification.rb