Sha256: 6408af2c7912f7b6314ac866ac79f5f96ff6a5843658007ad24e1da60fe93e1c

Contents?: true

Size: 745 Bytes

Versions: 1

Compression:

Stored size: 745 Bytes

Contents

module CatarsePagarme
  class NotificationsController < CatarsePagarme::ApplicationController
    skip_before_filter :authenticate_user!
    skip_before_filter :force_http

    def create
      if contribution
        contribution.payment_notifications.create(extra_data: params.to_json)

        if PagarMe::validate_fingerprint(contribution.try(:payment_id), params[:fingerprint])
          delegator.change_status_by_transaction(params[:current_status])
          return render nothing: true, status: 200
        end
      end

      render nothing: true, status: 404
    end

    protected

    def contribution
      conditions = {payment_id: params[:id] }

      @contribution ||= PaymentEngines.find_payment(conditions)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
catarse_pagarme-0.2.0 app/controllers/catarse_pagarme/notifications_controller.rb