Module: Models::Order::PaymentMethods::ClassMethods
- Defined in:
- lib/forge/lib/models/order/payment_methods.rb
Instance Method Summary collapse
-
#options_from_addressed_object(object) ⇒ Object
used for billing address, but can also be used for shipping address creates an options hash (needed for ActiveMerchant) from an object.
Instance Method Details
#options_from_addressed_object(object) ⇒ Object
used for billing address, but can also be used for shipping address creates an options hash (needed for ActiveMerchant) from an object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/forge/lib/models/order/payment_methods.rb', line 15 def (object) = {} if object cc = ActiveMerchant::Country::COUNTRIES.detect {|c| c[:name] == object[:country]} code = cc.nil? ? "" : cc[:alpha2] = { :name => "#{object[:first_name]} #{object[:last_name]}", :address1 => object[:address1], :address2 => object[:address2], :city => object[:city], :state => object[:province], :zip => object[:postal], :phone => object[:phone], :country => code # get their country code } end end |