Module: CoreMerchant::Concerns::SubscriptionStateMachine
- Extended by:
- ActiveSupport::Concern
- Included in:
- Subscription
- Defined in:
- lib/core_merchant/concerns/subscription_state_machine.rb
Overview
Adds state machine logic to a subscription. This module defines the possible states and transitions for a subscription. Possible transitions:
pending->active,trial,processing_renewaltrial->processing_renewal,active,canceled,pending_cancellation,expiredactive->pending_cancellation,canceled,expired,processing_renewalpast_due->processing_renewalpending_cancellation->canceled,expiredprocessing_renewal->processing_payment,active,expired,past_dueprocessing_payment->active,expired,canceled,past_duecanceled->pending,processing_renewalexpired->pending,processing_renewal
Constant Summary collapse
- POSSIBLE_TRANSITIONS =
List of possible transitions in the form of { to_state: [from_states] }
{ pending: %i[canceled expired], trial: [:pending], active: %i[pending trial processing_renewal processing_payment], past_due: %i[active processing_renewal processing_payment], pending_cancellation: %i[active trial], processing_renewal: %i[pending trial active past_due canceled expired], processing_payment: [:processing_renewal], canceled: %i[trial active pending_cancellation processing_payment], expired: %i[trial active pending_cancellation processing_renewal processing_payment] }.freeze