Sha256: 2e04f7ea9d0f26d4b90ab71fbdfaa80d5cad2d389e8035a11d5f7d8059ba91e2

Contents?: true

Size: 861 Bytes

Versions: 7

Compression:

Stored size: 861 Bytes

Contents

# frozen_string_literal: true

module SolidusStripe
  # Represents a webhook endpoint for a {SolidusStripe::PaymentMethod}.
  #
  # A Stripe webhook endpoint is a URL that Stripe will send events to. A store
  # could have multiple Stripe payment methods (e.g., a marketplace), so we need
  # to differentiate which one a webhook request targets.
  #
  # This model associates a slug with a payment method. The slug is appended
  # to the endpoint URL (`.../webhooks/:slug`) so that we can fetch the
  # correct payment method from the database and bind it to the generated
  # `Spree::Bus` event.
  #
  # We use a slug instead of the payment method ID to be resilient to
  # database changes and to avoid guessing about valid endpoint URLs.
  class SlugEntry < ::Spree::Base
    belongs_to :payment_method, class_name: 'SolidusStripe::PaymentMethod'
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
solidus_stripe-5.0.2 app/models/solidus_stripe/slug_entry.rb
solidus_stripe-5.0.1 app/models/solidus_stripe/slug_entry.rb
solidus_stripe-5.0.0 app/models/solidus_stripe/slug_entry.rb
solidus_stripe-5.0.0.rc.3 app/models/solidus_stripe/slug_entry.rb
solidus_stripe-5.0.0.rc.2 app/models/solidus_stripe/slug_entry.rb
solidus_stripe-5.0.0.rc.1 app/models/solidus_stripe/slug_entry.rb
solidus_stripe-5.0.0.alpha.1 app/models/solidus_stripe/slug_entry.rb