lib/pay/stripe.rb in pay-3.0.24 vs lib/pay/stripe.rb in pay-4.0.0

- old
+ new

@@ -26,17 +26,26 @@ autoload :SubscriptionUpdated, "pay/stripe/webhooks/subscription_updated" end extend Env + def self.enabled? + return false unless Pay.enabled_processors.include?(:stripe) && defined?(::Stripe) + + Pay::Engine.version_matches?(required: "~> 6", current: ::Stripe::VERSION) || (raise "[Pay] stripe gem must be version ~> 6") + end + def self.setup ::Stripe.api_key = private_key ::Stripe.api_version = "2020-08-27" # Used by Stripe to identify Pay for support ::Stripe.set_app_info("PayRails", partner_id: "pp_partner_IqhY0UExnJYLxg", version: Pay::VERSION, url: "https://github.com/pay-rails/pay") - configure_webhooks + # Automatically retry requests that fail + # This automatically includes idempotency keys in the request to guarantee that retires are safe + # https://github.com/stripe/stripe-ruby#configuring-automatic-retries + ::Stripe.max_network_retries = 2 end def self.public_key find_value_by_name(:stripe, :public_key) end