use of org.mifos.application.master.business.PaymentTypeEntity in project head by mifos.
the class CollectionSheetServiceImplRetrieveSavingsAccountsIntegrationTest method testCollectionSheetRetrieveOnlyReturnsActiveAndInactiveSavingsAccounts.
/**
* need to clean up test data set up
*/
@Ignore
@Test
public void testCollectionSheetRetrieveOnlyReturnsActiveAndInactiveSavingsAccounts() throws Exception {
UserContext userContext = TestUtils.makeUser();
collectionSheetRetrieveSavingsAccountsUtils.createSampleCenterHierarchy();
SavingsBO centerSavingsAccount = (SavingsBO) legacyAccountDao.getAccount(collectionSheetRetrieveSavingsAccountsUtils.getCenterSavingsAccount().getAccountId());
centerSavingsAccount.setUserContext(userContext);
PersonnelBO loggedInUser = IntegrationTestObjectMother.testUser();
centerSavingsAccount.changeStatus(AccountState.SAVINGS_INACTIVE, Short.valueOf("1"), "Make Center Savings Account Inactive", loggedInUser);
SavingsBO clientSavings = (SavingsBO) legacyAccountDao.getAccount(collectionSheetRetrieveSavingsAccountsUtils.getClientOfGroupCompleteGroupSavingsAccount().getAccountId());
AccountPaymentEntity payment = new AccountPaymentEntity(clientSavings, new Money(clientSavings.getCurrency()), null, null, new PaymentTypeEntity(Short.valueOf("1")), new Date());
AccountNotesEntity notes = new AccountNotesEntity(new java.sql.Date(System.currentTimeMillis()), "close client savings account", TestObjectFactory.getPersonnel(userContext.getId()), clientSavings);
clientSavings.setUserContext(userContext);
clientSavings.closeAccount(payment, notes, clientSavings.getCustomer(), loggedInUser);
IntegrationTestObjectMother.saveSavingsAccount(clientSavings);
StaticHibernateUtil.flushSession();
CollectionSheetDto collectionSheet = collectionSheetService.retrieveCollectionSheet(collectionSheetRetrieveSavingsAccountsUtils.getCenter().getCustomerId(), new LocalDate());
List<CollectionSheetCustomerDto> customers = collectionSheet.getCollectionSheetCustomer();
for (CollectionSheetCustomerDto customer : customers) {
for (CollectionSheetCustomerSavingDto customerSaving : customer.getCollectionSheetCustomerSaving()) {
Boolean accountIsActiveOrInactive = false;
AccountBO accountBO = legacyAccountDao.getAccount(customerSaving.getAccountId());
if ((accountBO.getState().equals(AccountState.SAVINGS_ACTIVE)) || (accountBO.getState().equals(AccountState.SAVINGS_INACTIVE))) {
accountIsActiveOrInactive = true;
}
Assert.assertTrue("Found Account State: " + accountBO.getState().toString() + " - Only Active and Inactive Savings Accounts are Allowed", accountIsActiveOrInactive);
}
}
}
use of org.mifos.application.master.business.PaymentTypeEntity in project head by mifos.
the class SaveCollectionSheetStructureValidatorIntegrationTest method ignore_testShouldGetINVALID_SAVINGS_ACCOUNT_STATUSIfSavingsAccountClosed.
public void ignore_testShouldGetINVALID_SAVINGS_ACCOUNT_STATUSIfSavingsAccountClosed() throws Exception {
LocalDate transactionDate = new LocalDate();
// create a center hierarchy with savings accounts
collectionSheetRetrieveSavingsAccountsUtils.createSampleCenterHierarchy();
// retrieve the collection sheet for today
CollectionSheetService collectionSheetService = ApplicationContextProvider.getBean(CollectionSheetService.class);
CollectionSheetDto collectionSheet = collectionSheetService.retrieveCollectionSheet(collectionSheetRetrieveSavingsAccountsUtils.getCenter().getCustomerId(), transactionDate);
// assemble dto for saving collection sheet
SaveCollectionSheetDto saveCollectionSheet = saveCollectionSheetUtils.assembleSaveCollectionSheetDto(collectionSheet, transactionDate);
// close a savings account that is about to be saved
UserContext userContext = TestUtils.makeUser();
SavingsBO clientSavings = (SavingsBO) legacyAccountDao.getAccount(collectionSheetRetrieveSavingsAccountsUtils.getClientOfGroupCompleteGroupSavingsAccount().getAccountId());
AccountPaymentEntity payment = new AccountPaymentEntity(clientSavings, new Money(clientSavings.getCurrency()), null, null, new PaymentTypeEntity(Short.valueOf("1")), new Date());
AccountNotesEntity notes = new AccountNotesEntity(new java.sql.Date(System.currentTimeMillis()), "close client savings account", TestObjectFactory.getPersonnel(userContext.getId()), clientSavings);
clientSavings.setUserContext(userContext);
// clientSavings.closeAccount(payment, notes, clientSavings.getCustomer());
StaticHibernateUtil.flushSession();
// Save collection sheet and test for errors returned
verifyInvalidReason(saveCollectionSheet, InvalidSaveCollectionSheetReason.INVALID_SAVINGS_ACCOUNT_STATUS);
}
use of org.mifos.application.master.business.PaymentTypeEntity in project head by mifos.
the class SavingsAccountBuilder method withDepositOn.
public SavingsAccountBuilder withDepositOn(String depositAmount, DateTime paymentDateTime) {
Money amount = TestUtils.createMoney(depositAmount);
String receiptNumber = null;
Date receiptDate = null;
PaymentTypeEntity paymentType = new PaymentTypeEntity(PaymentTypes.CASH.getValue());
Date paymentDate = paymentDateTime.toDate();
AccountPaymentEntity deposit = new AccountPaymentEntity(null, amount, receiptNumber, receiptDate, paymentType, paymentDate);
this.deposits.add(deposit);
return this;
}
use of org.mifos.application.master.business.PaymentTypeEntity in project head by mifos.
the class SavingsAccountBuilder method withDepositOf.
public SavingsAccountBuilder withDepositOf(String depositAmount) {
Money amount = TestUtils.createMoney(depositAmount);
String receiptNumber = null;
Date receiptDate = null;
PaymentTypeEntity paymentType = new PaymentTypeEntity(PaymentTypes.CASH.getValue());
Date paymentDate = new DateTime().toDate();
AccountPaymentEntity deposit = new AccountPaymentEntity(null, amount, receiptNumber, receiptDate, paymentType, paymentDate);
this.deposits.add(deposit);
return this;
}
use of org.mifos.application.master.business.PaymentTypeEntity in project head by mifos.
the class CustomerApplyAdjustmentActionStrutsTest method applyPayment.
private void applyPayment() throws Exception {
createInitialObjects();
accountBO = client.getCustomerAccount();
Date currentDate = new Date(System.currentTimeMillis());
CustomerAccountBO customerAccountBO = (CustomerAccountBO) accountBO;
customerAccountBO.setUserContext(userContext);
CustomerScheduleEntity accountAction = (CustomerScheduleEntity) customerAccountBO.getAccountActionDate(Short.valueOf("1"));
CustomerAccountBOTestUtils.setMiscFeePaid(accountAction, TestUtils.createMoney(100));
CustomerAccountBOTestUtils.setMiscPenaltyPaid(accountAction, TestUtils.createMoney(100));
CustomerAccountBOTestUtils.setPaymentDate(accountAction, currentDate);
accountAction.setPaymentStatus(PaymentStatus.PAID);
AccountPaymentEntity accountPaymentEntity = new AccountPaymentEntity(accountBO, TestUtils.createMoney(100), "1111", currentDate, new PaymentTypeEntity(Short.valueOf("1")), new Date(System.currentTimeMillis()));
CustomerTrxnDetailEntity accountTrxnEntity = new CustomerTrxnDetailEntity(accountPaymentEntity, AccountActionTypes.PAYMENT, Short.valueOf("1"), accountAction.getActionDate(), TestObjectFactory.getPersonnel(userContext.getId()), currentDate, TestUtils.createMoney(200), "payment done", null, TestUtils.createMoney(100), TestUtils.createMoney(100));
for (AccountFeesActionDetailEntity accountFeesActionDetailEntity : accountAction.getAccountFeesActionDetails()) {
CustomerAccountBOTestUtils.setFeeAmountPaid((CustomerFeeScheduleEntity) accountFeesActionDetailEntity, TestUtils.createMoney(100));
FeesTrxnDetailEntity feeTrxn = new FeesTrxnDetailEntity(accountTrxnEntity, accountFeesActionDetailEntity.getAccountFee(), accountFeesActionDetailEntity.getFeeAmount());
CustomerBOTestUtils.addFeesTrxnDetail(accountTrxnEntity, feeTrxn);
// totalFees = accountFeesActionDetailEntity.getFeeAmountPaid();
}
accountPaymentEntity.addAccountTrxn(accountTrxnEntity);
AccountTestUtils.addAccountPayment(accountPaymentEntity, customerAccountBO);
TestObjectFactory.updateObject(customerAccountBO);
StaticHibernateUtil.flushSession();
customerAccountBO = TestObjectFactory.getObject(CustomerAccountBO.class, customerAccountBO.getAccountId());
client = customerAccountBO.getCustomer();
SessionUtils.setAttribute(Constants.BUSINESS_KEY, client, request);
}
Aggregations