Sha256: 7d908c9cb52d8cd9fb6c5938741d8d79ef96b3d4a6463a265c073bd581f422d2

Contents?: true

Size: 520 Bytes

Versions: 1

Compression:

Stored size: 520 Bytes

Contents

# frozen_string_literal: true

require_dependency 'spree/calculator'

module SolidusIndia
  class CgstCalculator < 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: 'CGST')
      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/cgst_calculator.rb