lib/pay/paddle_classic.rb in pay-7.3.0 vs lib/pay/paddle_classic.rb in pay-8.0.0
- old
+ new
@@ -1,12 +1,10 @@
module Pay
module PaddleClassic
- autoload :Billable, "pay/paddle_classic/billable"
- autoload :Charge, "pay/paddle_classic/charge"
- autoload :Error, "pay/paddle_classic/error"
- autoload :PaymentMethod, "pay/paddle_classic/payment_method"
- autoload :Subscription, "pay/paddle_classic/subscription"
+ class Error < Pay::Error
+ delegate :message, to: :cause
+ end
module Webhooks
autoload :SignatureVerifier, "pay/paddle_classic/webhooks/signature_verifier"
autoload :SubscriptionCreated, "pay/paddle_classic/webhooks/subscription_created"
autoload :SubscriptionCancelled, "pay/paddle_classic/webhooks/subscription_cancelled"
@@ -18,11 +16,12 @@
extend Env
def self.enabled?
return false unless Pay.enabled_processors.include?(:paddle_classic) && defined?(::Paddle)
- Pay::Engine.version_matches?(required: "~> 2.1", current: ::Paddle::VERSION) || (raise "[Pay] paddle gem must be version ~> 2.1")
+ Pay::Engine.version_matches?(required: "~> 2.5",
+ current: ::Paddle::VERSION) || (raise "[Pay] paddle gem must be version ~> 2.5")
end
def self.client
@client ||= Paddle::Classic::Client.new(
vendor_id: vendor_id,
@@ -71,12 +70,15 @@
def self.configure_webhooks
Pay::Webhooks.configure do |events|
events.subscribe "paddle_classic.subscription_created", Pay::PaddleClassic::Webhooks::SubscriptionCreated.new
events.subscribe "paddle_classic.subscription_updated", Pay::PaddleClassic::Webhooks::SubscriptionUpdated.new
- events.subscribe "paddle_classic.subscription_cancelled", Pay::PaddleClassic::Webhooks::SubscriptionCancelled.new
- events.subscribe "paddle_classic.subscription_payment_succeeded", Pay::PaddleClassic::Webhooks::SubscriptionPaymentSucceeded.new
- events.subscribe "paddle_classic.subscription_payment_refunded", Pay::PaddleClassic::Webhooks::SubscriptionPaymentRefunded.new
+ events.subscribe "paddle_classic.subscription_cancelled",
+ Pay::PaddleClassic::Webhooks::SubscriptionCancelled.new
+ events.subscribe "paddle_classic.subscription_payment_succeeded",
+ Pay::PaddleClassic::Webhooks::SubscriptionPaymentSucceeded.new
+ events.subscribe "paddle_classic.subscription_payment_refunded",
+ Pay::PaddleClassic::Webhooks::SubscriptionPaymentRefunded.new
end
end
end
end