Skip to content

armgit / sure

Public Imported from GitHub
0

The personal finance app for everyone (by everyone)

Ruby

Add Employees' Provident Fund (EPF) investment subtype for India (#4647)

TheRodzz3d860c503521
diff --git a/app/models/investment.rb b/app/models/investment.rb
index 7139f66b25..e88c51d727 100644
--- a/app/models/investment.rb
+++ b/app/models/investment.rb
@@ -66,6 +66,7 @@ class Investment < ApplicationRecord
"indian_equity" => { short: "Indian Equity", long: "Indian Equity", region: "in", tax_treatment: :taxable },
"indian_etf" => { short: "Indian ETF", long: "Indian ETF", region: "in", tax_treatment: :taxable },
# Fixed-income / small-savings
+ "epf" => { short: "EPF", long: "Employees' Provident Fund", region: "in", tax_treatment: :tax_advantaged },
"ppf" => { short: "PPF", long: "Public Provident Fund", region: "in", tax_treatment: :tax_exempt },
"ssy" => { short: "SSY", long: "Sukanya Samriddhi Yojana", region: "in", tax_treatment: :tax_exempt },
"nsc" => { short: "NSC", long: "National Savings Certificate", region: "in", tax_treatment: :tax_advantaged },
diff --git a/config/locales/views/investments/en.yml b/config/locales/views/investments/en.yml
index 6e098d4fde..2ce135a42b 100644
--- a/config/locales/views/investments/en.yml
+++ b/config/locales/views/investments/en.yml
@@ -122,6 +122,9 @@ en:
life_insurance:
short: Life Insurance
long: Life Insurance
+ epf:
+ short: EPF
+ long: Employees' Provident Fund
ppf:
short: PPF
long: Public Provident Fund
diff --git a/test/models/investment_test.rb b/test/models/investment_test.rb
index 524afe3783..c58f653d17 100644
--- a/test/models/investment_test.rb
+++ b/test/models/investment_test.rb
@@ -144,12 +144,20 @@ class InvestmentTest < ActiveSupport::TestCase
# India account types
test "India pension subtypes have tax_advantaged treatment" do
- %w[nps apy].each do |subtype|
+ %w[nps apy epf].each do |subtype|
investment = Investment.new(subtype: subtype)
assert_equal :tax_advantaged, investment.tax_treatment, "Expected #{subtype} to be tax_advantaged"
end
end
+ test "EPF is an India subtype available to INR users" do
+ assert_equal "in", Investment::SUBTYPES.dig("epf", :region)
+ assert_equal "Employees' Provident Fund", Investment::SUBTYPES.dig("epf", :long)
+
+ india_group = Investment.subtypes_grouped_for_select(currency: "INR").first[1]
+ assert_includes india_group.map(&:last), "epf"
+ end
+
test "India equity subtypes are taxable" do
%w[indian_stocks indian_equity indian_etf].each do |subtype|
investment = Investment.new(subtype: subtype)