Module: Koudoku::Subscription
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/concerns/koudoku/subscription.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #card_was_declined ⇒ Object
- #changing_plans? ⇒ Boolean
- #charge_disputed ⇒ Object
- #charge_failed ⇒ Object
- #describe_difference(plan_to_describe) ⇒ Object
- #downgrading? ⇒ Boolean
- #finalize_cancelation! ⇒ Object
- #finalize_card_update! ⇒ Object
- #finalize_downgrade! ⇒ Object
- #finalize_new_subscription! ⇒ Object
- #finalize_plan_change! ⇒ Object
- #finalize_upgrade! ⇒ Object
-
#payment_succeeded(amount) ⇒ Object
stripe web-hook callbacks.
- #prepare_for_cancelation ⇒ Object
- #prepare_for_card_update ⇒ Object
- #prepare_for_downgrade ⇒ Object
- #prepare_for_new_subscription ⇒ Object
-
#prepare_for_plan_change ⇒ Object
Template methods.
- #prepare_for_upgrade ⇒ Object
-
#subscription_owner ⇒ Object
Pretty sure this wouldn’t conflict with anything someone would put in their model.
- #subscription_owner_description ⇒ Object
- #subscription_owner_email ⇒ Object
- #upgrading? ⇒ Boolean
Instance Method Details
#card_was_declined ⇒ Object
224 225 |
# File 'app/concerns/koudoku/subscription.rb', line 224 def card_was_declined end |
#changing_plans? ⇒ Boolean
175 176 177 |
# File 'app/concerns/koudoku/subscription.rb', line 175 def changing_plans? plan_id_changed? end |
#charge_disputed ⇒ Object
234 235 |
# File 'app/concerns/koudoku/subscription.rb', line 234 def charge_disputed end |
#charge_failed ⇒ Object
231 232 |
# File 'app/concerns/koudoku/subscription.rb', line 231 def charge_failed end |
#describe_difference(plan_to_describe) ⇒ Object
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'app/concerns/koudoku/subscription.rb', line 138 def describe_difference(plan_to_describe) if plan.nil? if persisted? "Upgrade" else if Koudoku.free_trial? "Start Trial" else "Upgrade" end end else if plan_to_describe.is_upgrade_from?(plan) "Upgrade" else "Downgrade" end end end |
#downgrading? ⇒ Boolean
179 180 181 |
# File 'app/concerns/koudoku/subscription.rb', line 179 def downgrading? plan.present? and plan_id_was.present? and plan_id_was > self.plan_id end |
#finalize_cancelation! ⇒ Object
218 219 |
# File 'app/concerns/koudoku/subscription.rb', line 218 def finalize_cancelation! end |
#finalize_card_update! ⇒ Object
221 222 |
# File 'app/concerns/koudoku/subscription.rb', line 221 def finalize_card_update! end |
#finalize_downgrade! ⇒ Object
215 216 |
# File 'app/concerns/koudoku/subscription.rb', line 215 def finalize_downgrade! end |
#finalize_new_subscription! ⇒ Object
209 210 |
# File 'app/concerns/koudoku/subscription.rb', line 209 def finalize_new_subscription! end |
#finalize_plan_change! ⇒ Object
206 207 |
# File 'app/concerns/koudoku/subscription.rb', line 206 def finalize_plan_change! end |
#finalize_upgrade! ⇒ Object
212 213 |
# File 'app/concerns/koudoku/subscription.rb', line 212 def finalize_upgrade! end |
#payment_succeeded(amount) ⇒ Object
stripe web-hook callbacks.
228 229 |
# File 'app/concerns/koudoku/subscription.rb', line 228 def payment_succeeded(amount) end |
#prepare_for_cancelation ⇒ Object
200 201 |
# File 'app/concerns/koudoku/subscription.rb', line 200 def prepare_for_cancelation end |
#prepare_for_card_update ⇒ Object
203 204 |
# File 'app/concerns/koudoku/subscription.rb', line 203 def prepare_for_card_update end |
#prepare_for_downgrade ⇒ Object
197 198 |
# File 'app/concerns/koudoku/subscription.rb', line 197 def prepare_for_downgrade end |
#prepare_for_new_subscription ⇒ Object
191 192 |
# File 'app/concerns/koudoku/subscription.rb', line 191 def prepare_for_new_subscription end |
#prepare_for_plan_change ⇒ Object
Template methods.
188 189 |
# File 'app/concerns/koudoku/subscription.rb', line 188 def prepare_for_plan_change end |
#prepare_for_upgrade ⇒ Object
194 195 |
# File 'app/concerns/koudoku/subscription.rb', line 194 def prepare_for_upgrade end |
#subscription_owner ⇒ Object
Pretty sure this wouldn’t conflict with anything someone would put in their model
159 160 161 162 163 |
# File 'app/concerns/koudoku/subscription.rb', line 159 def subscription_owner # Return whatever we belong to. # If this object doesn't respond to 'name', please update owner_description. send Koudoku.subscriptions_owned_by end |
#subscription_owner_description ⇒ Object
165 166 167 168 169 |
# File 'app/concerns/koudoku/subscription.rb', line 165 def subscription_owner_description # assuming owner responds to name. # we should check for whether it responds to this or not. "#{subscription_owner.id}" end |
#subscription_owner_email ⇒ Object
171 172 173 |
# File 'app/concerns/koudoku/subscription.rb', line 171 def subscription_owner_email nil end |
#upgrading? ⇒ Boolean
183 184 185 |
# File 'app/concerns/koudoku/subscription.rb', line 183 def upgrading? (plan_id_was.present? and plan_id_was < plan_id) or plan_id_was.nil? end |