use of org.mifos.application.master.business.PaymentTypeEntity in project head by mifos.
the class AcceptedPaymentTypePersistenceIntegrationTest method testRetrieveAcceptedPaymentTypes.
@Test
public void testRetrieveAcceptedPaymentTypes() throws Exception {
for (TrxnTypes transactionType : TrxnTypes.values()) {
Short transactionId = transactionType.getValue();
List<AcceptedPaymentType> acceptedPaymentTypes = legacyAcceptedPaymentTypeDao.getAcceptedPaymentTypesForATransaction(transactionId, TrxnTypes.loan_repayment);
List<PaymentTypeEntity> paymentTypeEntities = legacyAcceptedPaymentTypeDao.getAcceptedPaymentTypesForATransaction(DEFAULT_LOCALE_ID, transactionId);
compare(paymentTypeEntities, acceptedPaymentTypes);
}
}
use of org.mifos.application.master.business.PaymentTypeEntity in project head by mifos.
the class AdminServiceFacadeWebTier method process.
private void process(List<PaymentTypeDto> selectedPaymentTypes, List<PaymentTypeDto> outList, List<AcceptedPaymentType> deletedPaymentTypeList, List<AcceptedPaymentType> addedPaymentTypeList, LegacyAcceptedPaymentTypeDao persistence, TrxnTypes transactionType) {
AcceptedPaymentType acceptedPaymentType = null;
if ((outList != null) && (outList.size() > 0)) {
for (PaymentTypeDto paymentType : outList) {
if (findDelete(paymentType, selectedPaymentTypes)) {
acceptedPaymentType = persistence.getAcceptedPaymentType(paymentType.getAcceptedPaymentTypeId());
deletedPaymentTypeList.add(acceptedPaymentType);
}
}
}
for (PaymentTypeDto selectedPaymentType : selectedPaymentTypes) {
Short paymentTypeId = selectedPaymentType.getId();
if (findNew(paymentTypeId, outList)) {
acceptedPaymentType = new AcceptedPaymentType();
PaymentTypeEntity paymentTypeEntity = new PaymentTypeEntity(paymentTypeId);
acceptedPaymentType.setPaymentTypeEntity(paymentTypeEntity);
TransactionTypeEntity transactionEntity = new TransactionTypeEntity();
transactionEntity.setTransactionId(transactionType.getValue());
acceptedPaymentType.setTransactionTypeEntity(transactionEntity);
addedPaymentTypeList.add(acceptedPaymentType);
}
}
}
use of org.mifos.application.master.business.PaymentTypeEntity in project head by mifos.
the class LegacyAccountDaoIntegrationTest method testFindingAccountPaymentShouldReturnZeroPayments.
@Test
public void testFindingAccountPaymentShouldReturnZeroPayments() throws Exception {
savingsBO = createSavingsAccount();
AccountPaymentEntity accountPaymentEntity = new AccountPaymentEntity(savingsBO, TestUtils.createMoney(100), "2222", new Date(System.currentTimeMillis()), new PaymentTypeEntity(Short.valueOf("1")), new Date(System.currentTimeMillis()));
List<AccountPaymentEntity> payments = new ArrayList<AccountPaymentEntity>();
payments.add(accountPaymentEntity);
savingsBO.setAccountPayments(payments);
legacyAccountDao.createOrUpdate(savingsBO);
StaticHibernateUtil.commitTransaction();
List<AccountPaymentEntity> result = legacyAccountDao.findAccountPaymentsByReceiptNumber("1111");
Assert.assertNotNull(result);
Assert.assertEquals(0, result.size());
}
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);
}
Aggregations