Sha256: 6ef9d9f40d1d9796b791c89a3d78ad6432c34950543d9d6746d5757362abe93f

Contents?: true

Size: 387 Bytes

Versions: 3

Compression:

Stored size: 387 Bytes

Contents

module Susply
  class ChangeSubscription
    def self.call(owner, new_plan)
      if owner.has_active_subscription?
        Susply::CreatePayment.call(owner.active_subscription, "plan_change")
        Susply::CancelSubscription.call(owner.active_subscription)
      end

      new_subscription = Susply::CreateSubscription.call(owner, new_plan)

      new_subscription
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
susply-1.0.0 app/services/susply/change_subscription.rb
susply-0.0.2 app/services/susply/change_subscription.rb
susply-0.0.1 app/services/susply/change_subscription.rb