Class: FlexCommerce::PaypalExpress::CartShippingMethod

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/paypal_express/cart_shipping_method.rb

Overview

Used to decorate shipping methods based on Promotions

Constant Summary collapse

ZERO =
BigDecimal.new(0)

Instance Method Summary collapse

Constructor Details

#initialize(shipping_method, free) ⇒ CartShippingMethod

Returns a new instance of CartShippingMethod.



13
14
15
16
# File 'lib/paypal_express/cart_shipping_method.rb', line 13

def initialize(shipping_method, free)
  super(shipping_method)
  self.free = free
end

Instance Method Details

#is_free?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/paypal_express/cart_shipping_method.rb', line 18

def is_free?
  free
end

#taxObject



27
28
29
30
# File 'lib/paypal_express/cart_shipping_method.rb', line 27

def tax
  return ZERO if is_free?
  super
end

#totalObject



22
23
24
25
# File 'lib/paypal_express/cart_shipping_method.rb', line 22

def total
  return ZERO if is_free?
  super
end