singapore_cpf_calculator 1.3.4 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/build.yml +33 -0
  3. data/Gemfile +1 -0
  4. data/README.md +1 -0
  5. data/lib/singapore_cpf_calculator/age_group.rb +27 -5
  6. data/lib/singapore_cpf_calculator/base_calculator.rb +14 -2
  7. data/lib/singapore_cpf_calculator/requirements/group_above_65_to_70_years.rb +13 -0
  8. data/lib/singapore_cpf_calculator/requirements/group_above_70_years.rb +13 -0
  9. data/lib/singapore_cpf_calculator/requirements.rb +3 -0
  10. data/lib/singapore_cpf_calculator/residency_module_common.rb +5 -1
  11. data/lib/singapore_cpf_calculator/version.rb +1 -1
  12. data/lib/singapore_cpf_calculator/year_2016.rb +2 -2
  13. data/lib/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_55_below_contribution_calculator.rb +8 -0
  14. data/lib/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_55_to_60_contribution_calculator.rb +32 -0
  15. data/lib/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_60_to_65_contribution_calculator.rb +32 -0
  16. data/lib/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_65_to_70_contribution_calculator.rb +32 -0
  17. data/lib/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_70_up_contribution_calculator.rb +32 -0
  18. data/lib/singapore_cpf_calculator/year_2022/citizen_or_spr_3/citizen_or_spr3_base.rb +9 -0
  19. data/lib/singapore_cpf_calculator/year_2022/citizen_or_spr_3.rb +40 -0
  20. data/lib/singapore_cpf_calculator/year_2022/spr_1_fg/age_55_below_contribution_calculator.rb +11 -0
  21. data/lib/singapore_cpf_calculator/year_2022/spr_1_fg/age_55_to_60_contribution_calculator.rb +32 -0
  22. data/lib/singapore_cpf_calculator/year_2022/spr_1_fg/age_60_to_65_contribution_calculator.rb +32 -0
  23. data/lib/singapore_cpf_calculator/year_2022/spr_1_fg/age_65_to_70_contribution_calculator.rb +32 -0
  24. data/lib/singapore_cpf_calculator/year_2022/spr_1_fg/age_70_up_contribution_calculator.rb +32 -0
  25. data/lib/singapore_cpf_calculator/year_2022/spr_1_fg.rb +40 -0
  26. data/lib/singapore_cpf_calculator/year_2022/spr_1_gg/age_55_below_contribution_calculator.rb +11 -0
  27. data/lib/singapore_cpf_calculator/year_2022/spr_1_gg/age_55_to_60_contribution_calculator.rb +12 -0
  28. data/lib/singapore_cpf_calculator/year_2022/spr_1_gg/age_60_to_65_contribution_calculator.rb +11 -0
  29. data/lib/singapore_cpf_calculator/year_2022/spr_1_gg/age_65_up_contribution_calculator.rb +14 -0
  30. data/lib/singapore_cpf_calculator/year_2022/spr_1_gg.rb +34 -0
  31. data/lib/singapore_cpf_calculator/year_2022/spr_2_fg/age_55_below_contribution_calculator.rb +11 -0
  32. data/lib/singapore_cpf_calculator/year_2022/spr_2_fg/age_55_to_60_contribution_calculator.rb +32 -0
  33. data/lib/singapore_cpf_calculator/year_2022/spr_2_fg/age_60_to_65_contribution_calculator.rb +32 -0
  34. data/lib/singapore_cpf_calculator/year_2022/spr_2_fg/age_65_to_70_contribution_calculator.rb +32 -0
  35. data/lib/singapore_cpf_calculator/year_2022/spr_2_fg/age_70_up_contribution_calculator.rb +32 -0
  36. data/lib/singapore_cpf_calculator/year_2022/spr_2_fg.rb +40 -0
  37. data/lib/singapore_cpf_calculator/year_2022/spr_2_gg/age_55_below_contribution_calculator.rb +11 -0
  38. data/lib/singapore_cpf_calculator/year_2022/spr_2_gg/age_55_to_60_contribution_calculator.rb +11 -0
  39. data/lib/singapore_cpf_calculator/year_2022/spr_2_gg/age_60_to_65_contribution_calculator.rb +11 -0
  40. data/lib/singapore_cpf_calculator/year_2022/spr_2_gg/age_65_up_contribution_calculator.rb +11 -0
  41. data/lib/singapore_cpf_calculator/year_2022/spr_2_gg.rb +34 -0
  42. data/lib/singapore_cpf_calculator/year_2022.rb +35 -0
  43. data/lib/singapore_cpf_calculator.rb +9 -1
  44. data/singapore_cpf_calculator.gemspec +2 -2
  45. data/spec/singapore_cpf_calculator/age_group_spec.rb +15 -3
  46. data/spec/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_55_to_60_contribution_calculator_spec.rb +1 -1
  47. data/spec/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_60_to_65_contribution_calculator_spec.rb +2 -2
  48. data/spec/singapore_cpf_calculator/year_2016/citizen_or_spr_3_spec.rb +3 -3
  49. data/spec/singapore_cpf_calculator/year_2016/spr_1_fg/age_55_to_60_contribution_calculator_spec.rb +1 -1
  50. data/spec/singapore_cpf_calculator/year_2016/spr_1_fg/age_60_to_65_contribution_calculator_spec.rb +1 -1
  51. data/spec/singapore_cpf_calculator/year_2016/spr_2_fg/age_60_to_65_contribution_calculator_spec.rb +1 -1
  52. data/spec/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_55_below_contribution_calculator_spec.rb +63 -0
  53. data/spec/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_55_to_60_contribution_calculator_spec.rb +63 -0
  54. data/spec/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_60_to_65_contribution_calculator_spec.rb +63 -0
  55. data/spec/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_65_to_70_contribution_calculator_spec.rb +63 -0
  56. data/spec/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_70_up_contribution_spec.rb +63 -0
  57. data/spec/singapore_cpf_calculator/year_2022/citizen_or_spr_3_spec.rb +242 -0
  58. data/spec/singapore_cpf_calculator/year_2022/spr_1_fg/age_55_below_contribution_calculator_spec.rb +63 -0
  59. data/spec/singapore_cpf_calculator/year_2022/spr_1_fg/age_55_to_60_contribution_calculator_spec.rb +63 -0
  60. data/spec/singapore_cpf_calculator/year_2022/spr_1_fg/age_60_to_65_contribution_calculator_spec.rb +63 -0
  61. data/spec/singapore_cpf_calculator/year_2022/spr_1_fg/age_65_to_70_contribution_calculator_spec.rb +63 -0
  62. data/spec/singapore_cpf_calculator/year_2022/spr_1_fg/age_70_up_contribution_calculator_spec.rb +63 -0
  63. data/spec/singapore_cpf_calculator/year_2022/spr_1_fg_spec.rb +176 -0
  64. data/spec/singapore_cpf_calculator/year_2022/spr_1_gg/age_55_below_contribution_calculator_spec.rb +63 -0
  65. data/spec/singapore_cpf_calculator/year_2022/spr_1_gg/age_55_to_60_contribution_calculator_spec.rb +63 -0
  66. data/spec/singapore_cpf_calculator/year_2022/spr_1_gg/age_60_to_65_contribution_calculator_spec.rb +63 -0
  67. data/spec/singapore_cpf_calculator/year_2022/spr_1_gg/age_65_up_contribution_calculator_spec.rb +63 -0
  68. data/spec/singapore_cpf_calculator/year_2022/spr_1_gg_spec.rb +158 -0
  69. data/spec/singapore_cpf_calculator/year_2022/spr_2_fg/age_55_below_contribution_calculator_spec.rb +63 -0
  70. data/spec/singapore_cpf_calculator/year_2022/spr_2_fg/age_55_to_60_contribution_calculator_spec.rb +63 -0
  71. data/spec/singapore_cpf_calculator/year_2022/spr_2_fg/age_60_to_65_contribution_calculator_spec.rb +63 -0
  72. data/spec/singapore_cpf_calculator/year_2022/spr_2_fg/age_65_to_70_contribution_calculator_spec.rb +63 -0
  73. data/spec/singapore_cpf_calculator/year_2022/spr_2_fg/age_70_up_contribution_calculator_spec.rb +63 -0
  74. data/spec/singapore_cpf_calculator/year_2022/spr_2_fg_spec.rb +176 -0
  75. data/spec/singapore_cpf_calculator/year_2022/spr_2_gg/age_55_below_contribution_calculator_spec.rb +63 -0
  76. data/spec/singapore_cpf_calculator/year_2022/spr_2_gg/age_55_to_60_contribution_calculator_spec.rb +63 -0
  77. data/spec/singapore_cpf_calculator/year_2022/spr_2_gg/age_60_to_65_contribution_calculator_spec.rb +63 -0
  78. data/spec/singapore_cpf_calculator/year_2022/spr_2_gg/age_65_up_contribution_calculator_spec.rb +63 -0
  79. data/spec/singapore_cpf_calculator/year_2022/spr_2_gg_spec.rb +158 -0
  80. data/spec/singapore_cpf_calculator/year_2022_spec.rb +192 -0
  81. data/spec/singapore_cpf_calculator_spec.rb +57 -20
  82. data/spec/spec_helper.rb +6 -1
  83. metadata +97 -5
  84. data/.travis.yml +0 -15
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2b0d8aa374278f946ccb6f54e778961317d15d455a0f0eeae1eb4bd4af7b251a
4
- data.tar.gz: a711ea455d39a43a8d3dc2b598c02db1a35e8e95b15121139a53b4dbb6640255
3
+ metadata.gz: 6ab4079969915c3c23853647786c1c5efd8dc25d2d6a6eec899a0a1010507d4e
4
+ data.tar.gz: e3f883954c14bca4c37229c775569fdb35ea0b44214ead4e3f0d47c70f707d30
5
5
  SHA512:
6
- metadata.gz: bb687c0f164156933033b3b2a8a2a00231d62c761e0c10aa8ee4d4569c98addf63d2cf9e6a30fcb8beaa4070a33e7e58defeae7fe1ea5127f11c7efb0f376e29
7
- data.tar.gz: 6969152787d83f823a60087d293b9eeea8267ae5e871ea7b3a0d9cb8712a4dc91e74e89a7b2f0d089dad70a41ce9e9abeb4ecdf2a47fba2ea370d1cd2b2346a7
6
+ metadata.gz: 5edca58bb84bb05da19a45ef8a55b24ba001f1127adbb62496248676a4bbd1851beae44b7ac462861278a951690017254ec8723c7b166bd1b718984c0b461a6f
7
+ data.tar.gz: e5bd02a156326d4439ba542d7222e8a274f543ccbe43fd01c1fafe305d570dd5f06d055005f1cd34b2adbd3174440401dd96a37960bba6f6f8af2ee5186dacce
@@ -0,0 +1,33 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: build
9
+
10
+ on: [push, pull_request]
11
+
12
+ jobs:
13
+ test:
14
+ runs-on: ubuntu-20.04
15
+ strategy:
16
+ fail-fast: false
17
+ matrix:
18
+ ruby:
19
+ - '3.1'
20
+ - '3.0'
21
+ - 2.7
22
+ - 2.6
23
+ - 2.5
24
+ - jruby-9.2.17.0
25
+ - jruby-9.3.3.0
26
+
27
+ steps:
28
+ - uses: actions/checkout@v2
29
+ - uses: ruby/setup-ruby@v1
30
+ with:
31
+ ruby-version: ${{ matrix.ruby }}
32
+ bundler-cache: true
33
+ - run: bundle exec rspec
data/Gemfile CHANGED
@@ -2,3 +2,4 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in singapore_cpf_calculator.gemspec
4
4
  gemspec
5
+ gem 'simplecov'
data/README.md CHANGED
@@ -11,6 +11,7 @@ Central Provident Fund (CPF) contributions.
11
11
 
12
12
  ## Support
13
13
 
14
+ * [Year 2022](https://www.cpf.gov.sg/content/dam/web/employer/employer-obligations/documents/CPFContributionRatesTable_1Jan2022.pdf)
14
15
  * [Year 2015](http://mycpf.cpf.gov.sg/NR/rdonlyres/9F38419D-1342-4426-820E-32BA8FDE5C6D/0/CPFContributionandAllocationRatesfrom1January2015.pdf)
15
16
  * Singapore Citizens or Singapore Permanent Residents (3rd Year Onwards)
16
17
  * Singapore Permanent Residents (SPRs) during 1st Year of SPR Status
@@ -16,16 +16,19 @@ module SingaporeCPFCalculator
16
16
  # - :group_above_55_to_60_years
17
17
  # - :group_above_60_to_65_years
18
18
  # - :group_above_65_years
19
- def get(current_date, birthdate:)
20
- new(current_date, birthdate: birthdate).get
19
+ # - :group_above_65_to_70_years
20
+ # - :group_above_70_years
21
+ def get(current_date, birthdate:, has_70_up: false)
22
+ new(current_date, birthdate: birthdate, has_70_up: has_70_up).get
21
23
  end
22
24
  end
23
25
 
24
26
  # @param [Date] current_date
25
27
  # @param [Date] birthdate:
26
- def initialize(current_date, birthdate:)
28
+ def initialize(current_date, birthdate:, has_70_up:)
27
29
  @current_date = current_date
28
30
  @birthdate = birthdate
31
+ @has_70_up = has_70_up
29
32
  end
30
33
 
31
34
  # @return [Symbol] the symbol representation of the age group
@@ -35,17 +38,21 @@ module SingaporeCPFCalculator
35
38
  # - :group_above_55_to_60_years
36
39
  # - :group_above_60_to_65_years
37
40
  # - :group_above_65_years
41
+ # - :group_above_65_to_70_years
42
+ # - :group_above_70_years
38
43
  def get
39
44
  if current_date.year <= 2015
40
45
  age_grouping_for_2015_and_earlier
41
- else
46
+ elsif current_date.year <= 2021 || !has_70_up
42
47
  age_grouping_for_2016_and_later
48
+ else
49
+ age_grouping_for_2022_and_later
43
50
  end
44
51
  end
45
52
 
46
53
  private
47
54
 
48
- attr_reader :current_date, :birthdate
55
+ attr_reader :current_date, :birthdate, :has_70_up
49
56
 
50
57
  def age
51
58
  @age ||= effective_age
@@ -89,6 +96,21 @@ module SingaporeCPFCalculator
89
96
  end
90
97
  end
91
98
 
99
+ def age_grouping_for_2022_and_later
100
+ case
101
+ when age < 55
102
+ :group_55_years_and_below
103
+ when 55 <= age && age < 60
104
+ :group_above_55_to_60_years
105
+ when 60 <= age && age < 65
106
+ :group_above_60_to_65_years
107
+ when 65 <= age && age < 70
108
+ :group_above_65_to_70_years
109
+ else # 70 <= age
110
+ :group_above_70_years
111
+ end
112
+ end
113
+
92
114
  end
93
115
 
94
116
  end
@@ -5,8 +5,8 @@ module SingaporeCPFCalculator
5
5
  class << self
6
6
  # @param [Fixnum] age
7
7
  # @return [true, false] returns true if the calculator applies to the employee's age.
8
- def applies_to?(date, birthdate:)
9
- AgeGroup.get(date, birthdate: birthdate) == required_age_group
8
+ def applies_to?(date, birthdate:, has_70_up:)
9
+ AgeGroup.get(date, birthdate: birthdate, has_70_up: has_70_up) == required_age_group
10
10
  end
11
11
 
12
12
  # @param [BigDecimal] ordinary_wages:
@@ -31,7 +31,9 @@ module SingaporeCPFCalculator
31
31
  private
32
32
 
33
33
  def required_age_group
34
+ # :nocov:
34
35
  raise NotImplementedError, "sub classes needs to implement .required_age_group"
36
+ # :nocov:
35
37
  end
36
38
  end
37
39
 
@@ -126,23 +128,33 @@ module SingaporeCPFCalculator
126
128
 
127
129
  # TC Rate 1 is
128
130
  def tc_rate_1
131
+ # :nocov:
129
132
  raise NotImplementedError, "sub classes needs to implement #tc_rate_1"
133
+ # :nocov:
130
134
  end
131
135
 
132
136
  def tc_rate_2
137
+ # :nocov:
133
138
  raise NotImplementedError, "sub classes needs to implement #tc_rate_2"
139
+ # :nocov:
134
140
  end
135
141
 
136
142
  def ec_rate
143
+ # :nocov:
137
144
  raise NotImplementedError, "sub classes needs to implement #ec_rate"
145
+ # :nocov:
138
146
  end
139
147
 
140
148
  def adjustment_rate
149
+ # :nocov:
141
150
  raise NotImplementedError, "sub classes needs to implement #adjustment_rate"
151
+ # :nocov:
142
152
  end
143
153
 
144
154
  def capped_ordinary_wages
155
+ # :nocov:
145
156
  raise NotImplementedError, "sub classes needs to implement #capped_ordinary_wages"
157
+ # :nocov:
146
158
  end
147
159
 
148
160
  # precision helper
@@ -0,0 +1,13 @@
1
+ module SingaporeCPFCalculator
2
+ module Requirements
3
+ module GroupAbove65To70Years
4
+
5
+ private
6
+
7
+ def required_age_group
8
+ :group_above_65_to_70_years
9
+ end
10
+
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ module SingaporeCPFCalculator
2
+ module Requirements
3
+ module GroupAbove70Years
4
+
5
+ private
6
+
7
+ def required_age_group
8
+ :group_above_70_years
9
+ end
10
+
11
+ end
12
+ end
13
+ end
@@ -8,4 +8,7 @@ require_relative "requirements/group_55_years_and_below"
8
8
  require_relative "requirements/group_above_50_to_55_years"
9
9
  require_relative "requirements/group_above_55_to_60_years"
10
10
  require_relative "requirements/group_above_60_to_65_years"
11
+ require_relative "requirements/group_above_65_to_70_years"
11
12
  require_relative "requirements/group_above_65_years"
13
+ require_relative "requirements/group_above_70_years"
14
+
@@ -5,7 +5,11 @@ module SingaporeCPFCalculator
5
5
  # @param [Date] birthdate
6
6
  # @return [#calculator] returns the CPF calculator that matches the age.
7
7
  def calculator_for(date, birthdate:)
8
- calculators.find { |calculator| calculator.applies_to? date, birthdate: birthdate }
8
+ calculators.find { |calculator| calculator.applies_to? date, birthdate: birthdate, has_70_up: has_70_up }
9
+ end
10
+
11
+ def has_70_up
12
+ false
9
13
  end
10
14
 
11
15
  end
@@ -1,3 +1,3 @@
1
1
  module SingaporeCPFCalculator
2
- VERSION = "1.3.4"
2
+ VERSION = "1.4.0"
3
3
  end
@@ -14,9 +14,9 @@ module SingaporeCPFCalculator
14
14
  include YearCommon
15
15
 
16
16
  # @param [Date] date when the CPF contribution is to be calculated for.
17
- # @return [true, false] true when the date's year is 2015
17
+ # @return [true, false] true when the date's year is within 2016~2022
18
18
  def applies_to?(date)
19
- date.year >= 2016
19
+ date.year >= 2016 && date.year < 2022
20
20
  end
21
21
 
22
22
  private
@@ -0,0 +1,8 @@
1
+ module SingaporeCPFCalculator
2
+ module Year2022
3
+ module CitizenOrSPR3
4
+ class Age55BelowContributionCalculator < Year2016::CitizenOrSPR3::Age55BelowContributionCalculator
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,32 @@
1
+ module SingaporeCPFCalculator
2
+ module Year2022
3
+ module CitizenOrSPR3
4
+
5
+ # Payment calculator for Singapore's Central Provident Fund for employee's age 55 to 60.
6
+ class Age55To60ContributionCalculator < CitizenOrSpr3Base
7
+
8
+ extend Requirements::GroupAbove55To60Years
9
+
10
+ private
11
+
12
+ def tc_rate_1
13
+ "0.14"
14
+ end
15
+
16
+ def tc_rate_2
17
+ "0.28"
18
+ end
19
+
20
+ def ec_rate
21
+ "0.14"
22
+ end
23
+
24
+ def adjustment_rate
25
+ "0.42"
26
+ end
27
+
28
+ end
29
+
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,32 @@
1
+ module SingaporeCPFCalculator
2
+ module Year2022
3
+ module CitizenOrSPR3
4
+
5
+ # Payment calculator for Singapore's Central Provident Fund for employee's age 60 to 65.
6
+ class Age60To65ContributionCalculator < CitizenOrSpr3Base
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.185"
18
+ end
19
+
20
+ def ec_rate
21
+ "0.085"
22
+ end
23
+
24
+ def adjustment_rate
25
+ "0.255"
26
+ end
27
+
28
+ end
29
+
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,32 @@
1
+ module SingaporeCPFCalculator
2
+ module Year2022
3
+ module CitizenOrSPR3
4
+
5
+ # Payment calculator for Singapore's Central Provident Fund for employee's age 65 and above.
6
+ class Age65To70ContributionCalculator < CitizenOrSpr3Base
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.14"
18
+ end
19
+
20
+ def ec_rate
21
+ "0.06"
22
+ end
23
+
24
+ def adjustment_rate
25
+ "0.18"
26
+ end
27
+
28
+ end
29
+
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,32 @@
1
+ module SingaporeCPFCalculator
2
+ module Year2022
3
+ module CitizenOrSPR3
4
+
5
+ # Payment calculator for Singapore's Central Provident Fund for employee's age 65 and above.
6
+ class Age70UpContributionCalculator < CitizenOrSpr3Base
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,9 @@
1
+ module SingaporeCPFCalculator
2
+ module Year2022
3
+ module CitizenOrSPR3
4
+ # Base calculator for citizen or spr3 in year 2016
5
+ class CitizenOrSpr3Base < Year2016::Base
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,40 @@
1
+ require_relative 'citizen_or_spr_3/citizen_or_spr3_base'
2
+ require_relative "citizen_or_spr_3/age_55_below_contribution_calculator"
3
+ require_relative "citizen_or_spr_3/age_55_to_60_contribution_calculator"
4
+ require_relative "citizen_or_spr_3/age_60_to_65_contribution_calculator"
5
+ require_relative "citizen_or_spr_3/age_65_to_70_contribution_calculator"
6
+ require_relative "citizen_or_spr_3/age_70_up_contribution_calculator"
7
+
8
+ module SingaporeCPFCalculator
9
+ module Year2022
10
+
11
+ # Residency module for Singaporean Citizen and Permanent Residents on their 3rd year.
12
+ module CitizenOrSPR3
13
+
14
+ extend ResidencyModuleCommon
15
+ extend CitizenOrSPR3Common
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 SPR1FG
4
+
5
+ # Payment calculator for Singapore's Central Provident Fund for employee's age 50 and below.
6
+ class Age55BelowContributionCalculator < Year2016::SPR1FG::Age55BelowContributionCalculator
7
+ end
8
+
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,32 @@
1
+ module SingaporeCPFCalculator
2
+ module Year2022
3
+ module SPR1FG
4
+
5
+ # Payment calculator for Singapore's Central Provident Fund for employee's age 55 to 60.
6
+ class Age55To60ContributionCalculator < Year2016::Base
7
+
8
+ extend Requirements::GroupAbove55To60Years
9
+
10
+ private
11
+
12
+ def tc_rate_1
13
+ "0.14"
14
+ end
15
+
16
+ def tc_rate_2
17
+ "0.19"
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 SPR1FG
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.15"
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 SPR1FG
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 SPR1FG
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_1_fg/age_55_below_contribution_calculator"
2
+ require_relative "spr_1_fg/age_55_to_60_contribution_calculator"
3
+ require_relative "spr_1_fg/age_60_to_65_contribution_calculator"
4
+ require_relative "spr_1_fg/age_65_to_70_contribution_calculator"
5
+ require_relative "spr_1_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 SPR1FG
13
+
14
+ extend ResidencyModuleCommon
15
+ extend SPR1FGCommon
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 SPR1GG
4
+
5
+ # Payment calculator for Singapore's Central Provident Fund for employee's age 50 and below.
6
+ class Age55BelowContributionCalculator < Year2016::SPR1GG::Age55BelowContributionCalculator
7
+ end
8
+
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,12 @@
1
+ module SingaporeCPFCalculator
2
+ module Year2022
3
+ module SPR1GG
4
+
5
+ # Payment calculator for Singapore's Central Provident Fund for employee's age 55 to 60.
6
+ class Age55To60ContributionCalculator < Age55BelowContributionCalculator
7
+ extend Requirements::GroupAbove55To60Years
8
+ end
9
+
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,11 @@
1
+ module SingaporeCPFCalculator
2
+ module Year2022
3
+ module SPR1GG
4
+
5
+ # Payment calculator for Singapore's Central Provident Fund for employee's age 60 to 65.
6
+ class Age60To65ContributionCalculator < Year2016::SPR1GG::Age60To65ContributionCalculator
7
+ end
8
+
9
+ end
10
+ end
11
+ end