SelectablePlans returns the plans a user may choose from. When hideNonFree is true (no payment method on file) only the free plan(s) are offered, because paid plans require billing details the CLI can't collect.
(plans []dashboard.Plan, hideNonFree bool)
| 89 | // true (no payment method on file) only the free plan(s) are offered, because |
| 90 | // paid plans require billing details the CLI can't collect. |
| 91 | func SelectablePlans(plans []dashboard.Plan, hideNonFree bool) []dashboard.Plan { |
| 92 | if !hideNonFree { |
| 93 | return plans |
| 94 | } |
| 95 | free := make([]dashboard.Plan, 0, 1) |
| 96 | for _, p := range plans { |
| 97 | if p.IsFree() { |
| 98 | free = append(free, p) |
| 99 | } |
| 100 | } |
| 101 | return free |
| 102 | } |
| 103 | |
| 104 | // FindFreePlan returns the free-tier plan, or nil if none is present. |
| 105 | func FindFreePlan(plans []dashboard.Plan) *dashboard.Plan { |