@@ 136-138 (lines=3) @@ | ||
133 | ||
134 | $rootNode |
|
135 | ->validate() |
|
136 | ->ifTrue(function ($v) { |
|
137 | return isset($v['billing_scheme']) && Plan::BILLING_SCHEME_PER_UNIT === $v['billing_scheme'] && !isset($v['amount']); |
|
138 | }) |
|
139 | ->thenInvalid('"amount" is required when using "per_unit" bill scheme.') |
|
140 | ->end() |
|
141 | ->validate() |
|
@@ 142-144 (lines=3) @@ | ||
139 | ->thenInvalid('"amount" is required when using "per_unit" bill scheme.') |
|
140 | ->end() |
|
141 | ->validate() |
|
142 | ->ifTrue(function ($v) { |
|
143 | return isset($v['billing_scheme']) && Plan::BILLING_SCHEME_TIERED === $v['billing_scheme'] && !isset($v['tiers']); |
|
144 | }) |
|
145 | ->thenInvalid('"tiers" is required when using "tiered" bill scheme.') |
|
146 | ->end() |
|
147 | ->validate() |
|
@@ 148-150 (lines=3) @@ | ||
145 | ->thenInvalid('"tiers" is required when using "tiered" bill scheme.') |
|
146 | ->end() |
|
147 | ->validate() |
|
148 | ->ifTrue(function ($v) { |
|
149 | return isset($v['tiers']) && (!isset($v['billing_scheme']) || Plan::BILLING_SCHEME_TIERED !== $v['billing_scheme']); |
|
150 | }) |
|
151 | ->thenInvalid('"tiers" requires using "tiered" bill scheme.') |
|
152 | ->end() |
|
153 | ->validate() |
|
@@ 154-156 (lines=3) @@ | ||
151 | ->thenInvalid('"tiers" requires using "tiered" bill scheme.') |
|
152 | ->end() |
|
153 | ->validate() |
|
154 | ->ifTrue(function ($v) { |
|
155 | return isset($v['billing_scheme']) && Plan::BILLING_SCHEME_TIERED === $v['billing_scheme'] && !isset($v['tiers_mode']); |
|
156 | }) |
|
157 | ->thenInvalid('"tiers_mode" is required when using "tiered" bill scheme.') |
|
158 | ->end() |
|
159 | ->validate() |