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(0)

Instance Method Summary collapse

Constructor Details

#initialize(shipping_method, free) ⇒ CartShippingMethod

Returns a new instance of CartShippingMethod.



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

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

Instance Method Details

#is_free?Boolean

Returns:

  • (Boolean)


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

def is_free?
  free
end

#taxObject



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

def tax
  return ZERO if is_free?
  super
end

#totalObject



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

def total
  return ZERO if is_free?
  super
end