class Hps::HpsInputValidation

Public Class Methods

check_amount(amount) click to toggle source
# File lib/hps/infrastructure/hps_input_validation.rb, line 3
def self.check_amount(amount)
  if amount < 0 || amount == nil
    raise InvalidRequestException.new "Amount must be greater than or equal 0."
  end

  return amount if amount.is_a? Float

  amount.gsub(/[^0-9\.]/, '')
end