Sha256: 006fb507e0c274bf06dc02d773dcdffd196514ca0b72d27f5c1d2a058c090dff

Contents?: true

Size: 640 Bytes

Versions: 2

Compression:

Stored size: 640 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.new(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

2 entries across 2 versions & 1 rubygems

Version Path
flex_commerce_api-0.7 lib/paypal_express/cart_shipping_method.rb
flex_commerce_api-0.6.57 lib/paypal_express/cart_shipping_method.rb