@novha/calc-engines 7.0.0 → 7.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/all-commits.bundle +0 -0
- package/dist/capital-gains/brazil/BrazilCapitalGainsService.js +3 -0
- package/dist/capital-gains/brazil/BrazilCapitalGainsServiceImpl.js +56 -0
- package/dist/capital-gains/brazil/domain/types.js +3 -0
- package/dist/capital-gains/index.js +17 -2
- package/dist/capital-gains/india/IndiaCapitalGainsService.js +3 -0
- package/dist/capital-gains/india/IndiaCapitalGainsServiceImpl.js +58 -0
- package/dist/capital-gains/india/domain/types.js +3 -0
- package/dist/capital-gains/israel/IsraelCapitalGainsService.js +3 -0
- package/dist/capital-gains/israel/IsraelCapitalGainsServiceImpl.js +56 -0
- package/dist/capital-gains/israel/domain/types.js +3 -0
- package/dist/capital-gains/japan/JapanCapitalGainsService.js +3 -0
- package/dist/capital-gains/japan/JapanCapitalGainsServiceImpl.js +41 -0
- package/dist/capital-gains/japan/domain/types.js +3 -0
- package/dist/capital-gains/spain/SpainCapitalGainsService.js +3 -0
- package/dist/capital-gains/spain/SpainCapitalGainsServiceImpl.js +56 -0
- package/dist/capital-gains/spain/domain/types.js +3 -0
- package/dist/corporate/brazil/BrazilCorporateTaxService.js +3 -0
- package/dist/corporate/brazil/BrazilCorporateTaxServiceImpl.js +33 -0
- package/dist/corporate/brazil/domain/types.js +3 -0
- package/dist/corporate/index.js +19 -2
- package/dist/corporate/india/IndiaCorporateTaxService.js +3 -0
- package/dist/corporate/india/IndiaCorporateTaxServiceImpl.js +29 -0
- package/dist/corporate/india/domain/types.js +3 -0
- package/dist/corporate/israel/IsraelCorporateTaxService.js +3 -0
- package/dist/corporate/israel/IsraelCorporateTaxServiceImpl.js +29 -0
- package/dist/corporate/israel/domain/types.js +3 -0
- package/dist/corporate/japan/JapanCorporateTaxService.js +3 -0
- package/dist/corporate/japan/JapanCorporateTaxServiceImpl.js +29 -0
- package/dist/corporate/japan/domain/types.js +3 -0
- package/dist/corporate/netherlands/NetherlandsCorporateTaxService.js +3 -0
- package/dist/corporate/netherlands/NetherlandsCorporateTaxServiceImpl.js +40 -0
- package/dist/corporate/netherlands/domain/types.js +3 -0
- package/dist/corporate/spain/SpainCorporateTaxService.js +3 -0
- package/dist/corporate/spain/SpainCorporateTaxServiceImpl.js +29 -0
- package/dist/corporate/spain/domain/types.js +3 -0
- package/dist/corporate/switzerland/SwitzerlandCorporateTaxService.js +3 -0
- package/dist/corporate/switzerland/SwitzerlandCorporateTaxServiceImpl.js +29 -0
- package/dist/corporate/switzerland/domain/types.js +3 -0
- package/dist/income-tax/brazil/BrazilIncomeTaxService.js +3 -0
- package/dist/income-tax/brazil/BrazilIncomeTaxServiceImpl.js +78 -0
- package/dist/income-tax/brazil/domain/types.js +3 -0
- package/dist/income-tax/index.js +23 -2
- package/dist/income-tax/india/IndiaIncomeTaxService.js +3 -0
- package/dist/income-tax/india/IndiaIncomeTaxServiceImpl.js +75 -0
- package/dist/income-tax/india/domain/types.js +3 -0
- package/dist/income-tax/israel/IsraelIncomeTaxService.js +3 -0
- package/dist/income-tax/israel/IsraelIncomeTaxServiceImpl.js +62 -0
- package/dist/income-tax/israel/domain/types.js +3 -0
- package/dist/income-tax/japan/JapanIncomeTaxService.js +3 -0
- package/dist/income-tax/japan/JapanIncomeTaxServiceImpl.js +75 -0
- package/dist/income-tax/japan/domain/types.js +3 -0
- package/dist/income-tax/netherlands/NetherlandsIncomeTaxService.js +3 -0
- package/dist/income-tax/netherlands/NetherlandsIncomeTaxServiceImpl.js +62 -0
- package/dist/income-tax/netherlands/domain/types.js +3 -0
- package/dist/income-tax/spain/SpainIncomeTaxService.js +3 -0
- package/dist/income-tax/spain/SpainIncomeTaxServiceImpl.js +62 -0
- package/dist/income-tax/spain/domain/types.js +3 -0
- package/dist/income-tax/switzerland/SwitzerlandIncomeTaxService.js +3 -0
- package/dist/income-tax/switzerland/SwitzerlandIncomeTaxServiceImpl.js +62 -0
- package/dist/income-tax/switzerland/domain/types.js +3 -0
- package/dist/inheritance-tax/index.js +11 -2
- package/dist/inheritance-tax/japan/JapanInheritanceTaxService.js +3 -0
- package/dist/inheritance-tax/japan/JapanInheritanceTaxServiceImpl.js +53 -0
- package/dist/inheritance-tax/japan/domain/types.js +3 -0
- package/dist/inheritance-tax/netherlands/NetherlandsInheritanceTaxService.js +3 -0
- package/dist/inheritance-tax/netherlands/NetherlandsInheritanceTaxServiceImpl.js +52 -0
- package/dist/inheritance-tax/netherlands/domain/types.js +3 -0
- package/dist/inheritance-tax/spain/SpainInheritanceTaxService.js +3 -0
- package/dist/inheritance-tax/spain/SpainInheritanceTaxServiceImpl.js +51 -0
- package/dist/inheritance-tax/spain/domain/types.js +3 -0
- package/dist/mortgage/brazil/BrazilMortgageService.js +3 -0
- package/dist/mortgage/brazil/BrazilMortgageServiceImpl.js +76 -0
- package/dist/mortgage/brazil/domain/types.js +3 -0
- package/dist/mortgage/index.js +23 -2
- package/dist/mortgage/india/IndiaMortgageService.js +3 -0
- package/dist/mortgage/india/IndiaMortgageServiceImpl.js +76 -0
- package/dist/mortgage/india/domain/types.js +3 -0
- package/dist/mortgage/israel/IsraelMortgageService.js +3 -0
- package/dist/mortgage/israel/IsraelMortgageServiceImpl.js +100 -0
- package/dist/mortgage/israel/domain/types.js +3 -0
- package/dist/mortgage/japan/JapanMortgageService.js +3 -0
- package/dist/mortgage/japan/JapanMortgageServiceImpl.js +76 -0
- package/dist/mortgage/japan/domain/types.js +3 -0
- package/dist/mortgage/netherlands/NetherlandsMortgageService.js +3 -0
- package/dist/mortgage/netherlands/NetherlandsMortgageServiceImpl.js +83 -0
- package/dist/mortgage/netherlands/domain/types.js +3 -0
- package/dist/mortgage/spain/SpainMortgageService.js +3 -0
- package/dist/mortgage/spain/SpainMortgageServiceImpl.js +96 -0
- package/dist/mortgage/spain/domain/types.js +3 -0
- package/dist/mortgage/switzerland/SwitzerlandMortgageService.js +3 -0
- package/dist/mortgage/switzerland/SwitzerlandMortgageServiceImpl.js +80 -0
- package/dist/mortgage/switzerland/domain/types.js +3 -0
- package/dist/types/capital-gains/brazil/BrazilCapitalGainsService.d.ts +4 -0
- package/dist/types/capital-gains/brazil/BrazilCapitalGainsServiceImpl.d.ts +10 -0
- package/dist/types/capital-gains/brazil/domain/types.d.ts +11 -0
- package/dist/types/capital-gains/index.d.ts +11 -1
- package/dist/types/capital-gains/india/IndiaCapitalGainsService.d.ts +4 -0
- package/dist/types/capital-gains/india/IndiaCapitalGainsServiceImpl.d.ts +9 -0
- package/dist/types/capital-gains/india/domain/types.d.ts +9 -0
- package/dist/types/capital-gains/israel/IsraelCapitalGainsService.d.ts +4 -0
- package/dist/types/capital-gains/israel/IsraelCapitalGainsServiceImpl.d.ts +10 -0
- package/dist/types/capital-gains/israel/domain/types.d.ts +11 -0
- package/dist/types/capital-gains/japan/JapanCapitalGainsService.d.ts +4 -0
- package/dist/types/capital-gains/japan/JapanCapitalGainsServiceImpl.d.ts +9 -0
- package/dist/types/capital-gains/japan/domain/types.d.ts +6 -0
- package/dist/types/capital-gains/spain/SpainCapitalGainsService.d.ts +4 -0
- package/dist/types/capital-gains/spain/SpainCapitalGainsServiceImpl.d.ts +10 -0
- package/dist/types/capital-gains/spain/domain/types.d.ts +11 -0
- package/dist/types/corporate/brazil/BrazilCorporateTaxService.d.ts +4 -0
- package/dist/types/corporate/brazil/BrazilCorporateTaxServiceImpl.d.ts +8 -0
- package/dist/types/corporate/brazil/domain/types.d.ts +19 -0
- package/dist/types/corporate/index.d.ts +15 -1
- package/dist/types/corporate/india/IndiaCorporateTaxService.d.ts +4 -0
- package/dist/types/corporate/india/IndiaCorporateTaxServiceImpl.d.ts +8 -0
- package/dist/types/corporate/india/domain/types.d.ts +15 -0
- package/dist/types/corporate/israel/IsraelCorporateTaxService.d.ts +4 -0
- package/dist/types/corporate/israel/IsraelCorporateTaxServiceImpl.d.ts +8 -0
- package/dist/types/corporate/israel/domain/types.d.ts +15 -0
- package/dist/types/corporate/japan/JapanCorporateTaxService.d.ts +4 -0
- package/dist/types/corporate/japan/JapanCorporateTaxServiceImpl.d.ts +8 -0
- package/dist/types/corporate/japan/domain/types.d.ts +15 -0
- package/dist/types/corporate/netherlands/NetherlandsCorporateTaxService.d.ts +4 -0
- package/dist/types/corporate/netherlands/NetherlandsCorporateTaxServiceImpl.d.ts +8 -0
- package/dist/types/corporate/netherlands/domain/types.d.ts +17 -0
- package/dist/types/corporate/spain/SpainCorporateTaxService.d.ts +4 -0
- package/dist/types/corporate/spain/SpainCorporateTaxServiceImpl.d.ts +8 -0
- package/dist/types/corporate/spain/domain/types.d.ts +15 -0
- package/dist/types/corporate/switzerland/SwitzerlandCorporateTaxService.d.ts +4 -0
- package/dist/types/corporate/switzerland/SwitzerlandCorporateTaxServiceImpl.d.ts +8 -0
- package/dist/types/corporate/switzerland/domain/types.d.ts +15 -0
- package/dist/types/income-tax/brazil/BrazilIncomeTaxService.d.ts +4 -0
- package/dist/types/income-tax/brazil/BrazilIncomeTaxServiceImpl.d.ts +11 -0
- package/dist/types/income-tax/brazil/domain/types.d.ts +18 -0
- package/dist/types/income-tax/index.d.ts +15 -1
- package/dist/types/income-tax/india/IndiaIncomeTaxService.d.ts +4 -0
- package/dist/types/income-tax/india/IndiaIncomeTaxServiceImpl.d.ts +10 -0
- package/dist/types/income-tax/india/domain/types.d.ts +16 -0
- package/dist/types/income-tax/israel/IsraelIncomeTaxService.d.ts +4 -0
- package/dist/types/income-tax/israel/IsraelIncomeTaxServiceImpl.d.ts +10 -0
- package/dist/types/income-tax/israel/domain/types.d.ts +16 -0
- package/dist/types/income-tax/japan/JapanIncomeTaxService.d.ts +4 -0
- package/dist/types/income-tax/japan/JapanIncomeTaxServiceImpl.d.ts +10 -0
- package/dist/types/income-tax/japan/domain/types.d.ts +16 -0
- package/dist/types/income-tax/netherlands/NetherlandsIncomeTaxService.d.ts +4 -0
- package/dist/types/income-tax/netherlands/NetherlandsIncomeTaxServiceImpl.d.ts +10 -0
- package/dist/types/income-tax/netherlands/domain/types.d.ts +16 -0
- package/dist/types/income-tax/spain/SpainIncomeTaxService.d.ts +4 -0
- package/dist/types/income-tax/spain/SpainIncomeTaxServiceImpl.d.ts +10 -0
- package/dist/types/income-tax/spain/domain/types.d.ts +16 -0
- package/dist/types/income-tax/switzerland/SwitzerlandIncomeTaxService.d.ts +4 -0
- package/dist/types/income-tax/switzerland/SwitzerlandIncomeTaxServiceImpl.d.ts +10 -0
- package/dist/types/income-tax/switzerland/domain/types.d.ts +16 -0
- package/dist/types/inheritance-tax/index.d.ts +7 -1
- package/dist/types/inheritance-tax/japan/JapanInheritanceTaxService.d.ts +4 -0
- package/dist/types/inheritance-tax/japan/JapanInheritanceTaxServiceImpl.d.ts +9 -0
- package/dist/types/inheritance-tax/japan/domain/types.d.ts +21 -0
- package/dist/types/inheritance-tax/netherlands/NetherlandsInheritanceTaxService.d.ts +4 -0
- package/dist/types/inheritance-tax/netherlands/NetherlandsInheritanceTaxServiceImpl.d.ts +9 -0
- package/dist/types/inheritance-tax/netherlands/domain/types.d.ts +28 -0
- package/dist/types/inheritance-tax/spain/SpainInheritanceTaxService.d.ts +4 -0
- package/dist/types/inheritance-tax/spain/SpainInheritanceTaxServiceImpl.d.ts +9 -0
- package/dist/types/inheritance-tax/spain/domain/types.d.ts +19 -0
- package/dist/types/mortgage/brazil/BrazilMortgageService.d.ts +4 -0
- package/dist/types/mortgage/brazil/BrazilMortgageServiceImpl.d.ts +7 -0
- package/dist/types/mortgage/brazil/domain/types.d.ts +39 -0
- package/dist/types/mortgage/index.d.ts +15 -1
- package/dist/types/mortgage/india/IndiaMortgageService.d.ts +4 -0
- package/dist/types/mortgage/india/IndiaMortgageServiceImpl.d.ts +7 -0
- package/dist/types/mortgage/india/domain/types.d.ts +39 -0
- package/dist/types/mortgage/israel/IsraelMortgageService.d.ts +4 -0
- package/dist/types/mortgage/israel/IsraelMortgageServiceImpl.d.ts +8 -0
- package/dist/types/mortgage/israel/domain/types.d.ts +43 -0
- package/dist/types/mortgage/japan/JapanMortgageService.d.ts +4 -0
- package/dist/types/mortgage/japan/JapanMortgageServiceImpl.d.ts +7 -0
- package/dist/types/mortgage/japan/domain/types.d.ts +39 -0
- package/dist/types/mortgage/netherlands/NetherlandsMortgageService.d.ts +4 -0
- package/dist/types/mortgage/netherlands/NetherlandsMortgageServiceImpl.d.ts +7 -0
- package/dist/types/mortgage/netherlands/domain/types.d.ts +41 -0
- package/dist/types/mortgage/spain/SpainMortgageService.d.ts +4 -0
- package/dist/types/mortgage/spain/SpainMortgageServiceImpl.d.ts +8 -0
- package/dist/types/mortgage/spain/domain/types.d.ts +44 -0
- package/dist/types/mortgage/switzerland/SwitzerlandMortgageService.d.ts +4 -0
- package/dist/types/mortgage/switzerland/SwitzerlandMortgageServiceImpl.d.ts +7 -0
- package/dist/types/mortgage/switzerland/domain/types.d.ts +37 -0
- package/package.json +1 -1
- package/src/capital-gains/brazil/BrazilCapitalGainsService.ts +5 -0
- package/src/capital-gains/brazil/BrazilCapitalGainsServiceImpl.ts +69 -0
- package/src/capital-gains/brazil/domain/types.ts +15 -0
- package/src/capital-gains/index.ts +50 -0
- package/src/capital-gains/india/IndiaCapitalGainsService.ts +5 -0
- package/src/capital-gains/india/IndiaCapitalGainsServiceImpl.ts +64 -0
- package/src/capital-gains/india/domain/types.ts +12 -0
- package/src/capital-gains/israel/IsraelCapitalGainsService.ts +5 -0
- package/src/capital-gains/israel/IsraelCapitalGainsServiceImpl.ts +69 -0
- package/src/capital-gains/israel/domain/types.ts +15 -0
- package/src/capital-gains/japan/JapanCapitalGainsService.ts +5 -0
- package/src/capital-gains/japan/JapanCapitalGainsServiceImpl.ts +47 -0
- package/src/capital-gains/japan/domain/types.ts +9 -0
- package/src/capital-gains/spain/SpainCapitalGainsService.ts +5 -0
- package/src/capital-gains/spain/SpainCapitalGainsServiceImpl.ts +69 -0
- package/src/capital-gains/spain/domain/types.ts +15 -0
- package/src/corporate/brazil/BrazilCorporateTaxService.ts +5 -0
- package/src/corporate/brazil/BrazilCorporateTaxServiceImpl.ts +40 -0
- package/src/corporate/brazil/domain/types.ts +16 -0
- package/src/corporate/index.ts +81 -1
- package/src/corporate/india/IndiaCorporateTaxService.ts +5 -0
- package/src/corporate/india/IndiaCorporateTaxServiceImpl.ts +35 -0
- package/src/corporate/india/domain/types.ts +15 -0
- package/src/corporate/israel/IsraelCorporateTaxService.ts +5 -0
- package/src/corporate/israel/IsraelCorporateTaxServiceImpl.ts +35 -0
- package/src/corporate/israel/domain/types.ts +15 -0
- package/src/corporate/japan/JapanCorporateTaxService.ts +5 -0
- package/src/corporate/japan/JapanCorporateTaxServiceImpl.ts +35 -0
- package/src/corporate/japan/domain/types.ts +15 -0
- package/src/corporate/netherlands/NetherlandsCorporateTaxService.ts +5 -0
- package/src/corporate/netherlands/NetherlandsCorporateTaxServiceImpl.ts +48 -0
- package/src/corporate/netherlands/domain/types.ts +21 -0
- package/src/corporate/spain/SpainCorporateTaxService.ts +5 -0
- package/src/corporate/spain/SpainCorporateTaxServiceImpl.ts +35 -0
- package/src/corporate/spain/domain/types.ts +15 -0
- package/src/corporate/switzerland/SwitzerlandCorporateTaxService.ts +5 -0
- package/src/corporate/switzerland/SwitzerlandCorporateTaxServiceImpl.ts +35 -0
- package/src/corporate/switzerland/domain/types.ts +15 -0
- package/src/income-tax/brazil/BrazilIncomeTaxService.ts +5 -0
- package/src/income-tax/brazil/BrazilIncomeTaxServiceImpl.ts +91 -0
- package/src/income-tax/brazil/domain/types.ts +21 -0
- package/src/income-tax/index.ts +70 -0
- package/src/income-tax/india/IndiaIncomeTaxService.ts +5 -0
- package/src/income-tax/india/IndiaIncomeTaxServiceImpl.ts +87 -0
- package/src/income-tax/india/domain/types.ts +16 -0
- package/src/income-tax/israel/IsraelIncomeTaxService.ts +5 -0
- package/src/income-tax/israel/IsraelIncomeTaxServiceImpl.ts +75 -0
- package/src/income-tax/israel/domain/types.ts +16 -0
- package/src/income-tax/japan/JapanIncomeTaxService.ts +5 -0
- package/src/income-tax/japan/JapanIncomeTaxServiceImpl.ts +87 -0
- package/src/income-tax/japan/domain/types.ts +16 -0
- package/src/income-tax/netherlands/NetherlandsIncomeTaxService.ts +5 -0
- package/src/income-tax/netherlands/NetherlandsIncomeTaxServiceImpl.ts +75 -0
- package/src/income-tax/netherlands/domain/types.ts +16 -0
- package/src/income-tax/spain/SpainIncomeTaxService.ts +5 -0
- package/src/income-tax/spain/SpainIncomeTaxServiceImpl.ts +75 -0
- package/src/income-tax/spain/domain/types.ts +16 -0
- package/src/income-tax/switzerland/SwitzerlandIncomeTaxService.ts +5 -0
- package/src/income-tax/switzerland/SwitzerlandIncomeTaxServiceImpl.ts +75 -0
- package/src/income-tax/switzerland/domain/types.ts +16 -0
- package/src/inheritance-tax/index.ts +36 -0
- package/src/inheritance-tax/japan/JapanInheritanceTaxService.ts +5 -0
- package/src/inheritance-tax/japan/JapanInheritanceTaxServiceImpl.ts +67 -0
- package/src/inheritance-tax/japan/domain/types.ts +25 -0
- package/src/inheritance-tax/netherlands/NetherlandsInheritanceTaxService.ts +5 -0
- package/src/inheritance-tax/netherlands/NetherlandsInheritanceTaxServiceImpl.ts +66 -0
- package/src/inheritance-tax/netherlands/domain/types.ts +34 -0
- package/src/inheritance-tax/spain/SpainInheritanceTaxService.ts +5 -0
- package/src/inheritance-tax/spain/SpainInheritanceTaxServiceImpl.ts +65 -0
- package/src/inheritance-tax/spain/domain/types.ts +23 -0
- package/src/mortgage/brazil/BrazilMortgageService.ts +5 -0
- package/src/mortgage/brazil/BrazilMortgageServiceImpl.ts +101 -0
- package/src/mortgage/brazil/domain/types.ts +46 -0
- package/src/mortgage/index.ts +85 -1
- package/src/mortgage/india/IndiaMortgageService.ts +5 -0
- package/src/mortgage/india/IndiaMortgageServiceImpl.ts +101 -0
- package/src/mortgage/india/domain/types.ts +46 -0
- package/src/mortgage/israel/IsraelMortgageService.ts +5 -0
- package/src/mortgage/israel/IsraelMortgageServiceImpl.ts +132 -0
- package/src/mortgage/israel/domain/types.ts +41 -0
- package/src/mortgage/japan/JapanMortgageService.ts +5 -0
- package/src/mortgage/japan/JapanMortgageServiceImpl.ts +101 -0
- package/src/mortgage/japan/domain/types.ts +46 -0
- package/src/mortgage/netherlands/NetherlandsMortgageService.ts +5 -0
- package/src/mortgage/netherlands/NetherlandsMortgageServiceImpl.ts +109 -0
- package/src/mortgage/netherlands/domain/types.ts +37 -0
- package/src/mortgage/spain/SpainMortgageService.ts +5 -0
- package/src/mortgage/spain/SpainMortgageServiceImpl.ts +130 -0
- package/src/mortgage/spain/domain/types.ts +52 -0
- package/src/mortgage/switzerland/SwitzerlandMortgageService.ts +5 -0
- package/src/mortgage/switzerland/SwitzerlandMortgageServiceImpl.ts +106 -0
- package/src/mortgage/switzerland/domain/types.ts +36 -0
- package/test/brazil-capital-gains.test.ts +65 -0
- package/test/brazil-corporate-tax.test.ts +63 -0
- package/test/brazil-income-tax.test.ts +85 -0
- package/test/brazil-mortgage.test.ts +70 -0
- package/test/india-capital-gains.test.ts +71 -0
- package/test/india-corporate-tax.test.ts +54 -0
- package/test/india-income-tax.test.ts +78 -0
- package/test/india-mortgage.test.ts +70 -0
- package/test/israel-capital-gains.test.ts +45 -0
- package/test/israel-corporate-tax.test.ts +49 -0
- package/test/israel-income-tax.test.ts +76 -0
- package/test/israel-mortgage.test.ts +80 -0
- package/test/japan-capital-gains.test.ts +55 -0
- package/test/japan-corporate-tax.test.ts +54 -0
- package/test/japan-income-tax.test.ts +76 -0
- package/test/japan-inheritance-tax.test.ts +74 -0
- package/test/japan-mortgage.test.ts +69 -0
- package/test/netherlands-corporate-tax.test.ts +54 -0
- package/test/netherlands-income-tax.test.ts +54 -0
- package/test/netherlands-inheritance-tax.test.ts +79 -0
- package/test/netherlands-mortgage.test.ts +79 -0
- package/test/spain-capital-gains.test.ts +66 -0
- package/test/spain-corporate-tax.test.ts +54 -0
- package/test/spain-income-tax.test.ts +84 -0
- package/test/spain-inheritance-tax.test.ts +78 -0
- package/test/spain-mortgage.test.ts +70 -0
- package/test/switzerland-corporate-tax.test.ts +39 -0
- package/test/switzerland-income-tax.test.ts +66 -0
- package/test/switzerland-mortgage.test.ts +70 -0
- package/dist/domain/types.js +0 -10
- package/dist/types/domain/types.d.ts +0 -41
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { OtherFees } from "../../domain/types";
|
|
2
|
+
|
|
3
|
+
export interface MortgageRules {
|
|
4
|
+
loanConstraints: LoanConstraints;
|
|
5
|
+
interest: InterestRules;
|
|
6
|
+
acquisitionTax: AcquisitionTaxRules;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface LoanConstraints {
|
|
10
|
+
maxLtvPercent: number;
|
|
11
|
+
maxAmortizationYears: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface InterestRules {
|
|
15
|
+
compounding: 'MONTHLY';
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface AcquisitionTaxRules {
|
|
19
|
+
rate: number;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface AmortizationScheduleItem {
|
|
23
|
+
year: number;
|
|
24
|
+
principal: number;
|
|
25
|
+
interest: number;
|
|
26
|
+
balance: number;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface MortgageInput {
|
|
30
|
+
propertyPrice: number;
|
|
31
|
+
downPayment: number;
|
|
32
|
+
annualInterestRate: number;
|
|
33
|
+
amortizationYears: number;
|
|
34
|
+
isFirstTimeBuyer: boolean;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface MortgageOutput {
|
|
38
|
+
loanAmount: number;
|
|
39
|
+
totalMortgage: number;
|
|
40
|
+
monthlyPayment: number;
|
|
41
|
+
totalInterestPaid: number;
|
|
42
|
+
totalPaid: number;
|
|
43
|
+
acquisitionTax: number;
|
|
44
|
+
amortizationSchedule: AmortizationScheduleItem[];
|
|
45
|
+
otherFees: OtherFees;
|
|
46
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { NetherlandsMortgageService } from "./NetherlandsMortgageService";
|
|
2
|
+
import { AmortizationScheduleItem, MortgageInput, MortgageOutput, MortgageRules } from "./domain/types";
|
|
3
|
+
|
|
4
|
+
export class NetherlandsMortgageServiceImpl implements NetherlandsMortgageService {
|
|
5
|
+
|
|
6
|
+
public calculate(input: MortgageInput, rules: MortgageRules): MortgageOutput {
|
|
7
|
+
const loanAmount = input.propertyPrice - input.downPayment;
|
|
8
|
+
|
|
9
|
+
if (loanAmount <= 0) {
|
|
10
|
+
throw new Error('Invalid loan amount: down payment must be less than property price');
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const totalPayments = input.amortizationYears * 12;
|
|
14
|
+
const monthlyRate = (input.annualInterestRate / 100) / 12;
|
|
15
|
+
|
|
16
|
+
const monthlyPayment = this.calculatePayment(loanAmount, monthlyRate, totalPayments);
|
|
17
|
+
const totalPaid = monthlyPayment * totalPayments;
|
|
18
|
+
const totalInterestPaid = totalPaid - loanAmount;
|
|
19
|
+
|
|
20
|
+
const transferTaxRate = input.isPrimaryResidence
|
|
21
|
+
? rules.transferTax.primaryResidenceRate
|
|
22
|
+
: rules.transferTax.otherRate;
|
|
23
|
+
const transferTax = input.propertyPrice * transferTaxRate;
|
|
24
|
+
const notaryFees = input.propertyPrice * rules.notaryFeeRate;
|
|
25
|
+
const landRegistryFee = input.propertyPrice * rules.landRegistryFeeRate;
|
|
26
|
+
|
|
27
|
+
const amortizationSchedule = this.calculateAmortizationSchedule(
|
|
28
|
+
loanAmount,
|
|
29
|
+
monthlyRate,
|
|
30
|
+
monthlyPayment,
|
|
31
|
+
totalPayments,
|
|
32
|
+
input.amortizationYears,
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
return {
|
|
36
|
+
loanAmount,
|
|
37
|
+
totalMortgage: loanAmount,
|
|
38
|
+
monthlyPayment,
|
|
39
|
+
totalInterestPaid,
|
|
40
|
+
totalPaid,
|
|
41
|
+
transferTax,
|
|
42
|
+
notaryFees,
|
|
43
|
+
landRegistryFee,
|
|
44
|
+
amortizationSchedule,
|
|
45
|
+
otherFees: {
|
|
46
|
+
notaryFees: {
|
|
47
|
+
value: notaryFees,
|
|
48
|
+
label: 'NOTARY_FEES',
|
|
49
|
+
},
|
|
50
|
+
bankFees: {
|
|
51
|
+
value: landRegistryFee,
|
|
52
|
+
label: 'LAND_REGISTRY_FEE',
|
|
53
|
+
},
|
|
54
|
+
monthlyInsuranceFees: {
|
|
55
|
+
value: 0,
|
|
56
|
+
label: 'MONTHLY_INSURANCE_FEES',
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
private calculateAmortizationSchedule(
|
|
63
|
+
principal: number,
|
|
64
|
+
monthlyRate: number,
|
|
65
|
+
monthlyPayment: number,
|
|
66
|
+
totalPayments: number,
|
|
67
|
+
amortizationYears: number,
|
|
68
|
+
): AmortizationScheduleItem[] {
|
|
69
|
+
const schedule: AmortizationScheduleItem[] = [];
|
|
70
|
+
let balance = principal;
|
|
71
|
+
|
|
72
|
+
for (let year = 1; year <= amortizationYears; year++) {
|
|
73
|
+
let yearlyPrincipal = 0;
|
|
74
|
+
let yearlyInterest = 0;
|
|
75
|
+
|
|
76
|
+
const paymentsInYear = Math.min(12, totalPayments - (year - 1) * 12);
|
|
77
|
+
|
|
78
|
+
for (let payment = 1; payment <= paymentsInYear; payment++) {
|
|
79
|
+
const interestPayment = balance * monthlyRate;
|
|
80
|
+
const principalPayment = monthlyPayment - interestPayment;
|
|
81
|
+
|
|
82
|
+
yearlyInterest += interestPayment;
|
|
83
|
+
yearlyPrincipal += principalPayment;
|
|
84
|
+
balance -= principalPayment;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
schedule.push({
|
|
88
|
+
year,
|
|
89
|
+
principal: yearlyPrincipal,
|
|
90
|
+
interest: yearlyInterest,
|
|
91
|
+
balance: Math.max(0, balance),
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
if (balance <= 0) break;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return schedule;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
private calculatePayment(principal: number, rate: number, periods: number): number {
|
|
101
|
+
if (rate === 0) {
|
|
102
|
+
return principal / periods;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return principal *
|
|
106
|
+
(rate * Math.pow(1 + rate, periods)) /
|
|
107
|
+
(Math.pow(1 + rate, periods) - 1);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { OtherFees } from "../../domain/types";
|
|
2
|
+
|
|
3
|
+
export interface MortgageRules {
|
|
4
|
+
loanConstraints: { maxLtvPercent: number; maxAmortizationYears: number };
|
|
5
|
+
interest: { compounding: 'MONTHLY' };
|
|
6
|
+
transferTax: { primaryResidenceRate: number; otherRate: number };
|
|
7
|
+
notaryFeeRate: number;
|
|
8
|
+
landRegistryFeeRate: number;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface AmortizationScheduleItem {
|
|
12
|
+
year: number;
|
|
13
|
+
principal: number;
|
|
14
|
+
interest: number;
|
|
15
|
+
balance: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface MortgageInput {
|
|
19
|
+
propertyPrice: number;
|
|
20
|
+
downPayment: number;
|
|
21
|
+
annualInterestRate: number;
|
|
22
|
+
amortizationYears: number;
|
|
23
|
+
isPrimaryResidence: boolean;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface MortgageOutput {
|
|
27
|
+
loanAmount: number;
|
|
28
|
+
totalMortgage: number;
|
|
29
|
+
monthlyPayment: number;
|
|
30
|
+
totalInterestPaid: number;
|
|
31
|
+
totalPaid: number;
|
|
32
|
+
transferTax: number;
|
|
33
|
+
notaryFees: number;
|
|
34
|
+
landRegistryFee: number;
|
|
35
|
+
amortizationSchedule: AmortizationScheduleItem[];
|
|
36
|
+
otherFees: OtherFees;
|
|
37
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { SpainMortgageService } from "./SpainMortgageService";
|
|
2
|
+
import { AmortizationScheduleItem, MortgageInput, MortgageOutput, MortgageRules, TransferTaxBracket } from "./domain/types";
|
|
3
|
+
|
|
4
|
+
export class SpainMortgageServiceImpl implements SpainMortgageService {
|
|
5
|
+
|
|
6
|
+
public calculate(input: MortgageInput, rules: MortgageRules): MortgageOutput {
|
|
7
|
+
const loanAmount = input.propertyPrice - input.downPayment;
|
|
8
|
+
|
|
9
|
+
if (loanAmount <= 0) {
|
|
10
|
+
throw new Error('Invalid loan amount: down payment must be less than property price');
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const totalPayments = input.amortizationYears * 12;
|
|
14
|
+
const monthlyRate = (input.annualInterestRate / 100) / 12;
|
|
15
|
+
|
|
16
|
+
const monthlyPayment = this.calculatePayment(loanAmount, monthlyRate, totalPayments);
|
|
17
|
+
const totalPaid = monthlyPayment * totalPayments;
|
|
18
|
+
const totalInterestPaid = totalPaid - loanAmount;
|
|
19
|
+
|
|
20
|
+
const transferTax = this.calculateTransferTax(
|
|
21
|
+
input.propertyPrice,
|
|
22
|
+
rules.transferTax.brackets,
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
const amortizationSchedule = this.calculateAmortizationSchedule(
|
|
26
|
+
loanAmount,
|
|
27
|
+
monthlyRate,
|
|
28
|
+
monthlyPayment,
|
|
29
|
+
totalPayments,
|
|
30
|
+
input.amortizationYears,
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
return {
|
|
34
|
+
loanAmount,
|
|
35
|
+
totalMortgage: loanAmount,
|
|
36
|
+
monthlyPayment,
|
|
37
|
+
totalInterestPaid,
|
|
38
|
+
totalPaid,
|
|
39
|
+
transferTax,
|
|
40
|
+
amortizationSchedule,
|
|
41
|
+
otherFees: {
|
|
42
|
+
notaryFees: {
|
|
43
|
+
value: transferTax,
|
|
44
|
+
label: 'TRANSFER_TAX',
|
|
45
|
+
},
|
|
46
|
+
bankFees: {
|
|
47
|
+
value: 0,
|
|
48
|
+
label: 'BANK_FEES',
|
|
49
|
+
},
|
|
50
|
+
monthlyInsuranceFees: {
|
|
51
|
+
value: 0,
|
|
52
|
+
label: 'MONTHLY_INSURANCE_FEES',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
private calculateTransferTax(
|
|
59
|
+
propertyPrice: number,
|
|
60
|
+
brackets: TransferTaxBracket[],
|
|
61
|
+
): number {
|
|
62
|
+
let tax = 0;
|
|
63
|
+
let previousLimit = 0;
|
|
64
|
+
|
|
65
|
+
for (const bracket of brackets) {
|
|
66
|
+
if (bracket.upTo !== undefined) {
|
|
67
|
+
if (propertyPrice > previousLimit) {
|
|
68
|
+
const taxable = Math.min(propertyPrice, bracket.upTo) - previousLimit;
|
|
69
|
+
tax += taxable * bracket.rate;
|
|
70
|
+
previousLimit = bracket.upTo;
|
|
71
|
+
}
|
|
72
|
+
} else if (bracket.above !== undefined) {
|
|
73
|
+
if (propertyPrice > bracket.above) {
|
|
74
|
+
tax += (propertyPrice - bracket.above) * bracket.rate;
|
|
75
|
+
}
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return tax;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
private calculateAmortizationSchedule(
|
|
84
|
+
principal: number,
|
|
85
|
+
monthlyRate: number,
|
|
86
|
+
monthlyPayment: number,
|
|
87
|
+
totalPayments: number,
|
|
88
|
+
amortizationYears: number,
|
|
89
|
+
): AmortizationScheduleItem[] {
|
|
90
|
+
const schedule: AmortizationScheduleItem[] = [];
|
|
91
|
+
let balance = principal;
|
|
92
|
+
|
|
93
|
+
for (let year = 1; year <= amortizationYears; year++) {
|
|
94
|
+
let yearlyPrincipal = 0;
|
|
95
|
+
let yearlyInterest = 0;
|
|
96
|
+
|
|
97
|
+
const paymentsInYear = Math.min(12, totalPayments - (year - 1) * 12);
|
|
98
|
+
|
|
99
|
+
for (let payment = 1; payment <= paymentsInYear; payment++) {
|
|
100
|
+
const interestPayment = balance * monthlyRate;
|
|
101
|
+
const principalPayment = monthlyPayment - interestPayment;
|
|
102
|
+
|
|
103
|
+
yearlyInterest += interestPayment;
|
|
104
|
+
yearlyPrincipal += principalPayment;
|
|
105
|
+
balance -= principalPayment;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
schedule.push({
|
|
109
|
+
year,
|
|
110
|
+
principal: yearlyPrincipal,
|
|
111
|
+
interest: yearlyInterest,
|
|
112
|
+
balance: Math.max(0, balance),
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
if (balance <= 0) break;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return schedule;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
private calculatePayment(principal: number, rate: number, periods: number): number {
|
|
122
|
+
if (rate === 0) {
|
|
123
|
+
return principal / periods;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return principal *
|
|
127
|
+
(rate * Math.pow(1 + rate, periods)) /
|
|
128
|
+
(Math.pow(1 + rate, periods) - 1);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { OtherFees } from "../../domain/types";
|
|
2
|
+
|
|
3
|
+
export interface MortgageRules {
|
|
4
|
+
loanConstraints: LoanConstraints;
|
|
5
|
+
interest: InterestRules;
|
|
6
|
+
transferTax: TransferTaxRules;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface LoanConstraints {
|
|
10
|
+
maxLtvPercent: number;
|
|
11
|
+
maxAmortizationYears: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface InterestRules {
|
|
15
|
+
compounding: 'MONTHLY';
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface TransferTaxBracket {
|
|
19
|
+
upTo?: number;
|
|
20
|
+
above?: number;
|
|
21
|
+
rate: number;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface TransferTaxRules {
|
|
25
|
+
brackets: TransferTaxBracket[];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface AmortizationScheduleItem {
|
|
29
|
+
year: number;
|
|
30
|
+
principal: number;
|
|
31
|
+
interest: number;
|
|
32
|
+
balance: number;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface MortgageInput {
|
|
36
|
+
propertyPrice: number;
|
|
37
|
+
downPayment: number;
|
|
38
|
+
annualInterestRate: number;
|
|
39
|
+
amortizationYears: number;
|
|
40
|
+
isFirstTimeBuyer: boolean;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface MortgageOutput {
|
|
44
|
+
loanAmount: number;
|
|
45
|
+
totalMortgage: number;
|
|
46
|
+
monthlyPayment: number;
|
|
47
|
+
totalInterestPaid: number;
|
|
48
|
+
totalPaid: number;
|
|
49
|
+
transferTax: number;
|
|
50
|
+
amortizationSchedule: AmortizationScheduleItem[];
|
|
51
|
+
otherFees: OtherFees;
|
|
52
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { SwitzerlandMortgageService } from "./SwitzerlandMortgageService";
|
|
2
|
+
import { AmortizationScheduleItem, MortgageInput, MortgageOutput, MortgageRules } from "./domain/types";
|
|
3
|
+
|
|
4
|
+
export class SwitzerlandMortgageServiceImpl implements SwitzerlandMortgageService {
|
|
5
|
+
|
|
6
|
+
public calculate(input: MortgageInput, rules: MortgageRules): MortgageOutput {
|
|
7
|
+
const loanAmount = input.propertyPrice - input.downPayment;
|
|
8
|
+
|
|
9
|
+
if (loanAmount <= 0) {
|
|
10
|
+
throw new Error('Invalid loan amount: down payment must be less than property price');
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const totalPayments = input.amortizationYears * 12;
|
|
14
|
+
const monthlyRate = (input.annualInterestRate / 100) / 12;
|
|
15
|
+
|
|
16
|
+
const monthlyPayment = this.calculatePayment(loanAmount, monthlyRate, totalPayments);
|
|
17
|
+
const totalPaid = monthlyPayment * totalPayments;
|
|
18
|
+
const totalInterestPaid = totalPaid - loanAmount;
|
|
19
|
+
|
|
20
|
+
const transferTax = input.propertyPrice * rules.transferTaxRate;
|
|
21
|
+
const notaryFees = input.propertyPrice * rules.notaryFeeRate;
|
|
22
|
+
const landRegistryFee = input.propertyPrice * rules.landRegistryFeeRate;
|
|
23
|
+
|
|
24
|
+
const amortizationSchedule = this.calculateAmortizationSchedule(
|
|
25
|
+
loanAmount,
|
|
26
|
+
monthlyRate,
|
|
27
|
+
monthlyPayment,
|
|
28
|
+
totalPayments,
|
|
29
|
+
input.amortizationYears,
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
loanAmount,
|
|
34
|
+
totalMortgage: loanAmount,
|
|
35
|
+
monthlyPayment,
|
|
36
|
+
totalInterestPaid,
|
|
37
|
+
totalPaid,
|
|
38
|
+
transferTax,
|
|
39
|
+
notaryFees,
|
|
40
|
+
landRegistryFee,
|
|
41
|
+
amortizationSchedule,
|
|
42
|
+
otherFees: {
|
|
43
|
+
notaryFees: {
|
|
44
|
+
value: notaryFees,
|
|
45
|
+
label: 'NOTARY_FEES',
|
|
46
|
+
},
|
|
47
|
+
bankFees: {
|
|
48
|
+
value: landRegistryFee,
|
|
49
|
+
label: 'LAND_REGISTRY_FEE',
|
|
50
|
+
},
|
|
51
|
+
monthlyInsuranceFees: {
|
|
52
|
+
value: 0,
|
|
53
|
+
label: 'MONTHLY_INSURANCE_FEES',
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
private calculateAmortizationSchedule(
|
|
60
|
+
principal: number,
|
|
61
|
+
monthlyRate: number,
|
|
62
|
+
monthlyPayment: number,
|
|
63
|
+
totalPayments: number,
|
|
64
|
+
amortizationYears: number,
|
|
65
|
+
): AmortizationScheduleItem[] {
|
|
66
|
+
const schedule: AmortizationScheduleItem[] = [];
|
|
67
|
+
let balance = principal;
|
|
68
|
+
|
|
69
|
+
for (let year = 1; year <= amortizationYears; year++) {
|
|
70
|
+
let yearlyPrincipal = 0;
|
|
71
|
+
let yearlyInterest = 0;
|
|
72
|
+
|
|
73
|
+
const paymentsInYear = Math.min(12, totalPayments - (year - 1) * 12);
|
|
74
|
+
|
|
75
|
+
for (let payment = 1; payment <= paymentsInYear; payment++) {
|
|
76
|
+
const interestPayment = balance * monthlyRate;
|
|
77
|
+
const principalPayment = monthlyPayment - interestPayment;
|
|
78
|
+
|
|
79
|
+
yearlyInterest += interestPayment;
|
|
80
|
+
yearlyPrincipal += principalPayment;
|
|
81
|
+
balance -= principalPayment;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
schedule.push({
|
|
85
|
+
year,
|
|
86
|
+
principal: yearlyPrincipal,
|
|
87
|
+
interest: yearlyInterest,
|
|
88
|
+
balance: Math.max(0, balance),
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
if (balance <= 0) break;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return schedule;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
private calculatePayment(principal: number, rate: number, periods: number): number {
|
|
98
|
+
if (rate === 0) {
|
|
99
|
+
return principal / periods;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return principal *
|
|
103
|
+
(rate * Math.pow(1 + rate, periods)) /
|
|
104
|
+
(Math.pow(1 + rate, periods) - 1);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { OtherFees } from "../../domain/types";
|
|
2
|
+
|
|
3
|
+
export interface MortgageRules {
|
|
4
|
+
loanConstraints: { maxLtvPercent: number; maxAmortizationYears: number };
|
|
5
|
+
interest: { compounding: 'MONTHLY' };
|
|
6
|
+
transferTaxRate: number;
|
|
7
|
+
notaryFeeRate: number;
|
|
8
|
+
landRegistryFeeRate: number;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface AmortizationScheduleItem {
|
|
12
|
+
year: number;
|
|
13
|
+
principal: number;
|
|
14
|
+
interest: number;
|
|
15
|
+
balance: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface MortgageInput {
|
|
19
|
+
propertyPrice: number;
|
|
20
|
+
downPayment: number;
|
|
21
|
+
annualInterestRate: number;
|
|
22
|
+
amortizationYears: number;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface MortgageOutput {
|
|
26
|
+
loanAmount: number;
|
|
27
|
+
totalMortgage: number;
|
|
28
|
+
monthlyPayment: number;
|
|
29
|
+
totalInterestPaid: number;
|
|
30
|
+
totalPaid: number;
|
|
31
|
+
transferTax: number;
|
|
32
|
+
notaryFees: number;
|
|
33
|
+
landRegistryFee: number;
|
|
34
|
+
amortizationSchedule: AmortizationScheduleItem[];
|
|
35
|
+
otherFees: OtherFees;
|
|
36
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { BrazilCapitalGainsServiceImpl } from '../src/capital-gains/brazil/BrazilCapitalGainsServiceImpl';
|
|
2
|
+
import { Input, Rules } from '../src/capital-gains/brazil/domain/types';
|
|
3
|
+
|
|
4
|
+
const brazilRules: Rules = {
|
|
5
|
+
brackets: [
|
|
6
|
+
{ from: 0, to: 5000000, rate: 0.15 },
|
|
7
|
+
{ from: 5000000, to: 10000000, rate: 0.175 },
|
|
8
|
+
{ from: 10000000, to: 30000000, rate: 0.20 },
|
|
9
|
+
{ from: 30000000, to: null, rate: 0.225 },
|
|
10
|
+
],
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
describe('BrazilCapitalGainsServiceImpl', () => {
|
|
14
|
+
it('returns zero tax for zero gain', () => {
|
|
15
|
+
const input: Input = { capitalGain: 0 };
|
|
16
|
+
const service = new BrazilCapitalGainsServiceImpl(input, brazilRules);
|
|
17
|
+
const result = service.calculate();
|
|
18
|
+
|
|
19
|
+
expect(result.taxableGain).toBe(0);
|
|
20
|
+
expect(result.capitalGainTax).toBe(0);
|
|
21
|
+
expect(result.totalTax).toBe(0);
|
|
22
|
+
expect(result.effectiveRate).toBe(0);
|
|
23
|
+
expect(result.breakdowns).toHaveLength(0);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('correctly calculates tax for gain in first bracket', () => {
|
|
27
|
+
const input: Input = { capitalGain: 1000000 };
|
|
28
|
+
const service = new BrazilCapitalGainsServiceImpl(input, brazilRules);
|
|
29
|
+
const result = service.calculate();
|
|
30
|
+
|
|
31
|
+
// 0-1000000: 1000000 * 0.15 = 150000
|
|
32
|
+
expect(result.capitalGainTax).toBe(150000);
|
|
33
|
+
expect(result.totalTax).toBe(150000);
|
|
34
|
+
expect(result.effectiveRate).toBeCloseTo(15, 2);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('correctly calculates tax spanning multiple brackets', () => {
|
|
38
|
+
const input: Input = { capitalGain: 7000000 };
|
|
39
|
+
const service = new BrazilCapitalGainsServiceImpl(input, brazilRules);
|
|
40
|
+
const result = service.calculate();
|
|
41
|
+
|
|
42
|
+
// 0-5000000: 5000000 * 0.15 = 750000
|
|
43
|
+
// 5000000-7000000: 2000000 * 0.175 = 350000
|
|
44
|
+
// Total = 1100000
|
|
45
|
+
expect(result.capitalGainTax).toBeCloseTo(1100000, 2);
|
|
46
|
+
expect(result.totalTax).toBeCloseTo(1100000, 2);
|
|
47
|
+
expect(result.effectiveRate).toBeCloseTo((1100000 / 7000000) * 100, 2);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it('taxable gain equals input capital gain', () => {
|
|
51
|
+
const input: Input = { capitalGain: 3000000 };
|
|
52
|
+
const service = new BrazilCapitalGainsServiceImpl(input, brazilRules);
|
|
53
|
+
const result = service.calculate();
|
|
54
|
+
|
|
55
|
+
expect(result.taxableGain).toBe(3000000);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('returns correct number of breakdown entries', () => {
|
|
59
|
+
const input: Input = { capitalGain: 7000000 };
|
|
60
|
+
const service = new BrazilCapitalGainsServiceImpl(input, brazilRules);
|
|
61
|
+
const result = service.calculate();
|
|
62
|
+
|
|
63
|
+
expect(result.breakdowns).toHaveLength(2);
|
|
64
|
+
});
|
|
65
|
+
});
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { BrazilCorporateTaxServiceImpl } from '../src/corporate/brazil/BrazilCorporateTaxServiceImpl';
|
|
2
|
+
import { Input, Rules } from '../src/corporate/brazil/domain/types';
|
|
3
|
+
|
|
4
|
+
const brazilRules: Rules = {
|
|
5
|
+
irpj: { baseRate: 0.15, surchargeRate: 0.10, surchargeThreshold: 240000 },
|
|
6
|
+
csll: { rate: 0.09 },
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
describe('BrazilCorporateTaxServiceImpl', () => {
|
|
10
|
+
it('returns zero tax for zero income', () => {
|
|
11
|
+
const input: Input = { taxableIncome: 0 };
|
|
12
|
+
const service = new BrazilCorporateTaxServiceImpl(input, brazilRules);
|
|
13
|
+
const result = service.calculate();
|
|
14
|
+
|
|
15
|
+
expect(result.corporateTax).toBe(0);
|
|
16
|
+
expect(result.effectiveTaxRate).toBe(0);
|
|
17
|
+
expect(result.breakdowns).toHaveLength(0);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('correctly calculates tax for income below the surcharge threshold', () => {
|
|
21
|
+
const input: Input = { taxableIncome: 200000 };
|
|
22
|
+
const service = new BrazilCorporateTaxServiceImpl(input, brazilRules);
|
|
23
|
+
const result = service.calculate();
|
|
24
|
+
|
|
25
|
+
// IRPJ base: 200000 * 0.15 = 30000
|
|
26
|
+
// Surcharge: 0 (200000 <= 240000)
|
|
27
|
+
// CSLL: 200000 * 0.09 = 18000
|
|
28
|
+
// Total = 48000
|
|
29
|
+
expect(result.corporateTax).toBeCloseTo(48000, 2);
|
|
30
|
+
expect(result.effectiveTaxRate).toBeCloseTo(24, 2);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('correctly calculates tax for income above the surcharge threshold', () => {
|
|
34
|
+
const input: Input = { taxableIncome: 400000 };
|
|
35
|
+
const service = new BrazilCorporateTaxServiceImpl(input, brazilRules);
|
|
36
|
+
const result = service.calculate();
|
|
37
|
+
|
|
38
|
+
// IRPJ base: 400000 * 0.15 = 60000
|
|
39
|
+
// Surcharge: (400000 - 240000) * 0.10 = 16000
|
|
40
|
+
// CSLL: 400000 * 0.09 = 36000
|
|
41
|
+
// Total = 112000
|
|
42
|
+
expect(result.corporateTax).toBeCloseTo(112000, 2);
|
|
43
|
+
expect(result.effectiveTaxRate).toBeCloseTo(28, 2);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it('returns three breakdown entries when surcharge applies', () => {
|
|
47
|
+
const input: Input = { taxableIncome: 400000 };
|
|
48
|
+
const service = new BrazilCorporateTaxServiceImpl(input, brazilRules);
|
|
49
|
+
const result = service.calculate();
|
|
50
|
+
|
|
51
|
+
expect(result.breakdowns).toHaveLength(3);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('effective tax rate is higher when income exceeds surcharge threshold', () => {
|
|
55
|
+
const inputBelow: Input = { taxableIncome: 200000 };
|
|
56
|
+
const inputAbove: Input = { taxableIncome: 400000 };
|
|
57
|
+
|
|
58
|
+
const rateBelow = new BrazilCorporateTaxServiceImpl(inputBelow, brazilRules).calculate().effectiveTaxRate;
|
|
59
|
+
const rateAbove = new BrazilCorporateTaxServiceImpl(inputAbove, brazilRules).calculate().effectiveTaxRate;
|
|
60
|
+
|
|
61
|
+
expect(rateAbove).toBeGreaterThan(rateBelow);
|
|
62
|
+
});
|
|
63
|
+
});
|