本文整理汇总了C#中OpenCBS.CoreDomain.Contracts.Loans.LoanRepayment.CreditContractOptions类的典型用法代码示例。如果您正苦于以下问题:C# CreditContractOptions类的具体用法?C# CreditContractOptions怎么用?C# CreditContractOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CreditContractOptions类属于OpenCBS.CoreDomain.Contracts.Loans.LoanRepayment命名空间,在下文中一共展示了CreditContractOptions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreditContractRepayment
public CreditContractRepayment(Loan contract, CreditContractOptions creditOptions, DateTime pDate,int pInstallmentNumber, User user, ApplicationSettings pGeneralSettings,NonWorkingDateSingleton pNonWorkingDate)
{
_generalSettings = pGeneralSettings;
_nWds = pNonWorkingDate;
_date = pDate.Date;
_installmentNumber = pInstallmentNumber;
PaidIstallments = new List<Installment>();
_amountToRepayTotalyLoan = new CalculateMaximumAmountToRepayStrategy(creditOptions, contract.Copy(), user, _generalSettings,_nWds);
_amountToRegradingLoan = new CalculateMaximumAmountToRegradingLoanStrategy(creditOptions, contract.Copy(), user, _generalSettings, _nWds);
_amountToRepayInstallment = new CalculateAmountToRepaySpecifiedInstallmentStrategy(creditOptions, contract.Copy(), user, _generalSettings, _nWds);
_calculateInstallments = new Repayment.RepayLateInstallments.CalculateInstallments(creditOptions, contract, user, _generalSettings, _nWds);
_calculateRealInterestInstallments = new CalculateRealInterestInstallments(creditOptions, _amountToRepayTotalyLoan, contract, _generalSettings, _nWds);
_feesForAnticipatedRepayment = new CalculateAnticipatedFeesStrategy(creditOptions, contract, _generalSettings);
_repayNextInstallments = new RepayNextInstallmentsStrategy(contract, creditOptions, user, _generalSettings);
_repaymentMethod = new RepaymentMethod(contract,creditOptions);
_loan = contract;
CalculateMaximumAmountAuthorizedToRepay();
CalculateAmountToRegradingLoan();
CalculateMaximumAmountForEscapedMember();
LoanOptions = creditOptions;
}
示例2: DecliningBadLoanWith42dayslateWhenNonRepaymentFeesBaseOnInitialAmountAndKeepNotExpectedInstallment
public void DecliningBadLoanWith42dayslateWhenNonRepaymentFeesBaseOnInitialAmountAndKeepNotExpectedInstallment()
{
LoanProduct package = new LoanProduct
{
InstallmentType = new InstallmentType(1, "Monthly", 0, 1),
LoanType = OLoanTypes.DecliningFixedInstallments,
ChargeInterestWithinGracePeriod = true,
Currency = new Currency { Id = 1, UseCents = true},
RoundingType = ORoundingType.Approximate
};
package.KeepExpectedInstallment = false;
package.AnticipatedTotalRepaymentPenaltiesBase = OAnticipatedRepaymentPenaltiesBases.RemainingOLB;
Loan myContract = new Loan(package, 1000, 0.03m, 6, 1, new DateTime(2006, 1, 1), new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User()));
myContract.BadLoan = true;
myContract.NonRepaymentPenalties.InitialAmount = 0.003;
myContract.AnticipatedTotalRepaymentPenalties = 0.01;
CreditContractOptions cCO = new CreditContractOptions(package.LoanType,package.KeepExpectedInstallment,false,0,0,false,0,package.AnticipatedTotalRepaymentPenaltiesBase);
repayStrategy = new CalculateMaximumAmountToRegradingLoanStrategy(cCO, myContract, new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""));
//30 + 218.35 + 1000 * 0.003 * 42
Assert.AreEqual(374.35m, repayStrategy.CalculateMaximumAmountToRegradingLoan(new DateTime(2006, 3, 15)).Value);
}
示例3: InstallmentType
public void TestCalculateMaximumAmountWithFlateBadLoanWith42dayslateWhenNonRepaymentFeesBaseOnInitialAmountAndKeepNotExpectedInstallment()
{
Assert.Ignore();
ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.CALCULATIONLATEFEESDURINGPUBLICHOLIDAYS, true);
ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.ACCOUNTINGPROCESS, OAccountingProcesses.Accrual);
LoanProduct package = new LoanProduct
{
InstallmentType = new InstallmentType(1, "Monthly", 0, 1),
LoanType = OLoanTypes.Flat,
ChargeInterestWithinGracePeriod = true,
Currency = new Currency { Id = 1 }
};
package.KeepExpectedInstallment = false;
package.AnticipatedTotalRepaymentPenaltiesBase = OAnticipatedRepaymentPenaltiesBases.RemainingOLB;
Loan myContract = new Loan(package, 1000, 0.03m, 6, 1, new DateTime(2006, 1, 1), new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User()));
myContract.BadLoan = true;
myContract.NonRepaymentPenalties.InitialAmount = 0.003;
myContract.AnticipatedTotalRepaymentPenalties = 0.01;
CreditContractOptions cCO = new CreditContractOptions(package.LoanType, package.KeepExpectedInstallment, false, 0, 0, false, 0,
package.AnticipatedTotalRepaymentPenaltiesBase, false, false);
CreditContractRepayment cCR = new CreditContractRepayment(myContract, cCO, new DateTime(2006, 3, 15), 1, new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""));
Assert.AreEqual(1194, Math.Round(cCR.MaximumAmountAuthorizeToRepay.Value, 2));
Assert.AreEqual(386.00m, Math.Round(cCR.MaximumAmountToRegradingLoan.Value, 2));
RepaymentEvent rPE = myContract.Repay(1, new DateTime(2006, 3, 15), 386.00m, false, false);
Assert.AreEqual(0m, rPE.Fees.Value);
Assert.AreEqual(30m, rPE.Interests.Value);
Assert.AreEqual(356m, rPE.Principal.Value);
CreditContractRepayment cCR2 = new CreditContractRepayment(myContract, cCO, new DateTime(2006, 4, 3), 3, new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""));
Assert.AreEqual(932.09, Math.Round(cCR2.MaximumAmountAuthorizeToRepay.Value, 2));
RepaymentEvent rPE2 = myContract.Repay(1, new DateTime(2006, 4, 3), 836, false, false);
Assert.AreEqual(4, rPE2.Fees.Value);
Assert.AreEqual(90, rPE2.Interests.Value);
Assert.AreEqual(742, rPE2.Principal.Value);
ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.ACCOUNTINGPROCESS, OAccountingProcesses.Cash);
}
示例4: CalculateMaximumAmountAuthorizedToRepay
public OCurrency CalculateMaximumAmountAuthorizedToRepay(int pNumber, DateTime pDate,
bool pCancelFees, OCurrency pManualFeesAmount, OCurrency pManualCommissionAmount,
bool pDisableInterests, OCurrency pManualInterests, bool pKeepExpectedInstallment, bool pIsForExoticProduct)
{
Loan fakeLoan = Copy();
if (_generalSettings.AccountingProcesses == OAccountingProcesses.Accrual && !pKeepExpectedInstallment)
{
fakeLoan.CreateLoanInterestAccruingEvent(pDate);
}
CreditContractOptions cCo = new CreditContractOptions(Product.LoanType,
pKeepExpectedInstallment,
pCancelFees,
pManualFeesAmount,
pManualCommissionAmount,
pDisableInterests,
pManualInterests,
Product.AnticipatedTotalRepaymentPenaltiesBase,
pIsForExoticProduct,
false);
CreditContractRepayment cCr = new CreditContractRepayment(fakeLoan,
cCo,
pDate,
pNumber,
_user,
_generalSettings,
_nwdS);
return cCr.MaximumAmountAuthorizeToRepay;
}
示例5: Repay
/// <summary>
/// This method manages all the repayment cases implemented in the software
/// </summary>
/// <param name="pNumber">pNumber of the installment paid</param>
/// <param name="pDate">pDate of the payment</param>
/// <param name="pAmountPaid">amount paid by the client which can be lower, equal or greater than the expected amount for an installment</param>
/// <param name="cancelFees">when true, cancel anticipated payment Commission</param>
/// <param name="manualFeesAmount">manual amount of commission (when anticipated payment commission are cancelled)</param>
/// <returns>A RepaymentEvent or null if :
/// - repayment amount lower than 0
/// - repayment amount greater than olb + interestsToPay + commission
/// - installment already repaid
/// - bad loan and past due days greater than 180
/// </returns>
/// <param name="manualCommissionAmount"></param>
/// <param name="disableInterests"></param>
/// <param name="manualInterests"></param>
/// <param name="keepExpectedInstallment"></param>
/// <param name="payProportion"></param>
/// <param name="paymentMethod"></param>
/// <param name="comment"></param>
/// <param name="pending"></param>
public RepaymentEvent Repay(int pNumber,
DateTime pDate,
OCurrency pAmountPaid,
bool cancelFees,
OCurrency manualFeesAmount,
OCurrency manualCommissionAmount,
bool disableInterests,
OCurrency manualInterests,
bool keepExpectedInstallment,
bool payProportion,
PaymentMethod paymentMethod,
string comment,
bool pending)
{
OCurrency anticipatePayment =
CalculateAnticipateInteresAmountForClosure(pDate, OPaymentType.PartialPayment, payProportion) +
CalculateTotalNonRepaymentPenalties(pDate);
if (anticipatePayment >= pAmountPaid
|| (anticipatePayment == 0 && GetInstallment(pNumber - 1).ExpectedDate <= pDate))
{
keepExpectedInstallment = true;
payProportion = false;
}
var cCo = new CreditContractOptions(Product.LoanType,
keepExpectedInstallment,
cancelFees,
manualFeesAmount,
manualCommissionAmount,
disableInterests,
manualInterests,
Product.AnticipatedTotalRepaymentPenaltiesBase,
Product.IsExotic,
payProportion);
var cCr = new CreditContractRepayment(this, cCo, pDate, pNumber, _user, _generalSettings, _nwdS);
if (AmountComparer.Compare(pAmountPaid, cCr.MaximumAmountAuthorizeToRepay, pNumber) > 0)
{
return null;
}
OCurrency principalEvent = 0;
OCurrency interestEvent = 0;
OCurrency interestPrepayment = 0;
OCurrency penaltiesEvent = 0;
OCurrency commissionsEvent = 0;
OCurrency manualInterestEvent = cCo.ManualInterestsAmount;
int pastDueDays = CalculatePastDueSinceLastRepayment(pDate);
OPaymentType paymentType = OPaymentType.StandardPayment;
foreach (Installment installment in InstallmentList)
{
if (!installment.IsRepaid && installment.Number == pNumber && !keepExpectedInstallment)
{
paymentType = OPaymentType.PartialPayment;
}
}
//we have total repayment for a person
if(EscapedMember != null)
{
paymentType = OPaymentType.PartialPayment;
keepExpectedInstallment = false;
cCo.KeepExpectedInstallments = false;
}
if (AmountComparer.Compare(pAmountPaid, cCr.MaximumAmountAuthorizeToRepay, pNumber) == 0 && !keepExpectedInstallment)
{
paymentType = OPaymentType.TotalPayment;
}
if (payProportion && _product.LoanType == OLoanTypes.DecliningFixedPrincipal)
{
paymentType = OPaymentType.ProportionalPayment;
//.........这里部分代码省略.........
示例6: _SetRepaymentOptions
private static OpenCBS.CoreDomain.Contracts.Loans.LoanRepayment.Repayment.RepayLateInstallments.CalculateInstallments _SetRepaymentOptions(Loan pContract, bool pCancelFees, OCurrency pManualFeesAmount, OCurrency pManualCommissionAmount, bool pCancelInterest, OCurrency pManualInterestAmount)
{
var cCO = new CreditContractOptions(pContract.Product.LoanType, pContract.Product.KeepExpectedInstallment, pCancelFees, pManualFeesAmount, pManualCommissionAmount,
pCancelInterest, pManualInterestAmount, pContract.Product.AnticipatedTotalRepaymentPenaltiesBase);
return new OpenCBS.CoreDomain.Contracts.Loans.LoanRepayment.Repayment.RepayLateInstallments.CalculateInstallments(cCO, pContract, new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""));
}
示例7: TestRepayFlatLoanWhenCalculateFeesWithDelta2
public void TestRepayFlatLoanWhenCalculateFeesWithDelta2()
{
ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.CALCULATIONLATEFEESDURINGPUBLICHOLIDAYS, true);
LoanProduct package = new LoanProduct
{
InstallmentType = new InstallmentType(1, "Monthly", 0, 1),
LoanType = OLoanTypes.DecliningFixedInstallments,
ChargeInterestWithinGracePeriod = true,
Currency = new Currency {Id = 1},
KeepExpectedInstallment = false
};
Loan myContract = new Loan(package, 600, 0.03m, 6, 0, new DateTime(2006, 1, 4), new User(),
ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""),
ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User()))
{
BadLoan = false,
NonRepaymentPenalties = {OverDueInterest = 0.02, OverDuePrincipal = 0.02},
AnticipatedTotalRepaymentPenalties = 0
};
Assert.AreEqual(new DateTime(2006, 2, 6), myContract.GetInstallment(0).ExpectedDate);
RepaymentEvent rPE = myContract.Repay(1, new DateTime(2006, 3, 6), 50, false, false);
Assert.AreEqual(50m, rPE.Fees.Value);
Assert.AreEqual(0m, rPE.Interests.Value);
Assert.AreEqual(0m, rPE.Principal.Value);
CreditContractOptions cCO = new CreditContractOptions(package.LoanType,
package.KeepExpectedInstallment,
false,
0, 0,
false,
0,
package.AnticipatedTotalRepaymentPenaltiesBase);
CreditContractRepayment cCR = new CreditContractRepayment(myContract, cCO, new DateTime(2006, 4, 4), 1, new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""));
Assert.AreEqual(414m, cCR.MaximumAmountToRegradingLoan.Value);
}
示例8: _SetRepaymentOptions
private static CreditContractRepayment _SetRepaymentOptions(Loan pContract, DateTime pDate, int pInstallmentNumber, bool pCancelFees, OCurrency pManualFeesAmount, OCurrency pManualCommissionAmount, bool pCancelInterest, OCurrency pManualInterestAmount)
{
CreditContractOptions cCO = new CreditContractOptions(pContract.Product.LoanType, pContract.Product.KeepExpectedInstallment,
pCancelFees, pManualFeesAmount, pManualCommissionAmount,
pCancelInterest, pManualInterestAmount, pContract.Product.AnticipatedTotalRepaymentPenaltiesBase);
return new CreditContractRepayment(pContract, cCO, pDate, pInstallmentNumber, new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""));
}
示例9: FlateBadLoanWith42dayslateWhenNonRepaymentFeesBaseOnOverDueWithInterestAndKeepNotExpectedInstallment
public void FlateBadLoanWith42dayslateWhenNonRepaymentFeesBaseOnOverDueWithInterestAndKeepNotExpectedInstallment()
{
LoanProduct package = new LoanProduct
{
InstallmentType = new InstallmentType(1, "Monthly", 0, 1),
LoanType = OLoanTypes.Flat,
ChargeInterestWithinGracePeriod = true,
Currency = new Currency { Id = 1, UseCents = true }
};
package.KeepExpectedInstallment = false;
package.AnticipatedTotalRepaymentPenaltiesBase = OAnticipatedRepaymentPenaltiesBases.RemainingOLB;
Loan myContract = new Loan(package, 1000, 0.03m, 6, 1, new DateTime(2006, 1, 1), new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User()));
myContract.BadLoan = true;
myContract.NonRepaymentPenalties.OverDueInterest = 0.003;
myContract.NonRepaymentPenalties.OverDuePrincipal = 0.003;
myContract.AnticipatedTotalRepaymentPenalties = 0.01;
ApplicationSettings.GetInstance("").UpdateParameter("CALCULATION_LATE_FEES_DURING_PUBLIC_HOLIDAYS", true);
CreditContractOptions cCO = new CreditContractOptions(package.LoanType,package.KeepExpectedInstallment,false, 0, 0, false,0,package.AnticipatedTotalRepaymentPenaltiesBase);
repayStrategy = new CalculateMaximumAmountToRegradingLoanStrategy(cCO, myContract, new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""));
//30 + 230 + 30 * 0.003 * 42 + 230 * 0.003 *14
Assert.AreEqual(273.44m, Math.Round(repayStrategy.CalculateMaximumAmountToRegradingLoan(new DateTime(2006, 3, 15)).Value, 2));
//NOT CALCULATION_LATE_FEES_DURING_PUBLIC_HOLIDAYS
ApplicationSettings.GetInstance("").UpdateParameter("CALCULATION_LATE_FEES_DURING_PUBLIC_HOLIDAYS", false);
//30 + 230 + 30 * 0.003 * 36 + 230 * 0.003 *12
Assert.AreEqual(270.74m, repayStrategy.CalculateMaximumAmountToRegradingLoan(new DateTime(2006, 3, 15)).Value);
}
示例10: Flate_BadLoan_42dayslate_OnOLB_KeepNotExpectedInstallment
public void Flate_BadLoan_42dayslate_OnOLB_KeepNotExpectedInstallment()
{
LoanProduct package = new LoanProduct
{
InstallmentType = new InstallmentType(1, "Monthly", 0, 1),
LoanType = OLoanTypes.Flat,
ChargeInterestWithinGracePeriod = true,
Currency = new Currency { Id = 1 }
};
package.KeepExpectedInstallment = false;
package.AnticipatedTotalRepaymentPenaltiesBase = OAnticipatedRepaymentPenaltiesBases.RemainingOLB;
Loan myContract = new Loan(package, 1000, 0.03m, 6, 1, new DateTime(2006, 1, 1), new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User()));
myContract.BadLoan = true;
myContract.NonRepaymentPenalties.OLB = 0.003;
myContract.AnticipatedTotalRepaymentPenalties = 0.01;
CreditContractOptions cCO = new CreditContractOptions(package.LoanType,package.KeepExpectedInstallment,false,0,0,false,0,package.AnticipatedTotalRepaymentPenaltiesBase);
repayStrategy = new CalculateMaximumAmountToRegradingLoanStrategy(cCO, myContract, new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""));
//30 + 230 + 1000 * 0.003 * 42 = 386
Assert.AreEqual(386, Math.Round(repayStrategy.CalculateMaximumAmountToRegradingLoan(new DateTime(2006, 3, 15)).Value, 2));
}
示例11: InstallmentType
public void TestCalculateMaximumAmountWithFlateBadLoanWith42dayslateWhenNonRepaymentFeesBaseOnOverDueWithoutInterestAndKeepExpectedInstallment()
{
LoanProduct package = new LoanProduct
{
InstallmentType = new InstallmentType(1, "Monthly", 0, 1),
LoanType = OLoanTypes.Flat,
ChargeInterestWithinGracePeriod = true,
Currency = new Currency { Id = 1 }
};
package.KeepExpectedInstallment = true;
package.AnticipatedTotalRepaymentPenaltiesBase = OAnticipatedRepaymentPenaltiesBases.RemainingOLB;
Loan myContract = new Loan(package, 1000, 0.03m, 6, 1, new DateTime(2006, 1, 1), new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User()));
myContract.BadLoan = true;
myContract.NonRepaymentPenalties.OverDuePrincipal = 0.003;
myContract.AnticipatedTotalRepaymentPenalties = 0.01;
CreditContractOptions cCO = new CreditContractOptions(package.LoanType, package.KeepExpectedInstallment, false, 0, 0, false, 0, package.AnticipatedTotalRepaymentPenaltiesBase);
this.repayStrategy = new CalculateMaximumAmountToRegradingLoanStrategy(cCO, myContract, new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""));
ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.CALCULATIONLATEFEESDURINGPUBLICHOLIDAYS, false);
//30 + 230 + 200 * 0.003 * 12 = 268.4 => 267
// Assert.AreEqual(267, Math.Round(this.repayStrategy.CalculateMaximumAmountToRegradingLoan(new DateTime(2006, 3, 15)).Value, 2));
Assert.AreEqual(267, Math.Round(this.repayStrategy.CalculateMaximumAmountToRegradingLoan(new DateTime(2006, 3, 15)).Value, 0));
ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.CALCULATIONLATEFEESDURINGPUBLICHOLIDAYS, true);
//30 + 230 + 200 * 0.003 * 14 = 268.4 => 268
Assert.AreEqual(268, Math.Round(this.repayStrategy.CalculateMaximumAmountToRegradingLoan(new DateTime(2006, 3, 15)).Value, 2));
}
示例12: InstallmentType
public void DecliningBadLoanWith42dayslateWhenNonRepaymentFeesBaseOnOverDueWithoutInterestAndKeepExpectedInstallment2()
{
ApplicationSettings.GetInstance("").UpdateParameter("CALCULATION_LATE_FEES_DURING_PUBLIC_HOLIDAYS", true);
LoanProduct package = new LoanProduct
{
InstallmentType = new InstallmentType(1, "Monthly", 0, 1),
LoanType = OLoanTypes.DecliningFixedInstallments,
ChargeInterestWithinGracePeriod = true,
Currency = new Currency { Id = 1, UseCents = true},
RoundingType = ORoundingType.Approximate
};
package.KeepExpectedInstallment = true;
package.AnticipatedTotalRepaymentPenaltiesBase = OAnticipatedRepaymentPenaltiesBases.RemainingOLB;
Loan myContract = new Loan(package, 1000, 0.03m, 6, 1, new DateTime(2006, 1, 1), new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User()));
myContract.BadLoan = true;
myContract.NonRepaymentPenalties.OverDuePrincipal = 0.003;
myContract.AnticipatedTotalRepaymentPenalties = 0.01;
CreditContractOptions cCO = new CreditContractOptions(package.LoanType, package.KeepExpectedInstallment, false, 0, 0, false, 0, package.AnticipatedTotalRepaymentPenaltiesBase);
repayStrategy = new CalculateMaximumAmountToRegradingLoanStrategy(cCO, myContract, new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""));
Assert.AreEqual(256.26m, repayStrategy.CalculateMaximumAmountToRegradingLoan(new DateTime(2006, 3, 15)).Value);
//30 + 218.35 + 188.35 * 1.003 * 14
//30+218.3546
ApplicationSettings.GetInstance("").UpdateParameter("CALCULATION_LATE_FEES_DURING_PUBLIC_HOLIDAYS", false);
cCO = new CreditContractOptions(package.LoanType, package.KeepExpectedInstallment, false, 0, 0, false, 0, package.AnticipatedTotalRepaymentPenaltiesBase);
repayStrategy = new CalculateMaximumAmountToRegradingLoanStrategy(cCO, myContract, new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""));
Assert.AreEqual(254.57m, repayStrategy.CalculateMaximumAmountToRegradingLoan(new DateTime(2006, 3, 15)).Value);
}
示例13: CalculateAmountToRepaySpecifiedInstallment
public OCurrency CalculateAmountToRepaySpecifiedInstallment(int pNumber, DateTime pDate,
bool pCancelFees, OCurrency pManualFeesAmount, OCurrency pManualCommissionAmount,
bool pDisableInterests, OCurrency pManualInterests, bool pKeepExpectedInstallment)
{
CreditContractOptions cCo =
new CreditContractOptions(Product.LoanType, pKeepExpectedInstallment,
pCancelFees, pManualFeesAmount, pManualCommissionAmount,
pDisableInterests, pManualInterests, Product.AnticipatedTotalRepaymentPenaltiesBase);
CreditContractRepayment cCr = new CreditContractRepayment(this, cCo, pDate, pNumber, _user, _generalSettings, _nwdS);
return cCr.AmountToRepayInstallment;
}
示例14: TestRepayDecliningLoanWhenKeepExpectedInstallmentButEntirlyPaidButNoCancelFees
public void TestRepayDecliningLoanWhenKeepExpectedInstallmentButEntirlyPaidButNoCancelFees()
{
ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.CALCULATIONLATEFEESDURINGPUBLICHOLIDAYS, true);
LoanProduct package = new LoanProduct
{
InstallmentType = new InstallmentType(1, "Monthly", 0, 1),
LoanType = OLoanTypes.DecliningFixedInstallments,
ChargeInterestWithinGracePeriod = true,
KeepExpectedInstallment = true,
Currency = new Currency { Id = 1, UseCents = true}
};
Loan myContract = new Loan(package, 1000, 0.03m, 7, 1, new DateTime(2006, 1, 1), new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User()))
{
AnticipatedTotalRepaymentPenalties = 0.003,
NonRepaymentPenalties = { InitialAmount = 0.003 }
};
myContract.Repay(1, new DateTime(2006, 2, 1), 30, true, false);
CreditContractOptions cCO = new CreditContractOptions(package.LoanType, package.KeepExpectedInstallment, false, 0, 0, false, 0, package.AnticipatedTotalRepaymentPenaltiesBase);
CreditContractRepayment cCR = new CreditContractRepayment(myContract, cCO, new DateTime(2006, 3, 1), 1, new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""));
Assert.AreEqual(1107.58m, cCR.MaximumAmountAuthorizeToRepay.Value);
RepaymentEvent repayEvent = myContract.Repay(2, new DateTime(2006, 3, 1), 1107.58m, false, true);
Assert.AreEqual(0m, repayEvent.Fees.Value);
Assert.AreEqual(107.58m, repayEvent.Interests.Value);
Assert.AreEqual(1000m, repayEvent.Principal.Value);
Assert.AreEqual(30m, myContract.GetInstallment(0).InterestsRepayment.Value);
Assert.AreEqual(0m, myContract.GetInstallment(0).CapitalRepayment.Value);
Assert.AreEqual(1000m, myContract.GetInstallment(0).OLB.Value);
Assert.AreEqual(0m, myContract.GetInstallment(0).PaidCapital.Value);
Assert.AreEqual(30m, myContract.GetInstallment(0).PaidInterests.Value);
Assert.AreEqual(30m, myContract.GetInstallment(1).InterestsRepayment.Value);
Assert.AreEqual(154.60m, myContract.GetInstallment(1).CapitalRepayment.Value);
Assert.AreEqual(1000m, myContract.GetInstallment(1).OLB.Value);
Assert.AreEqual(154.60m, myContract.GetInstallment(1).PaidCapital.Value);
Assert.AreEqual(30m, myContract.GetInstallment(1).PaidInterests.Value);
Assert.AreEqual(25.36m, myContract.GetInstallment(2).InterestsRepayment.Value);
Assert.AreEqual(159.24m, myContract.GetInstallment(2).CapitalRepayment.Value);
Assert.AreEqual(845.40m, myContract.GetInstallment(2).OLB.Value);
Assert.AreEqual(159.24m, myContract.GetInstallment(2).PaidCapital.Value);
Assert.AreEqual(25.36m, myContract.GetInstallment(2).PaidInterests.Value);
Assert.AreEqual(20.58m, myContract.GetInstallment(3).InterestsRepayment.Value);
Assert.AreEqual(164.02m, myContract.GetInstallment(3).CapitalRepayment.Value);
Assert.AreEqual(686.16m, myContract.GetInstallment(3).OLB.Value);
Assert.AreEqual(164.02m, myContract.GetInstallment(3).PaidCapital.Value);
Assert.AreEqual(20.58m, myContract.GetInstallment(3).PaidInterests.Value);
Assert.AreEqual(15.66m, myContract.GetInstallment(4).InterestsRepayment.Value);
Assert.AreEqual(168.93m, myContract.GetInstallment(4).CapitalRepayment.Value);
Assert.AreEqual(522.14m, myContract.GetInstallment(4).OLB.Value);
Assert.AreEqual(168.93m, myContract.GetInstallment(4).PaidCapital.Value);
Assert.AreEqual(15.66m, myContract.GetInstallment(4).PaidInterests.Value);
Assert.AreEqual(10.60m, myContract.GetInstallment(5).InterestsRepayment.Value);
Assert.AreEqual(173.99m, myContract.GetInstallment(5).CapitalRepayment.Value);
Assert.AreEqual(353.21m, myContract.GetInstallment(5).OLB.Value);
Assert.AreEqual(173.99m, myContract.GetInstallment(5).PaidCapital.Value);
Assert.AreEqual(10.60m, myContract.GetInstallment(5).PaidInterests.Value);
Assert.AreEqual(5.38m, myContract.GetInstallment(6).InterestsRepayment.Value);
Assert.AreEqual(179.22m, myContract.GetInstallment(6).CapitalRepayment.Value);
Assert.AreEqual(179.22m, myContract.GetInstallment(6).OLB.Value);
Assert.AreEqual(179.22m, myContract.GetInstallment(6).PaidCapital.Value);
Assert.AreEqual(5.38m, myContract.GetInstallment(6).PaidInterests.Value);
}
示例15: _Flate_BadLoan_42dayslate_BasedOnOverDueWithoutInterest_KeepExpectedInstallment
public void _Flate_BadLoan_42dayslate_BasedOnOverDueWithoutInterest_KeepExpectedInstallment()
{
ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.CALCULATIONLATEFEESDURINGPUBLICHOLIDAYS, true);
LoanProduct package = new LoanProduct
{
InstallmentType = new InstallmentType(1, "Monthly", 0, 1),
LoanType = OLoanTypes.Flat,
ChargeInterestWithinGracePeriod = true,
Currency = new Currency {Id = 1, UseCents = true},
KeepExpectedInstallment = true,
AnticipatedTotalRepaymentPenaltiesBase =
OAnticipatedRepaymentPenaltiesBases.RemainingOLB
};
Loan myContract = new Loan(package, 1000, 0.03m, 6, 1, new DateTime(2006, 1, 1), new User(),
ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""),
ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User()))
{
BadLoan = true,
NonRepaymentPenalties = {OverDuePrincipal = 0.003},
AnticipatedTotalRepaymentPenalties = 0.01
};
CreditContractOptions cCO = new CreditContractOptions(package.LoanType,package.KeepExpectedInstallment,false, 0, 0, false, 0, package.AnticipatedTotalRepaymentPenaltiesBase);
repayStrategy = new CalculateMaximumAmountToRegradingLoanStrategy(cCO, myContract, new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""));
//30 + 230 + 200 * 0.003 * 14
Assert.AreEqual(268.4m, Math.Round(repayStrategy.CalculateMaximumAmountToRegradingLoan(new DateTime(2006, 3, 15)).Value, 2));
//NOT CALCULATION_LATE_FEES_DURING_PUBLIC_HOLIDAYS
ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.CALCULATIONLATEFEESDURINGPUBLICHOLIDAYS, false);
//30 + 230 + 200 * 0.003 * 12
Assert.AreEqual(266.60m, repayStrategy.CalculateMaximumAmountToRegradingLoan(new DateTime(2006, 3, 15)).Value);
}