Class ActiveMerchant::Billing::Integrations::Nochex::Helper
In: lib/active_merchant/billing/integrations/nochex/helper.rb
Parent: ActiveMerchant::Billing::Integrations::Helper

Methods

amount=  

Public Instance methods

Need to format the amount to have 2 decimal places

[Source]

    # File lib/active_merchant/billing/integrations/nochex/helper.rb, line 22
22:           def amount=(money)
23:             cents = money.respond_to?(:cents) ? money.cents : money
24:             if money.is_a?(String) or cents.to_i <= 0
25:               raise ArgumentError, 'money amount must be either a Money object or a positive integer in cents.'
26:             end
27:             add_field mappings[:amount], sprintf("%.2f", cents.to_f/100)
28:           end

[Validate]