Class: Spree::Payment::GatewayOptions
- Inherits:
-
Object
- Object
- Spree::Payment::GatewayOptions
- Defined in:
- app/models/spree/payment/gateway_options.rb
Instance Method Summary collapse
- #billing_address ⇒ Object
- #currency ⇒ Object
- #customer ⇒ Object
- #customer_id ⇒ Object
- #discount ⇒ Object
- #email ⇒ Object
- #hash_methods ⇒ Object
-
#initialize(payment) ⇒ GatewayOptions
constructor
A new instance of GatewayOptions.
- #ip ⇒ Object
- #order_id ⇒ Object
- #shipping ⇒ Object
- #shipping_address ⇒ Object
- #subtotal ⇒ Object
- #tax ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(payment) ⇒ GatewayOptions
Returns a new instance of GatewayOptions.
4 5 6 |
# File 'app/models/spree/payment/gateway_options.rb', line 4 def initialize(payment) @payment = payment end |
Instance Method Details
#billing_address ⇒ Object
48 49 50 |
# File 'app/models/spree/payment/gateway_options.rb', line 48 def billing_address order.bill_address.try(:active_merchant_hash) end |
#currency ⇒ Object
44 45 46 |
# File 'app/models/spree/payment/gateway_options.rb', line 44 def currency @payment.currency end |
#customer ⇒ Object
12 13 14 |
# File 'app/models/spree/payment/gateway_options.rb', line 12 def customer order.email end |
#customer_id ⇒ Object
16 17 18 |
# File 'app/models/spree/payment/gateway_options.rb', line 16 def customer_id order.user_id end |
#discount ⇒ Object
40 41 42 |
# File 'app/models/spree/payment/gateway_options.rb', line 40 def discount order.promo_total * exchange_multiplier end |
#email ⇒ Object
8 9 10 |
# File 'app/models/spree/payment/gateway_options.rb', line 8 def email order.email end |
#hash_methods ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'app/models/spree/payment/gateway_options.rb', line 56 def hash_methods [ :email, :customer, :customer_id, :ip, :order_id, :shipping, :tax, :subtotal, :discount, :currency, :billing_address, :shipping_address ] end |
#ip ⇒ Object
20 21 22 |
# File 'app/models/spree/payment/gateway_options.rb', line 20 def ip order.last_ip_address end |
#order_id ⇒ Object
24 25 26 |
# File 'app/models/spree/payment/gateway_options.rb', line 24 def order_id "#{order.number}-#{@payment.number}" end |
#shipping ⇒ Object
28 29 30 |
# File 'app/models/spree/payment/gateway_options.rb', line 28 def shipping order.ship_total * exchange_multiplier end |
#shipping_address ⇒ Object
52 53 54 |
# File 'app/models/spree/payment/gateway_options.rb', line 52 def shipping_address order.ship_address.try(:active_merchant_hash) end |
#subtotal ⇒ Object
36 37 38 |
# File 'app/models/spree/payment/gateway_options.rb', line 36 def subtotal order.item_total * exchange_multiplier end |
#tax ⇒ Object
32 33 34 |
# File 'app/models/spree/payment/gateway_options.rb', line 32 def tax order.additional_tax_total * exchange_multiplier end |
#to_hash ⇒ Object
73 74 75 76 77 |
# File 'app/models/spree/payment/gateway_options.rb', line 73 def to_hash Hash[hash_methods.map do |method| [method, send(method)] end] end |