Search in sources :

Example 1 with TransactionAcceptedPaymentTypes

use of org.mifos.accounts.acceptedpaymenttype.persistence.helper.TransactionAcceptedPaymentTypes 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 TransactionAcceptedPaymentTypes

use of org.mifos.accounts.acceptedpaymenttype.persistence.helper.TransactionAcceptedPaymentTypes in project head by mifos.

the class AcceptedPaymentTypePersistenceIntegrationTest method testGetAcceptedPaymentTypes.

@Test
public void testGetAcceptedPaymentTypes() throws Exception {
    // get all accepted payment types and store in
    // currentAcceptedPaymentTypes
    currentAcceptedPaymentTypes = new ArrayList<TransactionAcceptedPaymentTypes>();
    allAcceptedPaymentTypes = new ArrayList<TransactionAcceptedPaymentTypes>();
    for (TrxnTypes transactionType : TrxnTypes.values()) {
        List<AcceptedPaymentType> acceptedPaymentTypes = legacyAcceptedPaymentTypeDao.getAcceptedPaymentTypesForATransaction(transactionType.getValue(), TrxnTypes.loan_repayment);
        TransactionAcceptedPaymentTypes transactionAcceptedPaymentTypes = new TransactionAcceptedPaymentTypes();
        transactionAcceptedPaymentTypes.setAcceptedPaymentTypes(acceptedPaymentTypes);
        transactionAcceptedPaymentTypes.setTransactionType(transactionType);
        currentAcceptedPaymentTypes.add(transactionAcceptedPaymentTypes);
        TransactionAcceptedPaymentTypes transactionAcceptedPaymentTypes2 = new TransactionAcceptedPaymentTypes();
        List<AcceptedPaymentType> acceptedPaymentTypes2 = new ArrayList<AcceptedPaymentType>(acceptedPaymentTypes);
        transactionAcceptedPaymentTypes2.setAcceptedPaymentTypes(acceptedPaymentTypes2);
        transactionAcceptedPaymentTypes2.setTransactionType(transactionType);
        allAcceptedPaymentTypes.add(transactionAcceptedPaymentTypes2);
    }
}
Also used : AcceptedPaymentType(org.mifos.accounts.acceptedpaymenttype.business.AcceptedPaymentType) TransactionAcceptedPaymentTypes(org.mifos.accounts.acceptedpaymenttype.persistence.helper.TransactionAcceptedPaymentTypes) TrxnTypes(org.mifos.application.util.helpers.TrxnTypes) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Aggregations

AcceptedPaymentType (org.mifos.accounts.acceptedpaymenttype.business.AcceptedPaymentType)2 TransactionAcceptedPaymentTypes (org.mifos.accounts.acceptedpaymenttype.persistence.helper.TransactionAcceptedPaymentTypes)2 TrxnTypes (org.mifos.application.util.helpers.TrxnTypes)2 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1 TransactionTypeEntity (org.mifos.accounts.acceptedpaymenttype.business.TransactionTypeEntity)1 PaymentTypeEntity (org.mifos.application.master.business.PaymentTypeEntity)1 PaymentTypes (org.mifos.application.master.util.helpers.PaymentTypes)1