Class: ActiveMerchant::Billing::Integrations::Paypal::Helper
- Inherits:
-
Helper
- Object
- Helper
- ActiveMerchant::Billing::Integrations::Paypal::Helper
- Defined in:
- lib/nimbleshop_paypalwp/active_merchant/billing/integrations/paypal/helper.rb
Instance Method Summary collapse
-
#initialize(order, account, options = {}) ⇒ Helper
constructor
A new instance of Helper.
-
#line_items(line_items = []) ⇒ Object
add line item details, note the amount_x should be price instead of line total.
Constructor Details
#initialize(order, account, options = {}) ⇒ Helper
Returns a new instance of Helper.
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/nimbleshop_paypalwp/active_merchant/billing/integrations/paypal/helper.rb', line 7 def initialize(order, account, = {}) super # indicates we are using thirdparty shopping cart add_field('cmd', '_cart') add_field('upload', '1') add_field('no_shipping', '1') add_field('no_note', '1') add_field('charset', 'utf-8') add_field('address_override', '0') add_field('bn', application_id.to_s.slice(0,32)) unless application_id.blank? end |
Instance Method Details
#line_items(line_items = []) ⇒ Object
add line item details, note the amount_x should be price instead of line total
30 31 32 33 34 35 36 |
# File 'lib/nimbleshop_paypalwp/active_merchant/billing/integrations/paypal/helper.rb', line 30 def line_items(line_items = []) line_items.to_enum.with_index(1) do | line_item, index | add_field("item_name_#{index}", line_item.product_name) add_field("quantity_#{index}", line_item.quantity) add_field("amount_#{index}", line_item.product_price) end end |