app/concerns/tellimus/subscription.rb in tellimus-0.1.1 vs app/concerns/tellimus/subscription.rb in tellimus-0.1.2
- old
+ new
@@ -9,10 +9,12 @@
belongs_to :plan, optional: true
# update details.
before_save :processing!
+ before_destroy :cancelling!
+
def processing!
# if their package level has changed ..
if changing_plans?
prepare_for_plan_change
@@ -166,9 +168,12 @@
end
end
end
+ def cancelling!
+ Tellimus.gateway.subscription.cancel(self.braintree_id)
+ end
def describe_difference(plan_to_describe)
if plan.nil?
if persisted?
I18n.t('tellimus.plan_difference.upgrade')