Class: OffsitePayments::Integrations::Nochex::Helper
- Defined in:
- lib/offsite_payments/integrations/nochex.rb
Instance Attribute Summary
Attributes inherited from Helper
Instance Method Summary collapse
-
#amount=(money) ⇒ Object
Need to format the amount to have 2 decimal places.
Methods inherited from Helper
#add_field, #add_fields, #add_raw_html_field, #billing_address, #form_fields, #form_method, inherited, #initialize, mapping, #raw_html_fields, #shipping_address, #test?
Constructor Details
This class inherits a constructor from OffsitePayments::Helper
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class OffsitePayments::Helper
Instance Method Details
#amount=(money) ⇒ Object
Need to format the amount to have 2 decimal places
96 97 98 99 100 101 102 |
# File 'lib/offsite_payments/integrations/nochex.rb', line 96 def amount=(money) cents = money.respond_to?(:cents) ? money.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 |