Sha256: 2ebac746b9033d528c739d1c9223f8e7745d21bac58d3b6c8d8af6d963f6e212

Contents?: true

Size: 718 Bytes

Versions: 1

Compression:

Stored size: 718 Bytes

Contents

module Spree
  class PagSeguroController < Spree::BaseController
    protect_from_forgery :except => [:notify]
    
    def notify
      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.beta15 app/controllers/spree/pag_seguro_controller.rb