use of org.mifos.accounts.savings.business.SavingsTrxnDetailEntity in project head by mifos.
the class InterestPostingAccountingEntry method applySpecificAccountActionEntry.
@Override
protected void applySpecificAccountActionEntry() throws FinancialException {
SavingsTrxnDetailEntity savingsTrxn = (SavingsTrxnDetailEntity) financialActivity.getAccountTrxn();
FinancialActionTypeEntity finIntPostingAction = getFinancialAction(FinancialActionConstants.SAVINGS_INTERESTPOSTING);
SavingsOfferingBO savingsOffering = ((SavingsBO) savingsTrxn.getAccount()).getSavingsOffering();
addAccountEntryDetails(savingsTrxn.getInterestAmount(), finIntPostingAction, savingsOffering.getInterestGLCode(), FinancialConstants.DEBIT);
addAccountEntryDetails(savingsTrxn.getInterestAmount(), finIntPostingAction, savingsOffering.getDepositGLCode(), FinancialConstants.CREDIT);
}
use of org.mifos.accounts.savings.business.SavingsTrxnDetailEntity in project head by mifos.
the class SavingsAdjustmentAccountingEntry method applySpecificAccountActionEntry.
@Override
protected void applySpecificAccountActionEntry() throws FinancialException {
SavingsTrxnDetailEntity savingsTrxn = (SavingsTrxnDetailEntity) financialActivity.getAccountTrxn();
SavingsBO savings = (SavingsBO) savingsTrxn.getAccount();
if (isAdjustmentForWithdrawal(savings)) {
adjustWithdrawal(savings, savingsTrxn);
} else {
adjustDeposit(savings, savingsTrxn);
}
}
use of org.mifos.accounts.savings.business.SavingsTrxnDetailEntity in project head by mifos.
the class SavingsTestHelper method createAccountPaymentToPersist.
public AccountPaymentEntity createAccountPaymentToPersist(AccountBO account, Money amount, Money balance, Date trxnDate, Short accountAction, SavingsBO savingsObj, PersonnelBO createdBy, CustomerBO customer) throws Exception {
AccountPaymentEntity payment = createAccountPayment(account, amount, new Date(), createdBy);
SavingsTrxnDetailEntity savingsTrxnDetail = SavingsTrxnDetailEntity.savingsAdjustment(payment, customer, balance, amount, createdBy, trxnDate, trxnDate, new DateTime().toDate(), "", null);
payment.addAccountTrxn(savingsTrxnDetail);
return payment;
}
use of org.mifos.accounts.savings.business.SavingsTrxnDetailEntity in project head by mifos.
the class SavingsPostInterestTest method whenPostingInterestASingleAccountTransactionIsAssociatedWithAccountPayment.
@Test
public void whenPostingInterestASingleAccountTransactionIsAssociatedWithAccountPayment() {
// setup
InterestScheduledEvent postingSchedule = new MonthlyOnLastDayOfMonthInterestScheduledEvent(1);
Money interestToBePosted = TestUtils.createMoney("100");
DateTime activationDate = new DateTime().withDate(2010, 7, 20);
DateTime nextInterestPostingDate = new DateTime().withDate(2010, 7, 31);
savingsAccount = new SavingsAccountBuilder().active().withActivationDate(activationDate).withNextInterestPostingDateOf(nextInterestPostingDate).withSavingsProduct(savingsProduct).withCustomer(client).build();
// pre verification
assertTrue(savingsAccount.getAccountPayments().isEmpty());
InterestCalculationPeriodResult calculationPeriod = new InterestCalculationPeriodResultBuilder().withCalculatedInterest("100").build();
InterestPostingPeriodResult interestPostingPeriodResult = new InterestPostingPeriodResultBuilder().from(nextInterestPostingDate.toLocalDate()).to(nextInterestPostingDate.toLocalDate()).with(calculationPeriod).build();
PersonnelBO createdBy = new PersonnelBuilder().build();
// exercise
savingsAccount.postInterest(postingSchedule, interestPostingPeriodResult, createdBy);
// verification
AccountPaymentEntity interestPostingPayment = savingsAccount.getAccountPayments().get(0);
assertFalse(interestPostingPayment.getAccountTrxns().isEmpty());
List<AccountTrxnEntity> accountTransactions = new ArrayList<AccountTrxnEntity>(interestPostingPayment.getAccountTrxns());
SavingsTrxnDetailEntity interestPostingTransaction = (SavingsTrxnDetailEntity) accountTransactions.get(0);
assertThat(interestPostingTransaction.getAccount(), is((AccountBO) savingsAccount));
assertThat(interestPostingTransaction.getAmount(), is(interestToBePosted));
assertThat(interestPostingTransaction.getInterestAmount(), is(interestToBePosted));
assertThat(interestPostingTransaction.getAccountActionEntity().getId(), is(AccountActionTypes.SAVINGS_INTEREST_POSTING.getValue()));
assertThat(new LocalDate(interestPostingTransaction.getActionDate()), is(nextInterestPostingDate.toLocalDate()));
assertThat(new LocalDate(interestPostingTransaction.getDueDate()), is(today()));
assertThat(datePartOf(interestPostingTransaction.getTrxnCreatedDate()), is(today()));
}
use of org.mifos.accounts.savings.business.SavingsTrxnDetailEntity in project head by mifos.
the class SavingsBOIntegrationTest method createSavingsAccountPayment.
private SavingsBO createSavingsAccountPayment() throws Exception {
AccountPaymentEntity payment;
createInitialObjects();
savingsOffering = helper.createSavingsOffering("2333dsf", "2132");
savings = helper.createSavingsAccount(savingsOffering, group, AccountState.SAVINGS_ACTIVE, userContext);
Money initialBal = new Money(currency, "5500");
payment = helper.createAccountPayment(savings, null, new Money(currency, "5500.0"), new Date(), createdBy);
SavingsTrxnDetailEntity adjustment = SavingsTrxnDetailEntity.savingsAdjustment(payment, group, initialBal, initialBal, createdBy, helper.getDate("04/01/2006"), helper.getDate("04/01/2006"), new DateTime().toDate(), "", null);
payment.addAccountTrxn(adjustment);
AccountTestUtils.addAccountPayment(payment, savings);
savings.update();
return TestObjectFactory.getObject(SavingsBO.class, savings.getAccountId());
}
Aggregations