use of java.util.Calendar in project head by mifos.
the class SavingsBOIntegrationTest method createObjectToCheckForTotalInstallmentDue.
private void createObjectToCheckForTotalInstallmentDue(final SavingsType savingsType) throws Exception {
createInitialObjects();
savingsOffering = helper.createSavingsOffering("prd1df", InterestCalcType.MINIMUM_BALANCE, savingsType);
savings = helper.createSavingsAccount(savingsOffering, group, AccountState.SAVINGS_PENDING_APPROVAL, userContext);
Calendar cal1 = Calendar.getInstance();
Calendar cal2 = Calendar.getInstance();
cal2.setLenient(true);
cal2.set(Calendar.DAY_OF_MONTH, cal1.get(Calendar.DAY_OF_MONTH) - 1);
Date paymentDate = helper.getDate("09/05/2006");
Money recommendedAmnt = new Money(currency, "500.0");
AccountActionDateEntity actionDate1 = helper.createAccountActionDate(savings, Short.valueOf("1"), cal2.getTime(), paymentDate, savings.getCustomer(), recommendedAmnt, new Money(getCurrency()), PaymentStatus.UNPAID);
AccountActionDateEntity actionDate2 = helper.createAccountActionDate(savings, Short.valueOf("2"), new Date(), paymentDate, savings.getCustomer(), recommendedAmnt, new Money(getCurrency()), PaymentStatus.UNPAID);
AccountTestUtils.addAccountActionDate(actionDate1, savings);
AccountTestUtils.addAccountActionDate(actionDate2, savings);
savings.update();
}
use of java.util.Calendar in project head by mifos.
the class ViewOriginalLoanScheduleTest method verifyForVariableInstallmentLoanEarlyDisbursal.
// http://mifosforge.jira.com/browse/MIFOSTEST-1163
//blocked by http://mifosforge.jira.com/browse/MIFOS-5026 - ldomzalski
@Test(enabled = false)
// one of the dependent methods throws Exception
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public void verifyForVariableInstallmentLoanEarlyDisbursal() throws Exception {
//Given
int interestType = DefineNewLoanProductPage.SubmitFormParameters.DECLINING_BALANCE;
DateTime disbursalDate = systemDateTime.plusDays(1);
applicationDatabaseOperation.updateLSIM(1);
DefineNewLoanProductPage.SubmitFormParameters formParameters = defineLoanProductParameters(interestType);
CreateLoanAccountSubmitParameters accountSubmitParameters = new CreateLoanAccountSubmitParameters();
accountSubmitParameters.setAmount("1000.0");
accountSubmitParameters.setInterestRate("20");
accountSubmitParameters.setNumberOfInstallments("5");
accountSubmitParameters.setDd("11");
accountSubmitParameters.setMm("10");
accountSubmitParameters.setYy("2011");
String[] fees = { "fixedFeePerAmountAndInterest", "fixedFeePerInterest" };
EditLoanAccountInformationParameters editAccountParameters = new EditLoanAccountInformationParameters();
editAccountParameters.setGracePeriod("0");
formParameters.addFee("fixedFeePerAmountAndInterest");
formParameters.addFee("fixedFeePerInterest");
//When
DefineNewLoanProductPage defineNewLoanProductPage = loanProductTestHelper.navigateToDefineNewLoanPageAndFillMandatoryFields(formParameters).fillVariableInstalmentOption("30", "1", "100");
defineNewLoanProductPage.submitWithErrors("fee cannot be applied to variable installment loan product");
defineNewLoanProductPage.setInterestRateType(DefineNewLoanProductPage.SubmitFormParameters.DECLINING_BALANCE_INTEREST_RECALCULATION);
defineNewLoanProductPage.submitWithErrors("The selected interest type is invalid for variable installment loan product");
defineNewLoanProductPage.setInterestRateType(interestType);
defineNewLoanProductPage.submitAndGotoNewLoanProductPreviewPage().submit();
List<String> errors = new ArrayList<String>();
errors.add("fixedFeePerAmountAndInterest fee cannot be applied to loan with variable installments");
errors.add("fixedFeePerInterest fee cannot be applied to loan with variable installments.");
navigationHelper.navigateToHomePage();
CreateLoanAccountReviewInstallmentPage createLoanAccountReviewInstallmentPage = loanTestHelper.navigateToCreateLoanAccountEntryPageWithoutLogout(setLoanSearchParameters()).setDisbursalDate(disbursalDate).applyAdditionalFees(fees).submitWithErrors(errors).unselectAdditionalFees().clickContinue();
createLoanAccountReviewInstallmentPage.isDueDatesEditable(Integer.parseInt(formParameters.getDefInstallments()));
createLoanAccountReviewInstallmentPage.isTotalsEditable(Integer.parseInt(formParameters.getDefInstallments()));
String total = createLoanAccountReviewInstallmentPage.getTotalForInstallment(1);
createLoanAccountReviewInstallmentPage.setTotalForInstallment(1, "3");
createLoanAccountReviewInstallmentPage.submitWithErrors("has total amount less than the sum of interest and fees");
createLoanAccountReviewInstallmentPage.setTotalForInstallment(1, "5");
createLoanAccountReviewInstallmentPage.submitWithErrors("has total amount less than the allowed value");
createLoanAccountReviewInstallmentPage.setTotalForInstallment(1, total);
createLoanAccountReviewInstallmentPage.validate();
Calendar calendar = Calendar.getInstance();
calendar.set(2011, 9, 13);
String prevDueDate = createLoanAccountReviewInstallmentPage.getDueDateForInstallment(1);
createLoanAccountReviewInstallmentPage.typeInstallmentDueDateByPicker(1, calendar);
createLoanAccountReviewInstallmentPage.setDueDateForInstallment(1, prevDueDate);
prevDueDate = createLoanAccountReviewInstallmentPage.getDueDateForInstallment(5);
createLoanAccountReviewInstallmentPage.setDueDateForInstallment(5, "07/11/11");
createLoanAccountReviewInstallmentPage.submitWithErrors("Gap between the due dates of installment 5 and the previous installment is less than allowed");
createLoanAccountReviewInstallmentPage.setDueDateForInstallment(5, prevDueDate);
List<String> totals = createLoanAccountReviewInstallmentPage.getTotalsInstallments(Integer.parseInt(formParameters.getDefInstallments()));
List<String> dueDates = createLoanAccountReviewInstallmentPage.getDueDatesInstallments(Integer.parseInt(formParameters.getDefInstallments()));
CreateLoanAccountPreviewPage createLoanAccountPreviewPage = createLoanAccountReviewInstallmentPage.clickPreviewAndGoToReviewLoanAccountPage();
createLoanAccountPreviewPage.verifyInstallmentsSchedule(totals, dueDates, Integer.parseInt(formParameters.getDefInstallments()));
LoanAccountPage loanAccountPage = createLoanAccountPreviewPage.submit().navigateToLoanAccountDetailsPage();
loanAccountPage.verifyDisbursalDate(disbursalDate);
ViewRepaymentSchedulePage viewRepaymentSchedulePage = loanAccountPage.navigateToRepaymentSchedulePage();
viewRepaymentSchedulePage.verifyScheduleAndAmounts(totals, dueDates);
viewRepaymentSchedulePage.navigateBack();
EditLoanAccountInformationPage editLoanAccountInformationPage = loanAccountPage.navigateToEditAccountInformation();
editLoanAccountInformationPage.verifyAccountParams(accountSubmitParameters, editAccountParameters);
editLoanAccountInformationPage.navigateBack();
loanTestHelper.applyCharge(ChargeParameters.MISC_FEES, "10");
loanTestHelper.applyCharge(ChargeParameters.MISC_PENALTY, "10");
loanTestHelper.approveLoan();
loanTestHelper.disburseLoan(systemDateTime);
String[][] tableOnOriginalInstallment = OriginalScheduleData.VARIABLE_LOAN_EARLY_DISBURSAL_SCHEDULE;
verifyOriginalSchedule(tableOnOriginalInstallment);
loanTestHelper.applyCharge(ChargeParameters.MISC_FEES, "10");
loanTestHelper.applyCharge(ChargeParameters.MISC_PENALTY, "10");
verifyOriginalSchedule(tableOnOriginalInstallment);
loanTestHelper.makePayment(systemDateTime.plusDays(5), "100");
//Then
verifyOriginalSchedule(tableOnOriginalInstallment);
applicationDatabaseOperation.updateLSIM(0);
}
use of java.util.Calendar in project head by mifos.
the class HolidayServiceImpl method getCalendarDate.
private static Calendar getCalendarDate(Date date) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
return calendar;
}
use of java.util.Calendar in project head by mifos.
the class DateUtils method getCurrentDate.
// should be removed and the setCurrentDate() should be used
public static String getCurrentDate(Locale locale) throws InvalidDateException {
// the following line is for 1.1 release and will be removed when date
// is localized
locale = internalLocale;
Calendar currentCalendar = getCurrentDateCalendar();
java.sql.Date currentDate = new java.sql.Date(currentCalendar.getTimeInMillis());
SimpleDateFormat format = (SimpleDateFormat) DateFormat.getDateInstance(DateFormat.SHORT, locale);
String userfmt = convertToCurrentDateFormat(format.toPattern());
return convertDbToUserFmt(currentDate.toString(), userfmt);
}
use of java.util.Calendar in project head by mifos.
the class DateUtils method getCalendar.
public static Calendar getCalendar(Date date) {
Calendar calendar = getCurrentDateCalendar();
calendar.setTime(org.apache.commons.lang.time.DateUtils.truncate(date, Calendar.DATE));
return calendar;
}
Aggregations