Class: SolidusStripe::WebhooksController

Inherits:
Spree::BaseController
  • Object
show all
Defined in:
app/controllers/solidus_stripe/webhooks_controller.rb

Constant Summary collapse

SIGNATURE_HEADER =
"HTTP_STRIPE_SIGNATURE"

Instance Method Summary collapse

Instance Method Details

#createObject



14
15
16
17
18
19
20
# File 'app/controllers/solidus_stripe/webhooks_controller.rb', line 14

def create
  event = Webhook::Event.from_request(payload: request.body.read, signature_header: signature_header,
    slug: params[:slug])
  return head(:bad_request) unless event

  Spree::Bus.publish(event) && head(:ok)
end