lib/pay/stripe/subscription.rb in pay-2.4.0 vs lib/pay/stripe/subscription.rb in pay-2.4.2

- old
+ new

@@ -1,18 +1,10 @@ module Pay module Stripe module Subscription extend ActiveSupport::Concern - included do - scope :stripe, -> { where(processor: :stripe) } - end - - def stripe? - processor == "stripe" - end - def stripe_cancel subscription = processor_subscription subscription.cancel_at_period_end = true subscription.save @@ -31,10 +23,22 @@ def stripe_on_grace_period? canceled? && Time.zone.now < ends_at end + def stripe_paused? + false + end + + def stripe_pause + raise NotImplementedError, "Stripe does not support pausing subscriptions" + end + def stripe_resume + unless on_grace_period? + raise StandardError, "You can only resume subscriptions within their grace period." + end + subscription = processor_subscription subscription.plan = processor_plan subscription.trial_end = on_trial? ? trial_ends_at.to_i : "now" subscription.cancel_at_period_end = false subscription.save