Search in sources :

Example 1 with TransactionTypeEntity

use of org.mifos.accounts.acceptedpaymenttype.business.TransactionTypeEntity in project head by mifos.

the class AcceptedPaymentTypePersistenceIntegrationTest method addAcceptedPaymentTypeForATransaction.

private void addAcceptedPaymentTypeForATransaction(List<AcceptedPaymentType> addAcceptedPaymentTypes, TrxnTypes transactionType) throws Exception {
    for (TransactionAcceptedPaymentTypes transactionAcceptedPaymentTypes : currentAcceptedPaymentTypes) {
        TrxnTypes transType = transactionAcceptedPaymentTypes.getTransactionType();
        if (transType.equals(transactionType)) {
            List<AcceptedPaymentType> paymentTypes = GetSavePaymentTypes(transType);
            List<AcceptedPaymentType> acceptedPaymentTypes = transactionAcceptedPaymentTypes.getAcceptedPaymentTypes();
            if ((acceptedPaymentTypes != null) && (acceptedPaymentTypes.size() > 0)) {
                for (PaymentTypes paymentType : PaymentTypes.values()) {
                    if (Find(paymentType, acceptedPaymentTypes) == false) {
                        AcceptedPaymentType acceptedPaymentType = new AcceptedPaymentType();
                        Short paymentTypeId = paymentType.getValue();
                        PaymentTypeEntity paymentTypeEntity = new PaymentTypeEntity(paymentTypeId);
                        acceptedPaymentType.setPaymentTypeEntity(paymentTypeEntity);
                        TransactionTypeEntity transactionEntity = new TransactionTypeEntity();
                        transactionEntity.setTransactionId(transType.getValue());
                        acceptedPaymentType.setTransactionTypeEntity(transactionEntity);
                        addAcceptedPaymentTypes.add(acceptedPaymentType);
                        paymentTypes.add(acceptedPaymentType);
                    }
                }
            }
        }
    }
}
Also used : PaymentTypes(org.mifos.application.master.util.helpers.PaymentTypes) TransactionAcceptedPaymentTypes(org.mifos.accounts.acceptedpaymenttype.persistence.helper.TransactionAcceptedPaymentTypes) PaymentTypeEntity(org.mifos.application.master.business.PaymentTypeEntity) AcceptedPaymentType(org.mifos.accounts.acceptedpaymenttype.business.AcceptedPaymentType) TransactionAcceptedPaymentTypes(org.mifos.accounts.acceptedpaymenttype.persistence.helper.TransactionAcceptedPaymentTypes) TrxnTypes(org.mifos.application.util.helpers.TrxnTypes) TransactionTypeEntity(org.mifos.accounts.acceptedpaymenttype.business.TransactionTypeEntity)

Example 2 with TransactionTypeEntity

use of org.mifos.accounts.acceptedpaymenttype.business.TransactionTypeEntity 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);
        }
    }
}
Also used : PaymentTypeEntity(org.mifos.application.master.business.PaymentTypeEntity) AcceptedPaymentType(org.mifos.accounts.acceptedpaymenttype.business.AcceptedPaymentType) AcceptedPaymentTypeDto(org.mifos.dto.domain.AcceptedPaymentTypeDto) PaymentTypeDto(org.mifos.dto.screen.PaymentTypeDto) TransactionTypeEntity(org.mifos.accounts.acceptedpaymenttype.business.TransactionTypeEntity)

Aggregations

AcceptedPaymentType (org.mifos.accounts.acceptedpaymenttype.business.AcceptedPaymentType)2 TransactionTypeEntity (org.mifos.accounts.acceptedpaymenttype.business.TransactionTypeEntity)2 PaymentTypeEntity (org.mifos.application.master.business.PaymentTypeEntity)2 TransactionAcceptedPaymentTypes (org.mifos.accounts.acceptedpaymenttype.persistence.helper.TransactionAcceptedPaymentTypes)1 PaymentTypes (org.mifos.application.master.util.helpers.PaymentTypes)1 TrxnTypes (org.mifos.application.util.helpers.TrxnTypes)1 AcceptedPaymentTypeDto (org.mifos.dto.domain.AcceptedPaymentTypeDto)1 PaymentTypeDto (org.mifos.dto.screen.PaymentTypeDto)1