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());
}
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();
}
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);
}
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());
}
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);
}
Aggregations