Sha256: aa72d592a140bbd9d9aa7137ec811358941b16f7100a9d4cd719a6c08a93a2bd

Contents?: true

Size: 617 Bytes

Versions: 2

Compression:

Stored size: 617 Bytes

Contents

module Workarea
  module Avatax
    class TaxRequest::ShippingLineItem < TaxRequest::LineItem
      attr_reader :shipping

      def initialize(shipping:)
        super
        @shipping = shipping
      end

      private

        def quantity
          1
        end

        def amount
          shipping.price_adjustments.adjusting("shipping").sum(&:amount)
        end

        def item_code
          "SHIPPING"
        end

        def tax_code
          shipping.shipping_service.try(:tax_code)
        end

        def description
          shipping.shipping_service.try(:name)
        end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
workarea-avatax-4.2.1 lib/workarea/avatax/tax_request/shipping_line_item.rb
workarea-avatax-4.2.0 lib/workarea/avatax/tax_request/shipping_line_item.rb