Sha256: 37b1413b90c57e6b7dab4c79a33ab3326fab969f2834903270c2a8f29ce81cc0

Contents?: true

Size: 1.34 KB

Versions: 1

Compression:

Stored size: 1.34 KB

Contents

module SingaporeCharitableDonations
  module Calculators
    module MBMF

      # Mosque Building and Mendaki Fund contribution calculator for June 1st, 2016 onwards
      module Year2016Calculator
        class << self

          # @param [BigDecimal] total_wages
          # @return [BigDecimal] contribution amount
          def calculate(total_wages)
            case
            when total_wages <= 1_000.00
              BigDecimal "3.00"
            when total_wages <= 2_000.00
              BigDecimal "4.50"
            when total_wages <= 3_000.00
              BigDecimal "6.50"
            when total_wages <= 4_000.00
              BigDecimal "15.00"
            when total_wages <= 6_000.00
              BigDecimal "19.50"
            when total_wages <= 8_000.00
              BigDecimal "22.00"
            when total_wages <= 10_000.00
              BigDecimal "24.00"
            else # total_wages >= 10_000.00
              BigDecimal "26.00"
            end
          end

          # @param [Date] date to be considered for calculation
          # @param [String] type of charitable contribution
          # @return [TrueClass, FalseClass]
          def applies_to?(date, type)
            date >= CUTOFF_DATE && type == 'MBMF'
          end

          private

          CUTOFF_DATE = Date.new(2016,6,1)

        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
singapore_charitable_donations-1.0.3 lib/singapore_charitable_donations/calculators/mbmf/year_2016_calculator.rb