use of org.mifos.dto.screen.PaymentTypeDto in project head by mifos.
the class AdminServiceFacadeWebTier method setPaymentTypesForATransaction.
private void setPaymentTypesForATransaction(List<PaymentTypeDto> payments, TrxnTypes transactionType, LegacyAcceptedPaymentTypeDao paymentTypePersistence, AcceptedPaymentTypeDto dto) {
try {
Short transactionId = transactionType.getValue();
List<AcceptedPaymentType> paymentTypeList = paymentTypePersistence.getAcceptedPaymentTypesForATransaction(transactionId, TrxnTypes.loan_repayment);
List<PaymentTypeDto> inList = new ArrayList<PaymentTypeDto>(payments);
List<PaymentTypeDto> outList = new ArrayList<PaymentTypeDto>();
if (transactionType != TrxnTypes.fee && transactionType != TrxnTypes.loan_repayment) {
RemoveFromInList(inList, legacyAcceptedPaymentTypeDao.getSavingsTransferId());
}
PaymentTypeDto data = null;
for (AcceptedPaymentType paymentType : paymentTypeList) {
Short paymentTypeId = paymentType.getPaymentTypeEntity().getId();
data = new PaymentTypeDto(paymentTypeId, paymentType.getPaymentTypeEntity().getName(), paymentType.getAcceptedPaymentTypeId());
outList.add(data);
RemoveFromInList(inList, paymentTypeId);
}
if (transactionType == TrxnTypes.loan_repayment) {
dto.setInRepaymentList(inList);
dto.setOutRepaymentList(outList);
} else if (transactionType == TrxnTypes.fee) {
dto.setInFeeList(inList);
dto.setOutFeeList(outList);
} else if (transactionType == TrxnTypes.loan_disbursement) {
dto.setInDisbursementList(inList);
dto.setOutDisbursementList(outList);
} else if (transactionType == TrxnTypes.savings_deposit) {
dto.setInDepositList(inList);
dto.setOutDepositList(outList);
} else if (transactionType == TrxnTypes.savings_withdrawal) {
dto.setInWithdrawalList(inList);
dto.setOutWithdrawalList(outList);
} else {
throw new MifosRuntimeException("Unknown account action for accepted payment type " + transactionType.toString());
}
} catch (PersistenceException e) {
throw new MifosRuntimeException(e);
}
}
Aggregations