@@ -3,10 +3,7 @@
class BuyAccountCreditForm
class AmountValidationError < StandardError
def initialize(amount)
- super(- "amount #{amount} must be in the range " \- "#{RANGE.first} through #{RANGE.last}"- )
+ super("amount #{amount} must be more than $15")
end
end
@@ -21,20 +18,18 @@ class BuyAccountCreditForm
@payment_methods = payment_methods
end
- RANGE = (15..1000).freeze-
def form
FormTemplate.render(
:top_up,
balance: @balance,
payment_methods: @payment_methods,
- range: RANGE
+ range: [15, nil]
)
end
def parse(form)
amount = form.field("amount")&.value&.to_s
- raise AmountValidationError, amount unless RANGE.include?(amount.to_i)
+ raise AmountValidationError, amount unless amount.to_i >= 15
{
payment_method: @payment_methods.fetch(