Skip to content

Instantly share code, notes, and snippets.

@diegolirio
Created November 11, 2021 17:21
Show Gist options
  • Select an option

  • Save diegolirio/5c202ea29635e9e1d460e51c4ad3ff2b to your computer and use it in GitHub Desktop.

Select an option

Save diegolirio/5c202ea29635e9e1d460e51c4ad3ff2b to your computer and use it in GitHub Desktop.
class FinTechSave(
private val investmentRepository: InvestmentRepository
) : SectorTech {
override fun sector() = Investment.SectorEnum.FINTECH
override fun saveInvestment(investment: Investment) : Investment {
if (investment.companyValuation >= 10000000 && investment.companyValuation <= 15000000) {
if (investment.startDate!!.isBefore(LocalDate.now().minusYears(1))) {
if (investment.value >= 500000 && investment.value <= 2000000) {
return investmentRepository.save(investment)
}
throw ValueToInvestInvalidException("Value to invest should be between 500 thousand to 2 millions dollars for this valuation")
}
throw OperatingTimeInvalidException("FinTech should be operating for more than 2 years for this Valuation")
}
if (investment.companyValuation > 15000000 && investment.companyValuation <= 40000000) {
if (investment.startDate!!.isBefore(LocalDate.now().minusYears(2))) {
if (investment.value >= 2000000 && investment.value <= 6000000) {
return investmentRepository.save(investment)
}
throw ValueToInvestInvalidException("Value to invest should be between 2 to 6 millions dollars for this valuation")
}
throw OperatingTimeInvalidException("FinTech should be operating for more than 2 years for this Valuation")
}
if (investment.companyValuation > 40000000 && investment.companyValuation <= 60000000) {
if (investment.startDate!!.isBefore(LocalDate.now().minusYears(3))) {
if (investment.value >= 6000000 && investment.value <= 10000000) {
return investmentRepository.save(investment)
}
throw ValueToInvestInvalidException("Value to invest should be between 6 to 10 millions dollars for this valuation")
}
throw OperatingTimeInvalidException("FinTech should be operating for more than 3 years for this Valuation")
}
throw ValuationInvalidException("Valuation Not Allowed for FinTech, valuation should be between 10 to 60 millions dollars")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment