Module: Payflow::Billable
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/payflow/billable.rb
Instance Method Summary collapse
- #active_subscription? ⇒ Boolean
- #can_access_system? ⇒ Boolean
- #cancel_subscription! ⇒ Object
- #subscribe!(plan:, provider: Payflow.config.provider) ⇒ Object
- #subscription ⇒ Object
Instance Method Details
#active_subscription? ⇒ Boolean
26 27 28 |
# File 'lib/payflow/billable.rb', line 26 def active_subscription? subscription&.active? end |
#can_access_system? ⇒ Boolean
30 31 32 |
# File 'lib/payflow/billable.rb', line 30 def can_access_system? active_subscription? && !subscription&.overdue? end |
#cancel_subscription! ⇒ Object
18 19 20 |
# File 'lib/payflow/billable.rb', line 18 def cancel_subscription! SubscriptionService.new(billable: self).cancel! end |
#subscribe!(plan:, provider: Payflow.config.provider) ⇒ Object
14 15 16 |
# File 'lib/payflow/billable.rb', line 14 def subscribe!(plan:, provider: Payflow.config.provider) SubscriptionService.new(billable: self).subscribe!(plan: plan, provider: provider) end |
#subscription ⇒ Object
22 23 24 |
# File 'lib/payflow/billable.rb', line 22 def subscription payflow_subscriptions.order(created_at: :desc).first end |