Slide 18
Slide 18 text
sm.when("activate", transitionFrom: "pending", to: "active")
sm.when("suspend", transitionFrom: "active", to: "suspended")
sm.when("unsuspend", transitionFrom: "suspended", to: "active")
sm.when("terminate", transitionFrom: "active", to: "terminated")
sm.when("terminate", transitionFrom: "suspended", to: "terminated")
!
sm.before("terminate") { subscription in
subscription.terminatedAt = NSDate.date()
}
!
sm.before("suspend") { subscription in
subscription.stopBilling()
}
DSL