singapore_cpf_calculator 1.1.1 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/build.yml +33 -0
- data/Gemfile +1 -0
- data/README.md +17 -5
- data/lib/singapore_cpf_calculator/age_group.rb +60 -15
- data/lib/singapore_cpf_calculator/base_calculator.rb +60 -8
- data/lib/singapore_cpf_calculator/cpf_contribution.rb +14 -3
- data/lib/singapore_cpf_calculator/null_contribution_calculator.rb +4 -2
- data/lib/singapore_cpf_calculator/requirements/group_55_years_and_below.rb +13 -0
- data/lib/singapore_cpf_calculator/requirements/group_above_65_to_70_years.rb +13 -0
- data/lib/singapore_cpf_calculator/requirements/group_above_70_years.rb +13 -0
- data/lib/singapore_cpf_calculator/requirements.rb +4 -0
- data/lib/singapore_cpf_calculator/residency_module_common.rb +5 -1
- data/lib/singapore_cpf_calculator/version.rb +1 -1
- data/lib/singapore_cpf_calculator/year_2012_to_2015_aw_ceiling_module.rb +7 -0
- data/lib/singapore_cpf_calculator/year_2014/base.rb +1 -0
- data/lib/singapore_cpf_calculator/year_2014/citizen_or_spr_3/citzen_or_spr3_base.rb +8 -0
- data/lib/singapore_cpf_calculator/year_2015/base.rb +1 -0
- data/lib/singapore_cpf_calculator/year_2015/citizen_or_spr_3/age_50_below_contribution_calculator.rb +1 -1
- data/lib/singapore_cpf_calculator/year_2015/citizen_or_spr_3/age_50_to_55_contribution_calculator.rb +1 -1
- data/lib/singapore_cpf_calculator/year_2015/citizen_or_spr_3/age_55_to_60_contribution_calculator.rb +1 -1
- data/lib/singapore_cpf_calculator/year_2015/citizen_or_spr_3/age_60_to_65_contribution_calculator.rb +1 -1
- data/lib/singapore_cpf_calculator/year_2015/citizen_or_spr_3/age_65_up_contribution_calculator.rb +1 -1
- data/lib/singapore_cpf_calculator/year_2015/citizen_or_spr_3/citizen_or_spr3_base.rb +9 -0
- data/lib/singapore_cpf_calculator/year_2015/citizen_or_spr_3.rb +1 -0
- data/lib/singapore_cpf_calculator/year_2015.rb +1 -1
- data/lib/singapore_cpf_calculator/year_2016/base.rb +21 -0
- data/lib/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_55_below_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_55_to_60_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_60_to_65_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_65_up_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2016/citizen_or_spr_3/citizen_or_spr3_base.rb +9 -0
- data/lib/singapore_cpf_calculator/year_2016/citizen_or_spr_3.rb +34 -0
- data/lib/singapore_cpf_calculator/year_2016/spr_1_fg/age_55_below_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2016/spr_1_fg/age_55_to_60_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2016/spr_1_fg/age_60_to_65_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2016/spr_1_fg/age_65_up_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2016/spr_1_fg.rb +35 -0
- data/lib/singapore_cpf_calculator/year_2016/spr_1_gg/age_55_below_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2016/spr_1_gg/age_55_to_60_contribution_calculator.rb +14 -0
- data/lib/singapore_cpf_calculator/year_2016/spr_1_gg/age_60_to_65_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2016/spr_1_gg/age_65_up_contribution_calculator.rb +14 -0
- data/lib/singapore_cpf_calculator/year_2016/spr_1_gg.rb +34 -0
- data/lib/singapore_cpf_calculator/year_2016/spr_2_fg/age_55_below_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2016/spr_2_fg/age_55_to_60_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2016/spr_2_fg/age_60_to_65_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2016/spr_2_fg/age_65_up_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2016/spr_2_fg.rb +34 -0
- data/lib/singapore_cpf_calculator/year_2016/spr_2_gg/age_55_below_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2016/spr_2_gg/age_55_to_60_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2016/spr_2_gg/age_60_to_65_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2016/spr_2_gg/age_65_up_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2016/spr_2_gg.rb +34 -0
- data/lib/singapore_cpf_calculator/year_2016.rb +38 -0
- data/lib/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_55_below_contribution_calculator.rb +8 -0
- data/lib/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_55_to_60_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_60_to_65_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_65_to_70_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_70_up_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2022/citizen_or_spr_3/citizen_or_spr3_base.rb +9 -0
- data/lib/singapore_cpf_calculator/year_2022/citizen_or_spr_3.rb +40 -0
- data/lib/singapore_cpf_calculator/year_2022/spr_1_fg/age_55_below_contribution_calculator.rb +11 -0
- data/lib/singapore_cpf_calculator/year_2022/spr_1_fg/age_55_to_60_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2022/spr_1_fg/age_60_to_65_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2022/spr_1_fg/age_65_to_70_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2022/spr_1_fg/age_70_up_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2022/spr_1_fg.rb +40 -0
- data/lib/singapore_cpf_calculator/year_2022/spr_1_gg/age_55_below_contribution_calculator.rb +11 -0
- data/lib/singapore_cpf_calculator/year_2022/spr_1_gg/age_55_to_60_contribution_calculator.rb +12 -0
- data/lib/singapore_cpf_calculator/year_2022/spr_1_gg/age_60_to_65_contribution_calculator.rb +11 -0
- data/lib/singapore_cpf_calculator/year_2022/spr_1_gg/age_65_up_contribution_calculator.rb +14 -0
- data/lib/singapore_cpf_calculator/year_2022/spr_1_gg.rb +34 -0
- data/lib/singapore_cpf_calculator/year_2022/spr_2_fg/age_55_below_contribution_calculator.rb +11 -0
- data/lib/singapore_cpf_calculator/year_2022/spr_2_fg/age_55_to_60_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2022/spr_2_fg/age_60_to_65_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2022/spr_2_fg/age_65_to_70_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2022/spr_2_fg/age_70_up_contribution_calculator.rb +32 -0
- data/lib/singapore_cpf_calculator/year_2022/spr_2_fg.rb +40 -0
- data/lib/singapore_cpf_calculator/year_2022/spr_2_gg/age_55_below_contribution_calculator.rb +11 -0
- data/lib/singapore_cpf_calculator/year_2022/spr_2_gg/age_55_to_60_contribution_calculator.rb +11 -0
- data/lib/singapore_cpf_calculator/year_2022/spr_2_gg/age_60_to_65_contribution_calculator.rb +11 -0
- data/lib/singapore_cpf_calculator/year_2022/spr_2_gg/age_65_up_contribution_calculator.rb +11 -0
- data/lib/singapore_cpf_calculator/year_2022/spr_2_gg.rb +34 -0
- data/lib/singapore_cpf_calculator/year_2022.rb +35 -0
- data/lib/singapore_cpf_calculator.rb +36 -15
- data/singapore_cpf_calculator.gemspec +3 -4
- data/spec/acceptance/company_a.csv +1367 -1365
- data/spec/acceptance/company_a_spec.rb +6 -4
- data/spec/singapore_cpf_calculator/age_group_spec.rb +15 -3
- data/spec/singapore_cpf_calculator/year_2014/citizen_or_spr_3/age_50_below_contribution_calculator_spec.rb +10 -10
- data/spec/singapore_cpf_calculator/year_2015/citizen_or_spr_3_spec.rb +45 -10
- data/spec/singapore_cpf_calculator/year_2015/spr_1_fg_spec.rb +10 -10
- data/spec/singapore_cpf_calculator/year_2015/spr_1_gg_spec.rb +11 -11
- data/spec/singapore_cpf_calculator/year_2015/spr_2_fg_spec.rb +11 -11
- data/spec/singapore_cpf_calculator/year_2015/spr_2_gg/age_55_to_60_contribution_calculator_spec.rb +8 -8
- data/spec/singapore_cpf_calculator/year_2015/spr_2_gg_spec.rb +11 -11
- data/spec/singapore_cpf_calculator/year_2015_spec.rb +3 -3
- data/spec/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_55_below_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_55_to_60_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_60_to_65_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_65_up_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2016/citizen_or_spr_3_spec.rb +224 -0
- data/spec/singapore_cpf_calculator/year_2016/spr_1_fg/age_55_below_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2016/spr_1_fg/age_55_to_60_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2016/spr_1_fg/age_60_to_65_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2016/spr_1_fg/age_65_up_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2016/spr_1_fg_spec.rb +158 -0
- data/spec/singapore_cpf_calculator/year_2016/spr_1_gg/age_55_below_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2016/spr_1_gg/age_55_to_60_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2016/spr_1_gg/age_60_to_65_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2016/spr_1_gg/age_65_up_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2016/spr_1_gg_spec.rb +158 -0
- data/spec/singapore_cpf_calculator/year_2016/spr_2_fg/age_55_below_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2016/spr_2_fg/age_55_to_60_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2016/spr_2_fg/age_60_to_65_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2016/spr_2_fg/age_65_up_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2016/spr_2_fg_spec.rb +158 -0
- data/spec/singapore_cpf_calculator/year_2016/spr_2_gg/age_55_below_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2016/spr_2_gg/age_55_to_60_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2016/spr_2_gg/age_60_to_65_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2016/spr_2_gg/age_65_up_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2016/spr_2_gg_spec.rb +158 -0
- data/spec/singapore_cpf_calculator/year_2016_spec.rb +187 -0
- data/spec/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_55_below_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_55_to_60_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_60_to_65_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_65_to_70_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_70_up_contribution_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2022/citizen_or_spr_3_spec.rb +242 -0
- data/spec/singapore_cpf_calculator/year_2022/spr_1_fg/age_55_below_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2022/spr_1_fg/age_55_to_60_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2022/spr_1_fg/age_60_to_65_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2022/spr_1_fg/age_65_to_70_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2022/spr_1_fg/age_70_up_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2022/spr_1_fg_spec.rb +176 -0
- data/spec/singapore_cpf_calculator/year_2022/spr_1_gg/age_55_below_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2022/spr_1_gg/age_55_to_60_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2022/spr_1_gg/age_60_to_65_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2022/spr_1_gg/age_65_up_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2022/spr_1_gg_spec.rb +158 -0
- data/spec/singapore_cpf_calculator/year_2022/spr_2_fg/age_55_below_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2022/spr_2_fg/age_55_to_60_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2022/spr_2_fg/age_60_to_65_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2022/spr_2_fg/age_65_to_70_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2022/spr_2_fg/age_70_up_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2022/spr_2_fg_spec.rb +176 -0
- data/spec/singapore_cpf_calculator/year_2022/spr_2_gg/age_55_below_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2022/spr_2_gg/age_55_to_60_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2022/spr_2_gg/age_60_to_65_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2022/spr_2_gg/age_65_up_contribution_calculator_spec.rb +63 -0
- data/spec/singapore_cpf_calculator/year_2022/spr_2_gg_spec.rb +158 -0
- data/spec/singapore_cpf_calculator/year_2022_spec.rb +192 -0
- data/spec/singapore_cpf_calculator_spec.rb +87 -2
- data/spec/spec_helper.rb +17 -10
- metadata +183 -23
- data/circle.yml +0 -3
@@ -0,0 +1,32 @@
|
|
1
|
+
module SingaporeCPFCalculator
|
2
|
+
module Year2022
|
3
|
+
module SPR2FG
|
4
|
+
|
5
|
+
# Payment calculator for Singapore's Central Provident Fund for employee's age 60 to 65.
|
6
|
+
class Age60To65ContributionCalculator < Year2016::Base
|
7
|
+
|
8
|
+
extend Requirements::GroupAbove60To65Years
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def tc_rate_1
|
13
|
+
"0.1"
|
14
|
+
end
|
15
|
+
|
16
|
+
def tc_rate_2
|
17
|
+
"0.175"
|
18
|
+
end
|
19
|
+
|
20
|
+
def ec_rate
|
21
|
+
"0.075"
|
22
|
+
end
|
23
|
+
|
24
|
+
def adjustment_rate
|
25
|
+
"0.225"
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module SingaporeCPFCalculator
|
2
|
+
module Year2022
|
3
|
+
module SPR2FG
|
4
|
+
|
5
|
+
# Payment calculator for Singapore's Central Provident Fund for employee's age 65 and above.
|
6
|
+
class Age65To70ContributionCalculator < Year2016::Base
|
7
|
+
|
8
|
+
extend Requirements::GroupAbove65To70Years
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def tc_rate_1
|
13
|
+
"0.08"
|
14
|
+
end
|
15
|
+
|
16
|
+
def tc_rate_2
|
17
|
+
"0.13"
|
18
|
+
end
|
19
|
+
|
20
|
+
def ec_rate
|
21
|
+
"0.05"
|
22
|
+
end
|
23
|
+
|
24
|
+
def adjustment_rate
|
25
|
+
"0.15"
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module SingaporeCPFCalculator
|
2
|
+
module Year2022
|
3
|
+
module SPR2FG
|
4
|
+
|
5
|
+
# Payment calculator for Singapore's Central Provident Fund for employee's age 65 and above.
|
6
|
+
class Age70UpContributionCalculator < Year2016::Base
|
7
|
+
|
8
|
+
extend Requirements::GroupAbove70Years
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def tc_rate_1
|
13
|
+
"0.075"
|
14
|
+
end
|
15
|
+
|
16
|
+
def tc_rate_2
|
17
|
+
"0.125"
|
18
|
+
end
|
19
|
+
|
20
|
+
def ec_rate
|
21
|
+
"0.05"
|
22
|
+
end
|
23
|
+
|
24
|
+
def adjustment_rate
|
25
|
+
"0.15"
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require_relative "spr_2_fg/age_55_below_contribution_calculator"
|
2
|
+
require_relative "spr_2_fg/age_55_to_60_contribution_calculator"
|
3
|
+
require_relative "spr_2_fg/age_60_to_65_contribution_calculator"
|
4
|
+
require_relative "spr_2_fg/age_65_to_70_contribution_calculator"
|
5
|
+
require_relative "spr_2_fg/age_70_up_contribution_calculator"
|
6
|
+
|
7
|
+
module SingaporeCPFCalculator
|
8
|
+
module Year2022
|
9
|
+
|
10
|
+
# For Singapore Permanent Resident (SPR) on their first year with graduated (G, partial)
|
11
|
+
# employer contribution and graduated (G, partial) employee contribution
|
12
|
+
module SPR2FG
|
13
|
+
|
14
|
+
extend ResidencyModuleCommon
|
15
|
+
extend SPR2FGCommon
|
16
|
+
|
17
|
+
class << self
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def has_70_up
|
22
|
+
true
|
23
|
+
end
|
24
|
+
|
25
|
+
def calculators
|
26
|
+
[
|
27
|
+
Age55BelowContributionCalculator,
|
28
|
+
Age55To60ContributionCalculator,
|
29
|
+
Age60To65ContributionCalculator,
|
30
|
+
Age65To70ContributionCalculator,
|
31
|
+
Age70UpContributionCalculator,
|
32
|
+
]
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module SingaporeCPFCalculator
|
2
|
+
module Year2022
|
3
|
+
module SPR2GG
|
4
|
+
|
5
|
+
# Payment calculator for Singapore's Central Provident Fund for employee's age 50 and below.
|
6
|
+
class Age55BelowContributionCalculator < Year2016::SPR2GG::Age55BelowContributionCalculator
|
7
|
+
end
|
8
|
+
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module SingaporeCPFCalculator
|
2
|
+
module Year2022
|
3
|
+
module SPR2GG
|
4
|
+
|
5
|
+
# Payment calculator for Singapore's Central Provident Fund for employee's age 55 to 60.
|
6
|
+
class Age55To60ContributionCalculator < Year2016::SPR2GG::Age55To60ContributionCalculator
|
7
|
+
end
|
8
|
+
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module SingaporeCPFCalculator
|
2
|
+
module Year2022
|
3
|
+
module SPR2GG
|
4
|
+
|
5
|
+
# Payment calculator for Singapore's Central Provident Fund for employee's age 60 to 65.
|
6
|
+
class Age60To65ContributionCalculator < Year2016::SPR2GG::Age60To65ContributionCalculator
|
7
|
+
end
|
8
|
+
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module SingaporeCPFCalculator
|
2
|
+
module Year2022
|
3
|
+
module SPR2GG
|
4
|
+
|
5
|
+
# Payment calculator for Singapore's Central Provident Fund for employee's age 65 and above.
|
6
|
+
class Age65UpContributionCalculator < Year2016::SPR2GG::Age65UpContributionCalculator
|
7
|
+
end
|
8
|
+
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require_relative "spr_2_gg/age_55_below_contribution_calculator"
|
2
|
+
require_relative "spr_2_gg/age_55_to_60_contribution_calculator"
|
3
|
+
require_relative "spr_2_gg/age_60_to_65_contribution_calculator"
|
4
|
+
require_relative "spr_2_gg/age_65_up_contribution_calculator"
|
5
|
+
|
6
|
+
module SingaporeCPFCalculator
|
7
|
+
module Year2022
|
8
|
+
|
9
|
+
# For Singapore Permanent Resident (SPR) on their first year with graduated (G, partial)
|
10
|
+
# employer contribution and graduated (G, partial) employee contribution
|
11
|
+
module SPR2GG
|
12
|
+
|
13
|
+
extend ResidencyModuleCommon
|
14
|
+
extend SPR2GGCommon
|
15
|
+
|
16
|
+
class << self
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def calculators
|
21
|
+
[
|
22
|
+
Age55BelowContributionCalculator,
|
23
|
+
Age55To60ContributionCalculator,
|
24
|
+
Age60To65ContributionCalculator,
|
25
|
+
Age65UpContributionCalculator,
|
26
|
+
]
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require_relative "year_2016/base"
|
2
|
+
require_relative "year_2022/citizen_or_spr_3"
|
3
|
+
require_relative "year_2022/spr_2_gg"
|
4
|
+
require_relative "year_2022/spr_2_fg"
|
5
|
+
require_relative "year_2022/spr_1_gg"
|
6
|
+
require_relative "year_2022/spr_1_fg"
|
7
|
+
|
8
|
+
module SingaporeCPFCalculator
|
9
|
+
# Contains the calculators that are used for determining CPF contribution for 2022.
|
10
|
+
module Year2022
|
11
|
+
class << self
|
12
|
+
include YearCommon
|
13
|
+
|
14
|
+
# @param [Date] date when the CPF contribution is to be calculated for.
|
15
|
+
# @return [true, false] true when the date's year is 2022 and later
|
16
|
+
def applies_to?(date)
|
17
|
+
date.year >= 2022
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def residency_modules
|
23
|
+
[
|
24
|
+
CitizenOrSPR3,
|
25
|
+
SPR2GG,
|
26
|
+
SPR2FG,
|
27
|
+
SPR1GG,
|
28
|
+
SPR1FG,
|
29
|
+
BeforeSPR,
|
30
|
+
]
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
@@ -12,7 +12,9 @@ module SingaporeCPFCalculator
|
|
12
12
|
# ordinary_wages: 700.00,
|
13
13
|
# additional_wages: 252.00,
|
14
14
|
# employee_contribution_type: "full",
|
15
|
-
# employer_contribution_type: "full"
|
15
|
+
# employer_contribution_type: "full",
|
16
|
+
# ytd_additional_wages: 20_000,
|
17
|
+
# ytd_ow_subject_to_cpf: 60_000
|
16
18
|
#
|
17
19
|
# result # => #<SingaporeCPFCalculator::CPFContribution ...>
|
18
20
|
# result.employee # => 190.00
|
@@ -34,23 +36,27 @@ module SingaporeCPFCalculator
|
|
34
36
|
# Additional wages are wage supplements which are not granted wholly and exclusively for the
|
35
37
|
# month, such as annual bonus and leave pay. These and other incentive payments may be made at
|
36
38
|
# intervals of more than a month.
|
37
|
-
#
|
39
|
+
# @param [BigDecimal] ytd_additional_wages:
|
40
|
+
# Cumulative Additional Wages for the year (YTD)
|
41
|
+
# @param [BigDecimal] ytd_ow_subject_to_cpf:
|
42
|
+
# The Year to Date Ordinary Wages which have been subject to CPF.
|
38
43
|
# @return [CPFContribution]
|
39
|
-
def calculate(
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
44
|
+
def calculate(date:,
|
45
|
+
birthdate:,
|
46
|
+
residency_status:,
|
47
|
+
spr_start_date: nil,
|
48
|
+
ordinary_wages:,
|
49
|
+
additional_wages:,
|
50
|
+
employee_contribution_type: nil,
|
51
|
+
employer_contribution_type: nil,
|
52
|
+
ytd_additional_wages: 0.0,
|
53
|
+
ytd_ow_subject_to_cpf: 0.0,
|
54
|
+
estimated_yearly_ow: 0.0)
|
55
|
+
validate_params(date: date,
|
50
56
|
employee_contribution_type: employee_contribution_type,
|
51
57
|
employer_contribution_type: employer_contribution_type,
|
52
58
|
residency_status: residency_status,
|
53
|
-
spr_start_date: spr_start_date
|
59
|
+
spr_start_date: spr_start_date)
|
54
60
|
|
55
61
|
module_for_date(date).
|
56
62
|
module_for_residency(
|
@@ -60,7 +66,11 @@ module SingaporeCPFCalculator
|
|
60
66
|
employee_contribution_type: employee_contribution_type,
|
61
67
|
employer_contribution_type: employer_contribution_type
|
62
68
|
).calculator_for(date, birthdate: birthdate).
|
63
|
-
calculate ordinary_wages: ordinary_wages,
|
69
|
+
calculate ordinary_wages: ordinary_wages,
|
70
|
+
additional_wages: additional_wages,
|
71
|
+
ytd_additional_wages: ytd_additional_wages,
|
72
|
+
ytd_ow_subject_to_cpf: ytd_ow_subject_to_cpf,
|
73
|
+
estimated_yearly_ow: estimated_yearly_ow
|
64
74
|
end
|
65
75
|
|
66
76
|
private
|
@@ -76,16 +86,22 @@ module SingaporeCPFCalculator
|
|
76
86
|
raise ArgumentError, "spr_start_date: must be set" if spr_start_date.nil?
|
77
87
|
if contribution_types_required?(date, spr_start_date)
|
78
88
|
if employee_contribution_type.nil?
|
89
|
+
# :nocov:
|
79
90
|
raise ArgumentError, "employee_contribution_type: must be set"
|
91
|
+
# :nocov:
|
80
92
|
end
|
81
93
|
if employer_contribution_type.nil?
|
94
|
+
# :nocov:
|
82
95
|
raise ArgumentError, "employer_contribution_type: must be set"
|
96
|
+
# :nocov:
|
83
97
|
end
|
84
98
|
end
|
85
99
|
end
|
86
100
|
|
87
101
|
unless ["citizen", "permanent_resident"].include? residency_status
|
102
|
+
# :nocov:
|
88
103
|
raise ArgumentError, "unsupported residency status: #{ residency_status }"
|
104
|
+
# :nocov:
|
89
105
|
end
|
90
106
|
end
|
91
107
|
|
@@ -102,6 +118,8 @@ module SingaporeCPFCalculator
|
|
102
118
|
[
|
103
119
|
Year2014,
|
104
120
|
Year2015,
|
121
|
+
Year2016,
|
122
|
+
Year2022
|
105
123
|
]
|
106
124
|
end
|
107
125
|
end
|
@@ -121,5 +139,8 @@ require_relative "singapore_cpf_calculator/spr_1_fg_common"
|
|
121
139
|
require_relative "singapore_cpf_calculator/spr_1_gg_common"
|
122
140
|
require_relative "singapore_cpf_calculator/spr_2_fg_common"
|
123
141
|
require_relative "singapore_cpf_calculator/spr_2_gg_common"
|
142
|
+
require_relative 'singapore_cpf_calculator/year_2012_to_2015_aw_ceiling_module'
|
124
143
|
require_relative "singapore_cpf_calculator/year_2014"
|
125
144
|
require_relative "singapore_cpf_calculator/year_2015"
|
145
|
+
require_relative "singapore_cpf_calculator/year_2016"
|
146
|
+
require_relative "singapore_cpf_calculator/year_2022"
|
@@ -6,8 +6,8 @@ require 'singapore_cpf_calculator/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "singapore_cpf_calculator"
|
8
8
|
spec.version = SingaporeCPFCalculator::VERSION
|
9
|
-
spec.authors = ["Ronald Maravilla"]
|
10
|
-
spec.email = ["
|
9
|
+
spec.authors = ["Ronald Maravilla", "Mathieu Jobin", "Pete Henchaw"]
|
10
|
+
spec.email = ["support@payrollhero.com"]
|
11
11
|
spec.summary = "A Singapore's Central Provident Fund (CPF) contributions calculator."
|
12
12
|
spec.description = "A Singapore's Central Provident Fund (CPF) contributions calculator."
|
13
13
|
spec.homepage = "https://github.com/payrollhero/singapore_cpf_calculator"
|
@@ -18,10 +18,9 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_development_dependency "bundler", "
|
21
|
+
spec.add_development_dependency "bundler", ">= 1.6"
|
22
22
|
spec.add_development_dependency "rake"
|
23
23
|
spec.add_development_dependency "rspec"
|
24
|
-
spec.add_development_dependency "codeclimate-test-reporter"
|
25
24
|
|
26
25
|
spec.add_dependency "activesupport"
|
27
26
|
end
|