diff --git a/lib/buy_account_credit_form.rb b/lib/buy_account_credit_form.rb index 1c3cca0519184be1713d82a8be782c90d2f64091..b6a1da671cb6c4c17886ed433c7dc2ff56e5a828 100644 --- a/lib/buy_account_credit_form.rb +++ b/lib/buy_account_credit_form.rb @@ -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(