Class: Payflow::Webhooks::AsaasController

Inherits:
ApplicationController show all
Defined in:
app/controllers/payflow/webhooks/asaas_controller.rb

Instance Method Summary collapse

Instance Method Details

#receiveObject



6
7
8
9
10
11
12
13
14
15
# File 'app/controllers/payflow/webhooks/asaas_controller.rb', line 6

def receive
  verifier = SignatureVerifier.new(provider: :asaas, request: request)
  return head :unauthorized unless verifier.valid?

  payload = JSON.parse(request.raw_post)
  WebhookJob.perform_later(provider: :asaas, payload: payload)
  head :ok
rescue JSON::ParserError
  head :bad_request
end