Sha256: 4225ab3a6ad816186ef21e5212351e788fea377ac1da2bd6588cae865d450265

Contents?: true

Size: 835 Bytes

Versions: 141

Compression:

Stored size: 835 Bytes

Contents

class Webhooks::Incoming::Oauth::StripeAccountWebhooksController < Webhooks::Incoming::WebhooksController
  def create
    # we have to validate stripe webhooks based on the text content of their payload,
    # so we have to do it before we convert it to json in the database.
    payload = request.body.read

    # this throws an exception if the signature is invalid.
    Stripe::Webhook.construct_event(
      payload,
      request.env["HTTP_STRIPE_SIGNATURE"],
      ENV["STRIPE_WEBHOOKS_ACCOUNTS_ENDPOINT_SECRET"]
    )

    Webhooks::Incoming::Oauth::StripeAccountWebhook.create(
      data: JSON.parse(payload),
      # we can mark this webhook as verified because we authenticated it earlier in this controller.
      verified_at: Time.zone.now
    ).process_async

    render json: {status: "OK"}, status: :created
  end
end

Version data entries

141 entries across 141 versions & 1 rubygems

Version Path
bullet_train-integrations-stripe-1.10.0 app/controllers/webhooks/incoming/oauth/stripe_account_webhooks_controller.rb
bullet_train-integrations-stripe-1.9.0 app/controllers/webhooks/incoming/oauth/stripe_account_webhooks_controller.rb
bullet_train-integrations-stripe-1.8.5 app/controllers/webhooks/incoming/oauth/stripe_account_webhooks_controller.rb
bullet_train-integrations-stripe-1.8.4 app/controllers/webhooks/incoming/oauth/stripe_account_webhooks_controller.rb
bullet_train-integrations-stripe-1.8.3 app/controllers/webhooks/incoming/oauth/stripe_account_webhooks_controller.rb
bullet_train-integrations-stripe-1.8.2 app/controllers/webhooks/incoming/oauth/stripe_account_webhooks_controller.rb
bullet_train-integrations-stripe-1.8.1 app/controllers/webhooks/incoming/oauth/stripe_account_webhooks_controller.rb
bullet_train-integrations-stripe-1.8.0 app/controllers/webhooks/incoming/oauth/stripe_account_webhooks_controller.rb
bullet_train-integrations-stripe-1.7.23 app/controllers/webhooks/incoming/oauth/stripe_account_webhooks_controller.rb
bullet_train-integrations-stripe-1.7.22 app/controllers/webhooks/incoming/oauth/stripe_account_webhooks_controller.rb
bullet_train-integrations-stripe-1.7.21 app/controllers/webhooks/incoming/oauth/stripe_account_webhooks_controller.rb
bullet_train-integrations-stripe-1.7.20 app/controllers/webhooks/incoming/oauth/stripe_account_webhooks_controller.rb
bullet_train-integrations-stripe-1.7.19 app/controllers/webhooks/incoming/oauth/stripe_account_webhooks_controller.rb
bullet_train-integrations-stripe-1.7.18 app/controllers/webhooks/incoming/oauth/stripe_account_webhooks_controller.rb
bullet_train-integrations-stripe-1.7.17 app/controllers/webhooks/incoming/oauth/stripe_account_webhooks_controller.rb
bullet_train-integrations-stripe-1.7.16 app/controllers/webhooks/incoming/oauth/stripe_account_webhooks_controller.rb
bullet_train-integrations-stripe-1.7.15 app/controllers/webhooks/incoming/oauth/stripe_account_webhooks_controller.rb
bullet_train-integrations-stripe-1.7.14 app/controllers/webhooks/incoming/oauth/stripe_account_webhooks_controller.rb
bullet_train-integrations-stripe-1.7.13 app/controllers/webhooks/incoming/oauth/stripe_account_webhooks_controller.rb
bullet_train-integrations-stripe-1.7.12 app/controllers/webhooks/incoming/oauth/stripe_account_webhooks_controller.rb