private static void CheckCumpolsorySavingSettings(LoanProduct pPackage) { if (!ServicesHelper.CheckMinMaxAndValueCorrectlyFilled(pPackage.CompulsoryAmountMin, pPackage.CompulsoryAmountMax, pPackage.CompulsoryAmount)) { throw new OpenCbsPackageSaveException(OpenCbsPackageSaveExceptionEnum.CompulsorySavingSettingsEmpty); } }
private static void CheckValueForPackageGracePeriod(LoanProduct pPackage) { if (!ServicesHelper.CheckMinMaxAndValueCorrectlyFilled(pPackage.GracePeriodMin, pPackage.GracePeriodMax, pPackage.GracePeriod)) { throw new OpenCbsPackageSaveException(OpenCbsPackageSaveExceptionEnum.GracePeriodGroupBadlyInformed); } }
private static void CheckValuesForPackageAnticipatedPartialRepaymentPenalties(LoanProduct product) { if (!ServicesHelper.CheckMinMaxAndValueCorrectlyFilled(product.AnticipatedPartialRepaymentPenaltiesMin, product.AnticipatedPartialRepaymentPenaltiesMax, product.AnticipatedPartialRepaymentPenalties)) { throw new OpenCbsPackageSaveException(OpenCbsPackageSaveExceptionEnum.AnticipatedRepaymentPenaltiesBadlyInformed); } }
private static void CheckValueForPackageInterestRate(LoanProduct pPackage) { if (pPackage.UseLoanCycle == false) { if (!ServicesHelper.CheckMinMaxAndValueCorrectlyFilled(pPackage.InterestRateMin, pPackage.InterestRateMax, pPackage.InterestRate)) { throw new OpenCbsPackageSaveException(OpenCbsPackageSaveExceptionEnum.InterestRateGroupBadlyInformed); } } }
private static void CheckValueForPackageAmount(LoanProduct pPackage) { if (pPackage.UseLoanCycle) { return; } if (!ServicesHelper.CheckMinMaxAndValueCorrectlyFilled(pPackage.AmountMin, pPackage.AmountMax, pPackage.Amount)) { throw new OpenCbsPackageSaveException(OpenCbsPackageSaveExceptionEnum.AmountBadlyInformed); } }
private static void CheckValueForPackageEntryFees(LoanProduct pPackage) { if (pPackage.EntryFees == null) { return; } foreach (EntryFee entryFee in pPackage.EntryFees) { if (!ServicesHelper.CheckMinMaxAndValueCorrectlyFilled(entryFee.Min, entryFee.Max, entryFee.Value)) { throw new OpenCbsPackageSaveException(OpenCbsPackageSaveExceptionEnum.EntryFeesBadlyInformed); } } }
private static void CheckValueForLineOfCredit(LoanProduct pPackage) { if ((pPackage.AmountUnderLoc == null && pPackage.AmountUnderLocMin == null && pPackage.AmountUnderLocMax == null) || (pPackage.MaturityLoc == null && pPackage.MaturityLocMin == null && pPackage.MaturityLocMax == null)) { throw new OpenCbsPackageSaveException(OpenCbsPackageSaveExceptionEnum.LOCFieldsAreNotFilled); } if (!ServicesHelper.CheckMinMaxAndValueCorrectlyFilled(pPackage.AmountUnderLocMin, pPackage.AmountUnderLocMax, pPackage.AmountUnderLoc)) { throw new OpenCbsPackageSaveException(OpenCbsPackageSaveExceptionEnum.LOCAmountHaveBeenFilledIncorrectly); } if (!ServicesHelper.CheckMinMaxAndValueCorrectlyFilled(pPackage.MaturityLocMin, pPackage.MaturityLocMax, pPackage.MaturityLoc)) { throw new OpenCbsPackageSaveException(OpenCbsPackageSaveExceptionEnum.LOCMaturityHaveBeenFilledIncorrectly); } }
private static void CheckValueForPackageNonRepaymentPenalties(LoanProduct pPackage) { if (!ServicesHelper.CheckMinMaxAndValueCorrectlyFilled(pPackage.NonRepaymentPenaltiesMin.InitialAmount, pPackage.NonRepaymentPenaltiesMax.InitialAmount, pPackage.NonRepaymentPenalties.InitialAmount)) { throw new OpenCbsPackageSaveException(OpenCbsPackageSaveExceptionEnum.NonRepaymentPenaltiesBadlyInformed); } if (!ServicesHelper.CheckMinMaxAndValueCorrectlyFilled(pPackage.NonRepaymentPenaltiesMin.OLB, pPackage.NonRepaymentPenaltiesMax.OLB, pPackage.NonRepaymentPenalties.OLB)) { throw new OpenCbsPackageSaveException(OpenCbsPackageSaveExceptionEnum.NonRepaymentPenaltiesBadlyInformed); } if (!ServicesHelper.CheckMinMaxAndValueCorrectlyFilled(pPackage.NonRepaymentPenaltiesMin.OverDueInterest, pPackage.NonRepaymentPenaltiesMax.OverDueInterest, pPackage.NonRepaymentPenalties.OverDueInterest)) { throw new OpenCbsPackageSaveException(OpenCbsPackageSaveExceptionEnum.NonRepaymentPenaltiesBadlyInformed); } if (!ServicesHelper.CheckMinMaxAndValueCorrectlyFilled(pPackage.NonRepaymentPenaltiesMin.OverDuePrincipal, pPackage.NonRepaymentPenaltiesMax.OverDuePrincipal, pPackage.NonRepaymentPenalties.OverDuePrincipal)) { throw new OpenCbsPackageSaveException(OpenCbsPackageSaveExceptionEnum.NonRepaymentPenaltiesBadlyInformed); } }
private static void ValidateInterBranchTransferFees(SavingsBookProduct savingsProduct) { Fee fee = savingsProduct.InterBranchTransferFee; if (fee.IsFlat) { if (fee.Value.HasValue && fee.Value < 0) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.InterBranchFlatTransferFeesIsInvalid); } if (!ServicesHelper.CheckMinMaxAndValueCorrectlyFilled(fee.Min, fee.Max, fee.Value)) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.InterBranchFlatTransferFeesMinMaxIsInvalid); } if (!fee.Value.HasValue && fee.Min < 0) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.InterBranchFlatTransferFeesMinIsInvalid); } } else { if (fee.Value.HasValue && fee.Value < 0) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.InterBranchRateTransferFeesIsInvalid); } if (!ServicesHelper.CheckMinMaxAndValueCorrectlyFilled(fee.Min, fee.Max, fee.Value)) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.InterBranchRateTransferFeesMinMaxIsInvalid); } if (!fee.Value.HasValue && fee.Value < 0) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.InterBranchRateTransferFeesMinIsInvalid); } } }
private void CheckValueForPackageNumberOfInstallments(LoanProduct pPackage) { if (pPackage.UseLoanCycle) { return; } if (!ServicesHelper.CheckMinMaxAndValueCorrectlyFilled(pPackage.NbOfInstallmentsMin, pPackage.NbOfInstallmentsMax, pPackage.NbOfInstallments)) { throw new OpenCbsPackageSaveException(OpenCbsPackageSaveExceptionEnum.NumberOfInstallmentBadlyInformed); } if (pPackage.NbOfInstallmentsMin != null) { if (pPackage.NbOfInstallmentsMin > ApplicationSettings.GetInstance(_user != null ? _user.Md5 : "").MaxNumberInstallment) { throw new OpenCbsPackageSaveException(OpenCbsPackageSaveExceptionEnum.NumberOfInstallmentBadlyInformed); } } if (pPackage.NbOfInstallmentsMax != null) { if (pPackage.NbOfInstallmentsMax > ApplicationSettings.GetInstance(_user != null ? _user.Md5 : "").MaxNumberInstallment) { throw new OpenCbsPackageSaveException(OpenCbsPackageSaveExceptionEnum.NumberOfInstallmentBadlyInformed); } } int maxInstallments = ApplicationSettings.GetInstance(_user != null ? _user.Md5 : "").MaxNumberInstallment; if (pPackage.NbOfInstallments != null) { if (pPackage.NbOfInstallments > ApplicationSettings.GetInstance(_user != null ? _user.Md5 : "").MaxNumberInstallment) { throw new OpenCbsPackageSaveException(OpenCbsPackageSaveExceptionEnum.NumberOfInstallmentBadlyInformed); } } }
public bool ValidateProduct(ISavingProduct savingsProduct, int clientTypeCounter) { if (string.IsNullOrEmpty(savingsProduct.Name)) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.NameIsEmpty); } if (string.IsNullOrEmpty(savingsProduct.Code)) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.CodeIsEmpty); } if (savingsProduct.Id == 0 && _savingProductManager.IsThisProductNameAlreadyExist(savingsProduct.Name)) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.DuplicateProductName); } if (savingsProduct.Id == 0 && _savingProductManager.IsThisProductCodeAlreadyExist(savingsProduct.Code)) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.DuplicateProductCode); } if (!ServicesHelper.CheckMinMaxAndValueCorrectlyFilled(savingsProduct.InitialAmountMin, savingsProduct.InitialAmountMax, null)) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.InitialAmountIsInvalid); } if (savingsProduct.InitialAmountMin < 0) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.InitialAmountMinIsInvalid); } if (!ServicesHelper.CheckIfValueBetweenMinAndMax(savingsProduct.BalanceMin, savingsProduct.BalanceMax, savingsProduct.InitialAmountMin)) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.InitialAmountMinNotInBalance); } if (!ServicesHelper.CheckIfValueBetweenMinAndMax(savingsProduct.BalanceMin, savingsProduct.BalanceMax, savingsProduct.InitialAmountMax)) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.InitialAmountMaxNotInBalance); } if (!ServicesHelper.CheckMinMaxAndValueCorrectlyFilled(savingsProduct.BalanceMin, savingsProduct.BalanceMax, null)) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.BalanceIsInvalid); } if (!ServicesHelper.CheckMinMaxAndValueCorrectlyFilled(savingsProduct.InterestRateMin, savingsProduct.InterestRateMax, savingsProduct.InterestRate)) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.InterestRateMinMaxIsInvalid); } if (savingsProduct.InterestRate.HasValue && savingsProduct.InterestRate < 0) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.InterestRateIsInvalid); } if (!savingsProduct.InterestRate.HasValue && savingsProduct.InterestRateMin < 0) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.InterestRateMinIsInvalid); } if (savingsProduct.Currency == null) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.CurrencyIsEmpty); } if (savingsProduct.Currency.Id == 0) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.CurrencyIsEmpty); } if (clientTypeCounter < 1) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.ClientTypeIsInvalid); } if (!ServicesHelper.CheckMinMaxAndValueCorrectlyFilled(savingsProduct.EntryFeesMin, savingsProduct.EntryFeesMax, savingsProduct.EntryFees)) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.EntryFeesMinMaxIsInvalid); } if (savingsProduct.EntryFees.HasValue && savingsProduct.EntryFees.Value < 0) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.EntryFeesIsInvalid); } if (savingsProduct is SavingsBookProduct) { ValidateSavingBookProduct((SavingsBookProduct)savingsProduct); } return(true); }
private static void ValidateSavingBookProduct(SavingsBookProduct savingsProduct) { if (!Enum.IsDefined(typeof(OSavingInterestFrequency), savingsProduct.InterestFrequency.ToString())) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.InterestsFrequencyIsInvalid); } if (!Enum.IsDefined(typeof(OSavingInterestBase), savingsProduct.InterestBase.ToString())) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.InterestsBaseIsInvalid); } if (savingsProduct.InterestBase == OSavingInterestBase.Monthly && (savingsProduct.InterestFrequency != OSavingInterestFrequency.EndOfYear && savingsProduct.InterestFrequency != OSavingInterestFrequency.EndOfMonth)) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.InterestBaseIncompatibleFrequency); } if (savingsProduct.InterestBase == OSavingInterestBase.Weekly && (savingsProduct.InterestFrequency == OSavingInterestFrequency.EndOfDay)) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.InterestBaseIncompatibleFrequency); } if (savingsProduct.InterestBase != OSavingInterestBase.Daily && (!savingsProduct.CalculAmountBase.HasValue)) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.CalculAmountBaseIsNull); } if (!ServicesHelper.CheckMinMaxAndValueCorrectlyFilled(savingsProduct.WithdrawingMin, savingsProduct.WithdrawingMax, null)) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.WithdrawAmountIsInvalid); } //if (!ServicesHelper.CheckMinMaxAndValueCorrectlyFilled(savingsProduct.AMMin, savingsProduct.AMMax, null)) // throw new OpenCbsSavingProductException("Account maintenance fee is invalid"); if (!ServicesHelper.CheckMinMaxAndValueCorrectlyFilled(savingsProduct.DepositMin, savingsProduct.DepositMax, null)) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.DepositAmountIsInvalid); } if (savingsProduct.DepositMin <= 0) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.DepositMinAmountIsInvalid); } if (savingsProduct.ChequeDepositMin <= 0) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.ChequeDepositIsInvalid); } if (savingsProduct.ChequeDepositMin > savingsProduct.ChequeDepositMax) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.ChequeDepositIsInvalid); } if (savingsProduct.WithdrawingMin <= 0) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.WithdrawMinAmountIsInvalid); } //if (savingsProduct.AMMin <= 0) // throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.WithdrawMinAmountIsInvalid); if (!ServicesHelper.CheckMinMaxAndValueCorrectlyFilled(savingsProduct.TransferMin, savingsProduct.TransferMax, null)) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.TransferAmountIsInvalid); } if (savingsProduct.DepositFeesMin < 0) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.DepositFeesMinIsInvalid); } if (savingsProduct.ChequeDepositFeesMin < 0) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.ChequeDepositFeesIsInvalid); } if (!ServicesHelper.CheckMinMaxAndValueCorrectlyFilled(savingsProduct.DepositFeesMin, savingsProduct.DepositFeesMax, savingsProduct.DepositFees)) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.DepositFeesIsInvalid); } if (!ServicesHelper.CheckMinMaxAndValueCorrectlyFilled(savingsProduct.ChequeDepositFeesMin, savingsProduct.ChequeDepositFeesMax, savingsProduct.ChequeDepositFees)) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.ChequeDepositFeesIsInvalid); } if (savingsProduct.ReopenFeesMin < 0) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.ReopenFeesMinIsInvalid); } if (!ServicesHelper.CheckMinMaxAndValueCorrectlyFilled(savingsProduct.ReopenFeesMin, savingsProduct.ReopenFeesMax, savingsProduct.ReopenFees)) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.ReopenFeesIsInvalid); } if (savingsProduct.OverdraftFeesMin < 0) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.OverdraftFeesMinIsInvalid); } if (!ServicesHelper.CheckMinMaxAndValueCorrectlyFilled(savingsProduct.OverdraftFeesMin, savingsProduct.OverdraftFeesMax, savingsProduct.OverdraftFees)) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.OverdraftFeesIsInvalid); } if (savingsProduct.AgioFeesMin < 0) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.AgioFeesMinIsInvalid); } if (!ServicesHelper.CheckMinMaxAndValueCorrectlyFilled(savingsProduct.AgioFeesMin, savingsProduct.AgioFeesMax, savingsProduct.AgioFees)) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.AgioFeesIsInvalid); } if (savingsProduct.CloseFeesMin < 0) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.CloseFeesMinIsInvalid); } if (!ServicesHelper.CheckMinMaxAndValueCorrectlyFilled(savingsProduct.CloseFeesMin, savingsProduct.CloseFeesMax, savingsProduct.CloseFees)) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.CloseFeesIsInvalid); } if (savingsProduct.InstrumentFeesMin < 0) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.InstrumentFeesMinIsInvalid); } if (!ServicesHelper.CheckMinMaxAndValueCorrectlyFilled(savingsProduct.InstrumentFeesMin, savingsProduct.InstrumentFeesMax, savingsProduct.InstrumentFees)) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.InstrumentFeesIsInvalid); } if (savingsProduct.SearchFeesMin < 0) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.SearchFeesMinIsInvalid); } if (!ServicesHelper.CheckMinMaxAndValueCorrectlyFilled(savingsProduct.SearchFeesMin, savingsProduct.SearchFeesMax, savingsProduct.SearchFees)) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.SearchFeesIsInvalid); } if (savingsProduct.DutyStampFeesMin < 0) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.OtherFeesMinIsInvalid); } if (!ServicesHelper.CheckMinMaxAndValueCorrectlyFilled(savingsProduct.DutyStampFeesMin, savingsProduct.DutyStampFeesMax, savingsProduct.DutyStampFees)) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.OtherFeesIsInvalid); } if (savingsProduct.ManagementFeesMin < 0) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.ManagementFeesMinIsInvalid); } if (!ServicesHelper.CheckMinMaxAndValueCorrectlyFilled(savingsProduct.ManagementFeesMin, savingsProduct.ManagementFeesMax, savingsProduct.ManagementFees)) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.ManagementFeesIsInvalid); } if (savingsProduct.TransferMin <= 0) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.TransferAmountMinIsInvalid); } if (!Enum.IsDefined(typeof(OSavingsFeesType), savingsProduct.WithdrawFeesType.ToString())) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.WithdrawFeesTypeEmpty); } if (savingsProduct.WithdrawFeesType == OSavingsFeesType.Flat) { if (savingsProduct.FlatWithdrawFees.HasValue && savingsProduct.FlatWithdrawFees.Value < 0) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.FlatWithdrawFeesIsInvalid); } if (!ServicesHelper.CheckMinMaxAndValueCorrectlyFilled(savingsProduct.FlatWithdrawFeesMin, savingsProduct.FlatWithdrawFeesMax, savingsProduct.FlatWithdrawFees)) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.FlatWithdrawFeesMinMaxIsInvalid); } if (!savingsProduct.FlatWithdrawFees.HasValue && savingsProduct.FlatWithdrawFeesMin.Value < 0) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.FlatWithdrawFeesMinIsInvalid); } } else { if (savingsProduct.RateWithdrawFees.HasValue && savingsProduct.RateWithdrawFees.Value < 0) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.RateWithdrawFeesIsInvalid); } if (!ServicesHelper.CheckMinMaxAndValueCorrectlyFilled(savingsProduct.RateWithdrawFeesMin, savingsProduct.RateWithdrawFeesMax, savingsProduct.RateWithdrawFees)) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.RateWithdrawFeesMinMaxIsInvalid); } if (!savingsProduct.RateWithdrawFees.HasValue && savingsProduct.RateWithdrawFeesMin.Value < 0) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.RateWithdrawFeesMinIsInvalid); } } if (!Enum.IsDefined(typeof(OSavingsFeesType), savingsProduct.TransferFeesType.ToString())) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.TransferFeesTypeEmpty); } if (savingsProduct.TransferFeesType == OSavingsFeesType.Flat) { if (savingsProduct.FlatTransferFees.HasValue && savingsProduct.FlatTransferFees.Value < 0) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.FlatTransferFeesIsInvalid); } if (!ServicesHelper.CheckMinMaxAndValueCorrectlyFilled(savingsProduct.FlatTransferFeesMin, savingsProduct.FlatTransferFeesMax, savingsProduct.FlatTransferFees)) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.FlatTransferFeesMinMaxIsInvalid); } if (!savingsProduct.FlatTransferFees.HasValue && savingsProduct.FlatTransferFeesMin.Value < 0) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.FlatTransferFeesMinIsInvalid); } } else { if (savingsProduct.RateTransferFees.HasValue && savingsProduct.RateTransferFees.Value < 0) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.RateTransferFeesIsInvalid); } if (!ServicesHelper.CheckMinMaxAndValueCorrectlyFilled(savingsProduct.RateTransferFeesMin, savingsProduct.RateTransferFeesMax, savingsProduct.RateTransferFees)) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.RateTransferFeesMinMaxIsInvalid); } if (!savingsProduct.RateTransferFees.HasValue && savingsProduct.RateTransferFeesMin.Value < 0) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.RateTransferFeesMinIsInvalid); } } ValidateInterBranchTransferFees(savingsProduct); if (!savingsProduct.OverdraftFees.HasValue && !(savingsProduct.OverdraftFeesMin.HasValue && savingsProduct.OverdraftFeesMax.HasValue)) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.OverdraftFeesIsInvalid); } if (!savingsProduct.AgioFees.HasValue && !(savingsProduct.AgioFeesMin.HasValue && savingsProduct.AgioFeesMax.HasValue)) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.AgioFeesIsInvalid); } if (savingsProduct.UseTermDeposit) { if (savingsProduct.TermDepositPeriodMin > savingsProduct.TermDepositPeriodMax) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.PostingFrequencyIsInvalid); } if (savingsProduct.TermDepositPeriodMax <= 0 || savingsProduct.TermDepositPeriodMin <= 0) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.PostingFrequencyIsInvalid); } if (savingsProduct.TermDepositPeriodMin == null || savingsProduct.TermDepositPeriodMax == null) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.PostingFrequencyIsInvalid); } if (savingsProduct.Periodicity == null) { throw new OpenCbsSavingProductException(OpenCbsSavingProductExceptionEnum.PeriodicityIsNotSet); } } return; }