Sha256: d448ffc58074e49a8ab724f56872a0567c728e5e8fb957322e015e97bbf160fb

Contents?: true

Size: 633 Bytes

Versions: 3

Compression:

Stored size: 633 Bytes

Contents

require "bigdecimal"

# @module FlexCommerce::PaypalExpress
module FlexCommerce
  module PaypalExpress
    # @class CartShippingMethod
    #
    # Used to decorate shipping methods based on Promotions
    class CartShippingMethod < SimpleDelegator
      ZERO = BigDecimal(0)

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

      def is_free?
        free
      end

      def total
        return ZERO if is_free?
        super
      end

      def tax
        return ZERO if is_free?
        super
      end

      private

      attr_accessor :free
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
flex_commerce_api-0.8.3 lib/paypal_express/cart_shipping_method.rb
flex_commerce_api-0.8.2 lib/paypal_express/cart_shipping_method.rb
flex_commerce_api-0.8.1 lib/paypal_express/cart_shipping_method.rb