Sha256: 9e65061f49190bb9431fbf3b664ce187caadb190eeca690ad5180823fec8c81d

Contents?: true

Size: 846 Bytes

Versions: 11

Compression:

Stored size: 846 Bytes

Contents

# frozen_string_literal: true

# rubocop:disable Lint/HandleExceptions
begin
  require "braintree"
rescue LoadError
end

begin
  require "stripe"
  require "stripe_event"
rescue LoadError
end
# rubocop:enable Lint/HandleExceptions

module Pay
  class Engine < ::Rails::Engine
    engine_name "pay"

    initializer "pay.processors" do |app|
      # Include processor backends
      require "pay/stripe" if defined? ::Stripe
      require "pay/braintree" if defined? ::Braintree

      if Pay.automount_routes
        app.routes.append do
          mount Pay::Engine, at: Pay.routes_path, as: "pay"
        end
      end
    end

    config.to_prepare do
      Pay::Stripe.setup if defined? ::Stripe
      Pay::Braintree.setup if defined? ::Braintree

      Pay.charge_model.include Pay::Receipts if defined? ::Receipts::Receipt
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
pay-2.2.2 lib/pay/engine.rb
pay-2.2.1 lib/pay/engine.rb
pay-2.2.0 lib/pay/engine.rb
pay-2.1.3 lib/pay/engine.rb
pay-2.1.2 lib/pay/engine.rb
pay-2.1.1 lib/pay/engine.rb
pay-2.1.0 lib/pay/engine.rb
pay-2.0.3 lib/pay/engine.rb
pay-2.0.2 lib/pay/engine.rb
pay-2.0.1 lib/pay/engine.rb
pay-2.0.0 lib/pay/engine.rb