Search in sources :

Example 1 with ClientPerformanceHistoryEntity

use of org.mifos.customers.client.business.ClientPerformanceHistoryEntity in project head by mifos.

the class LoanBO method updatePerformanceHistory.

private void updatePerformanceHistory(boolean accountReOpened) {
    if (accountReOpened && this.getCustomer().isClient()) {
        ClientPerformanceHistoryEntity clientHistory = (ClientPerformanceHistoryEntity) this.getCustomer().getPerformanceHistory();
        clientHistory.incrementNoOfActiveLoans();
        Money newLastLoanAmount = getlegacyLoanDao().findClientPerformanceHistoryLastLoanAmountWhenRepaidLoanAdjusted(this.getCustomer().getCustomerId(), this.getAccountId());
        clientHistory.setLastLoanAmount(newLastLoanAmount);
    }
    if (accountReOpened && this.getCustomer().isGroup()) {
        final GroupPerformanceHistoryEntity groupHistory = (GroupPerformanceHistoryEntity) this.getCustomer().getPerformanceHistory();
        Money newLastGroupLoanAmount = getlegacyLoanDao().findGroupPerformanceHistoryLastLoanAmountWhenRepaidLoanAdjusted(this.getCustomer().getCustomerId(), this.getAccountId());
        groupHistory.setLastGroupLoanAmount(newLastGroupLoanAmount);
    }
}
Also used : Money(org.mifos.framework.util.helpers.Money) GroupPerformanceHistoryEntity(org.mifos.customers.group.business.GroupPerformanceHistoryEntity) ClientPerformanceHistoryEntity(org.mifos.customers.client.business.ClientPerformanceHistoryEntity)

Example 2 with ClientPerformanceHistoryEntity

use of org.mifos.customers.client.business.ClientPerformanceHistoryEntity in project head by mifos.

the class LoanBO method updateCustomerHistoryOnPayment.

private void updateCustomerHistoryOnPayment() {
    if (getCustomer().isClient() && getCustomer().getPerformanceHistory() != null) {
        ClientPerformanceHistoryEntity clientPerfHistory = (ClientPerformanceHistoryEntity) getCustomer().getPerformanceHistory();
        clientPerfHistory.decrementNoOfActiveLoans();
    }
}
Also used : ClientPerformanceHistoryEntity(org.mifos.customers.client.business.ClientPerformanceHistoryEntity)

Example 3 with ClientPerformanceHistoryEntity

use of org.mifos.customers.client.business.ClientPerformanceHistoryEntity in project head by mifos.

the class CustomerBOIntegrationTest method testClientPerfObject.

@Test
public void testClientPerfObject() throws PersistenceException {
    createInitialObjects();
    ClientPerformanceHistoryEntity clientPerformanceHistory = client.getClientPerformanceHistory();
    clientPerformanceHistory.setNoOfActiveLoans(Integer.valueOf("1"));
    clientPerformanceHistory.setLastLoanAmount(new Money(getCurrency(), "100"));
    TestObjectFactory.updateObject(client);
    client = (ClientBO) customerPersistence.findBySystemId(client.getGlobalCustNum(), client.getCustomerLevel().getId());
    Assert.assertEquals(client.getCustomerId(), client.getClientPerformanceHistory().getClient().getCustomerId());
    Assert.assertEquals(new Money(getCurrency(), "100"), client.getClientPerformanceHistory().getLastLoanAmount());
    Assert.assertEquals(new Money(getCurrency(), "0"), client.getClientPerformanceHistory().getDelinquentPortfolioAmount());
}
Also used : Money(org.mifos.framework.util.helpers.Money) ClientPerformanceHistoryEntity(org.mifos.customers.client.business.ClientPerformanceHistoryEntity) Test(org.junit.Test)

Aggregations

ClientPerformanceHistoryEntity (org.mifos.customers.client.business.ClientPerformanceHistoryEntity)3 Money (org.mifos.framework.util.helpers.Money)2 Test (org.junit.Test)1 GroupPerformanceHistoryEntity (org.mifos.customers.group.business.GroupPerformanceHistoryEntity)1