use of org.mifos.application.master.business.PaymentTypeEntity in project head by mifos.
the class SavingsServiceFacadeWebTier method retrieveDepositPaymentTypes.
private List<ListElement> retrieveDepositPaymentTypes(UserContext userContext) {
try {
List<ListElement> depositPaymentTypes = new ArrayList<ListElement>();
List<PaymentTypeEntity> acceptedPaymentEntityTypes = legacyAcceptedPaymentTypeDao.getAcceptedPaymentTypesForATransaction(userContext.getLocaleId(), TrxnTypes.savings_deposit.getValue());
for (PaymentTypeEntity paymentTypeEntity : acceptedPaymentEntityTypes) {
LookUpValueEntity lookupValue = paymentTypeEntity.getLookUpValue();
String messageText = lookupValue.getMessageText();
if (StringUtils.isBlank(messageText)) {
messageText = ApplicationContextProvider.getBean(MessageLookup.class).lookup(lookupValue.getPropertiesKey());
}
depositPaymentTypes.add(new ListElement(paymentTypeEntity.getId().intValue(), messageText));
}
return depositPaymentTypes;
} catch (PersistenceException e) {
throw new MifosRuntimeException(e);
}
}
use of org.mifos.application.master.business.PaymentTypeEntity in project head by mifos.
the class LookupOptionsAction method update.
@TransactionDemarcate(validateAndResetToken = true)
public ActionForward update(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
logger.debug("Inside update method");
// setHiddenFields(request);
LookupOptionsActionForm lookupOptionsActionForm = (LookupOptionsActionForm) form;
LookupOptionData data = (LookupOptionData) SessionUtils.getAttribute(ConfigurationConstants.LOOKUP_OPTION_DATA, request);
data.setLookupValue(lookupOptionsActionForm.getLookupValue());
String entity = request.getParameter(ConfigurationConstants.ENTITY);
if (data.getLookupId() > 0) {
legacyMasterDao.updateValueListElementForLocale(data.getLookupId(), data.getLookupValue());
} else {
LookUpValueEntity newLookupValue = legacyMasterDao.addValueListElementForLocale(DynamicLookUpValueCreationTypes.LookUpOption, data.getValueListId(), data.getLookupValue());
/*
* Add a special case for payment types since we not only need to create a new
* lookup value but also a new PaymentTypeEntity when adding an entry
*/
if (entity.equals(ConfigurationConstants.CONFIG_PAYMENT_TYPE)) {
PaymentTypeEntity newPaymentType = new PaymentTypeEntity(newLookupValue);
legacyMasterDao.createOrUpdate(newPaymentType);
StaticHibernateUtil.commitTransaction();
}
}
return mapping.findForward(ActionForwards.update_success.toString());
}
use of org.mifos.application.master.business.PaymentTypeEntity in project head by mifos.
the class LegacyAccountDaoIntegrationTest method testFindingAccountPaymentShouldReturnOnePayment.
@Test
public void testFindingAccountPaymentShouldReturnOnePayment() throws Exception {
savingsBO = createSavingsAccount();
AccountPaymentEntity accountPaymentEntity = new AccountPaymentEntity(savingsBO, TestUtils.createMoney(100), "1111", 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(1, result.size());
Assert.assertEquals("1111", result.get(0).getReceiptNumber());
}
use of org.mifos.application.master.business.PaymentTypeEntity in project head by mifos.
the class SavingsAccountBuilder method withWithdrawalOf.
public SavingsAccountBuilder withWithdrawalOf(String withdrawalAmount) {
Money amount = TestUtils.createMoney(withdrawalAmount);
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.withdrawals.add(deposit);
return this;
}
use of org.mifos.application.master.business.PaymentTypeEntity in project head by mifos.
the class CustomerTrxnDetailEntityIntegrationTest method testGenerateReverseTrxn.
@Test
public void testGenerateReverseTrxn() throws Exception {
accountBO = client.getCustomerAccount();
Date currentDate = new Date(System.currentTimeMillis());
CustomerAccountBO customerAccountBO = (CustomerAccountBO) accountBO;
customerAccountBO.setUserContext(userContext);
CustomerScheduleEntity accountAction = (CustomerScheduleEntity) customerAccountBO.getAccountActionDate(Short.valueOf("1"));
accountAction.setMiscFeePaid(TestUtils.createMoney(100));
accountAction.setMiscPenaltyPaid(TestUtils.createMoney(100));
accountAction.setPaymentDate(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());
accountTrxnEntity.addFeesTrxnDetail(feeTrxn);
}
accountPaymentEntity.addAccountTrxn(accountTrxnEntity);
AccountTestUtils.addAccountPayment(accountPaymentEntity, customerAccountBO);
PersonnelBO loggedInUser = legacyPersonnelDao.getPersonnel(userContext.getId());
for (AccountTrxnEntity accntTrxn : customerAccountBO.findMostRecentPaymentByPaymentDate().getAccountTrxns()) {
AccountTrxnEntity reverseAccntTrxn = ((CustomerTrxnDetailEntity) accntTrxn).generateReverseTrxn(loggedInUser, "adjustment");
Assert.assertEquals(reverseAccntTrxn.getAmount(), accntTrxn.getAmount().negate());
Assert.assertEquals(loggedInUser.getPersonnelId(), reverseAccntTrxn.getPersonnel().getPersonnelId());
}
}
Aggregations