Sha256: cca89f370a2b35d15271b9760ce80b540b9d91ebd2239b729931ce17005ab230

Contents?: true

Size: 752 Bytes

Versions: 1

Compression:

Stored size: 752 Bytes

Contents

module Spree
  class PagSeguroController < Spree::BaseController
    protect_from_forgery :except => [:notify]
    
    def notify
      raise params.inspect
      
      email = Spree::PagSeguro::Config.email
      token = Spree::PagSeguro::Config.token
      notification_code = params[:notificationCode]
      notification = ::PagSeguro::Notification.new(email, token, notification_code)
      
      logger.info "PagSeguro Notification code: #{notification_code}\n\n\n"
      logger.info "PagSeguro Notification inspect:\n#{notification.inspect}"
      
      if notification.approved?
        order = Spree::Order.find(notification.id)
        order.payment.complete
      end
      render head: :ok
    end
    
    def callback
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spree_pag_seguro-1.0.0.beta14 app/controllers/spree/pag_seguro_controller.rb