Class: FlexCommerce::PaypalExpress::GenerateSummary

Inherits:
Object
  • Object
show all
Includes:
Api
Defined in:
lib/paypal_express/generate_summary.rb

Overview

This class is used while setting up the paypal for FE It deals with line items total, sub total, tax calculations and Also deals with discounted line items and discounts inorder to send to paypal

Constant Summary

Constants included from Api

Api::USER_ERRORS

Instance Method Summary collapse

Constructor Details

#initialize(cart:, use_tax: false) ⇒ GenerateSummary

Returns a new instance of GenerateSummary.



15
16
17
18
19
# File 'lib/paypal_express/generate_summary.rb', line 15

def initialize(cart: , use_tax: false)
  self.cart = cart
  self.use_tax = use_tax
  raise "use_tax is not yet supported.  FlexCommerce::PaypalExpress::GenerateSummary should support it in the future" if use_tax
end

Instance Method Details

#callObject



24
25
26
27
28
29
30
31
32
# File 'lib/paypal_express/generate_summary.rb', line 24

def call
  {
      subtotal: subtotal,
      tax: tax,
      handling: handling,
      shipping: shipping,
      items: items
  }
end