Search in sources :

Example 51 with AccountFeesEntity

use of org.mifos.accounts.business.AccountFeesEntity in project head by mifos.

the class CustomerPersistenceIntegrationTest method testGetCustomerAccountsForFee.

@Test
public void testGetCustomerAccountsForFee() throws Exception {
    groupAccount = getLoanAccount();
    FeeBO periodicFee = TestObjectFactory.createPeriodicAmountFee("ClientPeridoicFee", FeeCategory.CENTER, "5", RecurrenceType.WEEKLY, Short.valueOf("1"));
    AccountFeesEntity accountFee = new AccountFeesEntity(center.getCustomerAccount(), periodicFee, ((AmountFeeBO) periodicFee).getFeeAmount().getAmountDoubleValue());
    CustomerAccountBO customerAccount = center.getCustomerAccount();
    AccountTestUtils.addAccountFees(accountFee, customerAccount);
    TestObjectFactory.updateObject(customerAccount);
    StaticHibernateUtil.flushSession();
    // check for the account fee
    List<AccountBO> accountList = new CustomerPersistence().getCustomerAccountsForFee(periodicFee.getFeeId());
    Assert.assertNotNull(accountList);
    Assert.assertEquals(1, accountList.size());
    Assert.assertTrue(accountList.get(0) instanceof CustomerAccountBO);
    // get all objects again
    groupAccount = TestObjectFactory.getObject(LoanBO.class, groupAccount.getAccountId());
    group = TestObjectFactory.getCustomer(group.getCustomerId());
    center = TestObjectFactory.getCustomer(center.getCustomerId());
}
Also used : CustomerAccountBO(org.mifos.customers.business.CustomerAccountBO) AccountBO(org.mifos.accounts.business.AccountBO) CustomerAccountBO(org.mifos.customers.business.CustomerAccountBO) LoanBO(org.mifos.accounts.loan.business.LoanBO) FeeBO(org.mifos.accounts.fees.business.FeeBO) AmountFeeBO(org.mifos.accounts.fees.business.AmountFeeBO) AccountFeesEntity(org.mifos.accounts.business.AccountFeesEntity) AmountFeeBO(org.mifos.accounts.fees.business.AmountFeeBO) Test(org.junit.Test)

Example 52 with AccountFeesEntity

use of org.mifos.accounts.business.AccountFeesEntity in project head by mifos.

the class IntegrationTestObjectMother method createCenter.

public static void createCenter(CenterBO center, MeetingBO meeting) {
    UserContext userContext = TestUtils.makeUser();
    center.setUserContext(userContext);
    List<AccountFeesEntity> accountFees = new ArrayList<AccountFeesEntity>();
    customerService.createCenter(center, meeting, accountFees);
    StaticHibernateUtil.flushAndClearSession();
}
Also used : UserContext(org.mifos.security.util.UserContext) ArrayList(java.util.ArrayList) AccountFeesEntity(org.mifos.accounts.business.AccountFeesEntity)

Example 53 with AccountFeesEntity

use of org.mifos.accounts.business.AccountFeesEntity in project head by mifos.

the class IntegrationTestObjectMother method createClient.

public static void createClient(ClientBO client, MeetingBO meeting, SavingsOfferingBO savingsProduct) throws CustomerException {
    UserContext userContext = TestUtils.makeUser();
    client.setUserContext(userContext);
    List<AccountFeesEntity> accountFees = new ArrayList<AccountFeesEntity>();
    List<SavingsOfferingBO> selectedOfferings = new ArrayList<SavingsOfferingBO>();
    selectedOfferings.add(savingsProduct);
    customerService.createClient(client, meeting, accountFees, selectedOfferings);
}
Also used : UserContext(org.mifos.security.util.UserContext) ArrayList(java.util.ArrayList) SavingsOfferingBO(org.mifos.accounts.productdefinition.business.SavingsOfferingBO) AccountFeesEntity(org.mifos.accounts.business.AccountFeesEntity)

Example 54 with AccountFeesEntity

use of org.mifos.accounts.business.AccountFeesEntity in project head by mifos.

the class CenterServiceFacadeWebTier method createNewCenter.

@Override
public CustomerDetailsDto createNewCenter(CenterCreationDetail createCenterDetail, MeetingDto meetingDto) {
    MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    UserContext userContext = toUserContext(user);
    OfficeBO userOffice = this.officeDao.findOfficeById(userContext.getBranchId());
    userContext.setBranchGlobalNum(userOffice.getGlobalOfficeNum());
    String centerName = createCenterDetail.getDisplayName();
    String externalId = createCenterDetail.getExternalId();
    AddressDto addressDto = createCenterDetail.getAddressDto();
    Address centerAddress = new Address(addressDto.getLine1(), addressDto.getLine2(), addressDto.getLine3(), addressDto.getCity(), addressDto.getState(), addressDto.getCountry(), addressDto.getZip(), addressDto.getPhoneNumber());
    PersonnelBO loanOfficer = this.personnelDao.findPersonnelById(createCenterDetail.getLoanOfficerId());
    OfficeBO centerOffice = this.officeDao.findOfficeById(createCenterDetail.getOfficeId());
    List<AccountFeesEntity> feesForCustomerAccount = createAccountFeeEntities(createCenterDetail.getFeesToApply());
    DateTime mfiJoiningDate = null;
    if (createCenterDetail.getMfiJoiningDate() != null) {
        mfiJoiningDate = createCenterDetail.getMfiJoiningDate().toDateMidnight().toDateTime();
    }
    MeetingBO meeting = new MeetingFactory().create(meetingDto);
    meeting.setUserContext(userContext);
    CenterBO center = CenterBO.createNew(userContext, centerName, mfiJoiningDate, meeting, loanOfficer, centerOffice, centerAddress, externalId, new DateMidnight().toDateTime());
    try {
        personnelDao.checkAccessPermission(userContext, center.getOfficeId(), center.getLoanOfficerId());
    } catch (AccountException e) {
        throw new MifosRuntimeException("Access denied!", e);
    }
    this.customerService.createCenter(center, meeting, feesForCustomerAccount);
    return new CustomerDetailsDto(center.getCustomerId(), center.getGlobalCustNum());
}
Also used : Address(org.mifos.framework.business.util.Address) UserContext(org.mifos.security.util.UserContext) MeetingBO(org.mifos.application.meeting.business.MeetingBO) CenterBO(org.mifos.customers.center.business.CenterBO) MifosUser(org.mifos.security.MifosUser) CustomerAddressDto(org.mifos.dto.domain.CustomerAddressDto) AddressDto(org.mifos.dto.domain.AddressDto) MeetingFactory(org.mifos.application.meeting.business.MeetingFactory) DateTime(org.joda.time.DateTime) AccountException(org.mifos.accounts.exceptions.AccountException) OfficeBO(org.mifos.customers.office.business.OfficeBO) PersonnelBO(org.mifos.customers.personnel.business.PersonnelBO) DateMidnight(org.joda.time.DateMidnight) CustomerDetailsDto(org.mifos.dto.domain.CustomerDetailsDto) AccountFeesEntity(org.mifos.accounts.business.AccountFeesEntity) MifosRuntimeException(org.mifos.core.MifosRuntimeException)

Example 55 with AccountFeesEntity

use of org.mifos.accounts.business.AccountFeesEntity in project head by mifos.

the class CustomerScheduleEntity method applyPeriodicFees.

void applyPeriodicFees(Short feeId, Money totalAmount) {
    AccountFeesEntity accountFeesEntity = account.getAccountFees(feeId);
    AccountFeesActionDetailEntity accountFeesActionDetailEntity = new CustomerFeeScheduleEntity(this, accountFeesEntity.getFees(), accountFeesEntity, totalAmount);
    addAccountFeesAction(accountFeesActionDetailEntity);
}
Also used : AccountFeesActionDetailEntity(org.mifos.accounts.business.AccountFeesActionDetailEntity) AccountFeesEntity(org.mifos.accounts.business.AccountFeesEntity)

Aggregations

AccountFeesEntity (org.mifos.accounts.business.AccountFeesEntity)118 ArrayList (java.util.ArrayList)78 Test (org.junit.Test)65 CenterBuilder (org.mifos.domain.builders.CenterBuilder)46 DateTime (org.joda.time.DateTime)42 MeetingBO (org.mifos.application.meeting.business.MeetingBO)42 CenterBO (org.mifos.customers.center.business.CenterBO)39 MeetingBuilder (org.mifos.domain.builders.MeetingBuilder)38 FeeBO (org.mifos.accounts.fees.business.FeeBO)25 Money (org.mifos.framework.util.helpers.Money)25 AmountFeeBO (org.mifos.accounts.fees.business.AmountFeeBO)24 UserContext (org.mifos.security.util.UserContext)22 LocalDate (org.joda.time.LocalDate)21 AccountActionDateEntity (org.mifos.accounts.business.AccountActionDateEntity)21 CustomerAccountBO (org.mifos.customers.business.CustomerAccountBO)18 FeeInstallment (org.mifos.accounts.util.helpers.FeeInstallment)17 OfficeBO (org.mifos.customers.office.business.OfficeBO)17 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)17 MifosUser (org.mifos.security.MifosUser)16 AccountException (org.mifos.accounts.exceptions.AccountException)14