Search in sources :

Example 6 with SavingsRecentActivityDto

use of org.mifos.dto.screen.SavingsRecentActivityDto in project head by mifos.

the class SavingsBOIntegrationTest method testGetRecentAccountActivity.

@Test
public void testGetRecentAccountActivity() throws Exception {
    createInitialObjects();
    savingsOffering = helper.createSavingsOffering("dfasdasd1", "sad1");
    savings = helper.createSavingsAccount("000100000000017", savingsOffering, group, AccountStates.SAVINGS_ACC_APPROVED, userContext);
    SavingsActivityEntity savingsActivity = new SavingsActivityEntity(savings.getPersonnel(), (AccountActionEntity) StaticHibernateUtil.getSessionTL().get(AccountActionEntity.class, Short.valueOf("1")), new Money(getCurrency(), "100"), new Money(getCurrency(), "22"), new Date(), savings);
    savings.addSavingsActivityDetails(savingsActivity);
    savings.update();
    StaticHibernateUtil.flushAndClearSession();
    savings = savingsDao.findById(savings.getAccountId());
    savings.setUserContext(userContext);
    Assert.assertEquals(1, savings.getRecentAccountActivity(3).size());
    for (SavingsRecentActivityDto view : savings.getRecentAccountActivity(3)) {
        Assert.assertNotNull(view.getActivity());
        Assert.assertEquals(new Money(getCurrency(), "100.0"), new Money(getCurrency(), view.getAmount()));
        Assert.assertEquals(new Money(getCurrency(), "22.0"), new Money(getCurrency(), view.getRunningBalance()));
        Assert.assertNotNull(view.getAccountTrxnId());
        Assert.assertEquals(DateUtils.getCurrentDateWithoutTimeStamp(), DateUtils.getDateWithoutTimeStamp(view.getActionDate().getTime()));
        Assert.assertNull(view.getLocale());
        break;
    }
    group = savings.getCustomer();
    center = group.getParentCustomer();
}
Also used : Money(org.mifos.framework.util.helpers.Money) SavingsRecentActivityDto(org.mifos.dto.screen.SavingsRecentActivityDto) SavingsActivityEntity(org.mifos.accounts.savings.business.SavingsActivityEntity) Date(java.util.Date) Test(org.junit.Test)

Aggregations

SavingsRecentActivityDto (org.mifos.dto.screen.SavingsRecentActivityDto)6 Date (java.util.Date)3 Test (org.junit.Test)2 SavingsAccountDetailDto (org.mifos.dto.domain.SavingsAccountDetailDto)2 IncludePage (freemarker.ext.servlet.IncludePage)1 ArrayList (java.util.ArrayList)1 AccountActionDateEntity (org.mifos.accounts.business.AccountActionDateEntity)1 AccountNotesEntity (org.mifos.accounts.business.AccountNotesEntity)1 SavingsActivityEntity (org.mifos.accounts.savings.business.SavingsActivityEntity)1 SavingsBO (org.mifos.accounts.savings.business.SavingsBO)1 CustomerNoteDto (org.mifos.dto.domain.CustomerNoteDto)1 SavingsPerformanceHistoryDto (org.mifos.dto.domain.SavingsPerformanceHistoryDto)1 Money (org.mifos.framework.util.helpers.Money)1 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 ModelAndView (org.springframework.web.servlet.ModelAndView)1