lib/pay.rb in pay-7.3.0 vs lib/pay.rb in pay-8.0.0

- old
+ new

@@ -17,10 +17,11 @@ # Payment processors autoload :Braintree, "pay/braintree" autoload :FakeProcessor, "pay/fake_processor" autoload :PaddleBilling, "pay/paddle_billing" autoload :PaddleClassic, "pay/paddle_classic" + autoload :LemonSqueezy, "pay/lemon_squeezy" autoload :Stripe, "pay/stripe" autoload :Webhooks, "pay/webhooks" module Billable @@ -54,11 +55,11 @@ mattr_accessor :routes_path @@routes_path = "/pay" mattr_accessor :enabled_processors - @@enabled_processors = [:stripe, :braintree, :paddle_billing, :paddle_classic] + @@enabled_processors = [:stripe, :braintree, :paddle_billing, :paddle_classic, :lemon_squeezy] mattr_accessor :send_emails @@send_emails = true mattr_accessor :emails @@ -126,8 +127,18 @@ def self.resolve_option(option, *remaining_args) if option.respond_to?(:call) option.call(*remaining_args) else option + end + end + + def self.sync(params) + if (session_id = params[:stripe_checkout_session_id] || params[:session_id]) + Pay::Stripe.sync_checkout_session(session_id) + elsif (transaction_id = params[:paddle_billing_transaction_id] || params[:transaction_id]) + Pay::PaddleBilling.sync_transaction(transaction_id) + elsif (order_id = params[:lemon_squeezy_order_id]) + Pay::LemonSqueezy.sync_order(order_id) end end end