Sha256: a103c2c7831b9836568c2fd32d0c60783cede7d14f863a7e687dad58676acc95
Contents?: true
Size: 509 Bytes
Versions: 2
Compression:
Stored size: 509 Bytes
Contents
module Tang class ChangeSubscription def self.call(subscription, plan) return subscription if !subscription.valid? begin stripe_sub = Stripe::Subscription.retrieve(subscription.stripe_id) stripe_sub.plan = plan.stripe_id stripe_sub.save subscription.plan = plan subscription.save! rescue Stripe::StripeError => e subscription.errors.add(:base, :invalid, message: e.message) end return subscription end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tang-0.2.2 | app/services/tang/change_subscription.rb |
tang-0.2.1 | app/services/tang/change_subscription.rb |