Created
March 9, 2018 23:39
-
-
Save 256BitChris/b7623d37f4856d888d8da55c3452def9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn-spec eligible-to-create-subscription? boolean? | |
"Is the subscription eligible for creating a new one?" | |
[subscription (s/keys :req [::subscription-status])] | |
(case (-> ::subscription-status subscription) | |
(::expired ::canceled ::free-trial ::free-trial-expired) true | |
false)) | |
(s/exercise-fn `eligible-to-create-subscription?) | |
=> | |
([(#:io.cloudrepo.payments{:subscription-status :io.cloudrepo.payments/free-trial-expired}) true] | |
[(#:io.cloudrepo.payments{:subscription-status :io.cloudrepo.payments/free-trial-expired}) true] | |
[(#:io.cloudrepo.payments{:subscription-status :io.cloudrepo.payments/active}) false] | |
[(#:io.cloudrepo.payments{:subscription-status :io.cloudrepo.payments/pending}) false] | |
[(#:io.cloudrepo.payments{:subscription-status :io.cloudrepo.payments/expired}) true] | |
[(#:io.cloudrepo.payments{:subscription-status :io.cloudrepo.payments/cancelled}) false] | |
[(#:io.cloudrepo.payments{:subscription-status :io.cloudrepo.payments/free-trial}) true] | |
[(#:io.cloudrepo.payments{:subscription-status :io.cloudrepo.payments/expired}) true] | |
[(#:io.cloudrepo.payments{:subscription-status :io.cloudrepo.payments/past-due}) false] | |
[(#:io.cloudrepo.payments{:subscription-status :io.cloudrepo.payments/pending}) false]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment