Sha256: f1473f86bbee66633386a9dd1d98c7b498a918a2fb082ea0c00417c591ecac4b

Contents?: true

Size: 520 Bytes

Versions: 1

Compression:

Stored size: 520 Bytes

Contents

# frozen_string_literal: true

require_dependency 'spree/calculator'

module SolidusIndia
  class SgstCalculator < Spree::Calculator
    def compute_line_item(line_item)
      calculate_rates(line_item)
    end

    def compute_shipment(shipment)
      calculate_rates(shipment)
    end

    def compute_shipping_rate(shipping)
      calculate_rates(shipping)
    end

    private

    def calculate_rates(item)
      tax_rate = Spree::TaxRate.find_by(name: 'SGST')
      item.amount * tax_rate.amount
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
solidus_india-0.0.1 app/models/solidus_india/sgst_calculator.rb