tansengming/stripe-rails

View on GitHub
app/controllers/stripe/events_controller.rb

Summary

Maintainability
A
0 mins
Test Coverage
B
81%
module Stripe
  class EventsController < ::Stripe::ApplicationController
    include Stripe::EventDispatch
    respond_to :json

    def create
      @event = dispatch_stripe_event(request)
      head :ok
    rescue JSON::ParserError => e
      ::Rails.logger.error e.message
      head :bad_request, status: 400
    rescue Stripe::SignatureVerificationError => e
      ::Rails.logger.error e.message
      head :bad_request, status: 400
    end
  end
end