class OffsitePayments::Integrations::Nochex::Helper

Public Instance Methods

amount=(money) click to toggle source

Need to format the amount to have 2 decimal places

# File lib/offsite_payments/integrations/nochex.rb, line 96
def amount=(money)
  cents = to_cents(money)
  raise ArgumentError, "amount must be a Money object or an integer" if money.is_a?(String)
  raise ActionViewHelperError, "amount must be greater than $0.00" if cents.to_i <= 0

  add_field mappings[:amount], sprintf("%.2f", cents.to_f/100)
end