Search in sources :

Example 1 with FinancialActionConstants

use of org.mifos.accounts.financial.util.helpers.FinancialActionConstants in project head by mifos.

the class DepositAccountingEntryTest method testBuildAccountEntryDepositIntoVoluntarySavings.

@Test
public void testBuildAccountEntryDepositIntoVoluntarySavings() throws FinancialException {
    SavingsType savingsType = SavingsType.VOLUNTARY;
    GLCategoryType bankCategoryType = GLCategoryType.ASSET;
    GLCategoryType savingsCategoryType = GLCategoryType.LIABILITY;
    FinancialActionConstants financialActionConstant = FinancialActionConstants.VOLUNTARYDEPOSIT;
    setupVoluntaryForOneTest(savingsType, bankCategoryType, savingsCategoryType, financialActionConstant);
    doBuild(new DepositAccountingEntry(), mockedFinancialBusinessService, mockedFinancialActivity);
    // verify the two transactions created
    verifyCreatedTransactions(depositAmount, mockedFinancialActivity, mockedIncomingTransaction, mockedFinancialAction, mockedBankGLCode, mockedSavingsDepositGLCode, bankCategoryType, FinancialConstants.DEBIT, savingsCategoryType, FinancialConstants.CREDIT);
}
Also used : FinancialActionConstants(org.mifos.accounts.financial.util.helpers.FinancialActionConstants) GLCategoryType(org.mifos.accounts.financial.business.GLCategoryType) SavingsType(org.mifos.accounts.productdefinition.util.helpers.SavingsType) Test(org.junit.Test)

Example 2 with FinancialActionConstants

use of org.mifos.accounts.financial.util.helpers.FinancialActionConstants in project head by mifos.

the class InterestPostingAccountingEntryTest method setupAndInjectMocks.

@Before
public void setupAndInjectMocks() {
    // Build a little Chart of Accounts
    coaLiability = makeCategory((short) 1, GLCategoryType.LIABILITY, "22000");
    coaSavingsInterestPayable = makeChildCoaboOf(coaLiability, (short) 2, "SavingsInterest Payable", "22100");
    coaClientsSavings = makeChildCoaboOf(coaLiability, (short) 3, "ClientsSavings", "22200");
    interestPostingAccountingEntry = new InterestPostingAccountingEntry() {

        @Override
        protected FinancialActionTypeEntity getFinancialAction(@SuppressWarnings("unused") final FinancialActionConstants financialActionId) throws FinancialException {
            return financialAction;
        }

        @Override
        protected COABO getChartOfAccountsEntry(final String glcode) throws FinancialException {
            if (glcode.equals("22000")) {
                return coaLiability;
            } else if (glcode.equals("22100")) {
                return coaSavingsInterestPayable;
            } else if (glcode.equals("22200")) {
                return coaClientsSavings;
            } else {
                throw new FinancialException("unexpected glcode: " + glcode);
            }
        }
    };
}
Also used : FinancialActionConstants(org.mifos.accounts.financial.util.helpers.FinancialActionConstants) FinancialActionTypeEntity(org.mifos.accounts.financial.business.FinancialActionTypeEntity) COABO(org.mifos.accounts.financial.business.COABO) FinancialException(org.mifos.accounts.financial.exceptions.FinancialException) Before(org.junit.Before)

Example 3 with FinancialActionConstants

use of org.mifos.accounts.financial.util.helpers.FinancialActionConstants in project head by mifos.

the class DepositAccountingEntryTest method testBuildAccountEntryDepositIntoMandatorySavings.

@Test
public void testBuildAccountEntryDepositIntoMandatorySavings() throws FinancialException {
    SavingsType savingsType = SavingsType.MANDATORY;
    GLCategoryType bankCategoryType = GLCategoryType.ASSET;
    GLCategoryType savingsCategoryType = GLCategoryType.LIABILITY;
    FinancialActionConstants financialActionConstant = FinancialActionConstants.MANDATORYDEPOSIT;
    setupMandatoryForOneTest(savingsType, bankCategoryType, savingsCategoryType, financialActionConstant);
    doBuild(new DepositAccountingEntry(), mockedFinancialBusinessService, mockedFinancialActivity);
    verifyCreatedTransactions(depositAmount, mockedFinancialActivity, mockedIncomingTransaction, mockedFinancialAction, mockedBankGLCode, mockedSavingsDepositGLCode, bankCategoryType, FinancialConstants.DEBIT, savingsCategoryType, FinancialConstants.CREDIT);
}
Also used : FinancialActionConstants(org.mifos.accounts.financial.util.helpers.FinancialActionConstants) GLCategoryType(org.mifos.accounts.financial.business.GLCategoryType) SavingsType(org.mifos.accounts.productdefinition.util.helpers.SavingsType) Test(org.junit.Test)

Example 4 with FinancialActionConstants

use of org.mifos.accounts.financial.util.helpers.FinancialActionConstants in project head by mifos.

the class SavingsCloseTest method setupChartOfAccountsAndFinancialTransactions.

@BeforeClass
public static void setupChartOfAccountsAndFinancialTransactions() {
    defaultCurrency = TestUtils.RUPEE;
    Money.setDefaultCurrency(defaultCurrency);
    Short glcodeId = Short.valueOf("1");
    String glcode = "123456";
    GLCodeEntity glCodeEntity = new GLCodeEntity(glcodeId, glcode);
    COABO coabo = new COABO("testAccountName", glCodeEntity);
    ChartOfAccountsCache chartOfAccountsCache = new ChartOfAccountsCache();
    chartOfAccountsCache.clear();
    chartOfAccountsCache.add(coabo);
    Map<FinancialActionConstants, String> actionToCreditAccount = new HashMap<FinancialActionConstants, String>();
    actionToCreditAccount.put(FinancialActionConstants.SAVINGS_INTERESTPOSTING, glcode);
    actionToCreditAccount.put(FinancialActionConstants.MANDATORYDEPOSIT, glcode);
    actionToCreditAccount.put(FinancialActionConstants.MANDATORYWITHDRAWAL, glcode);
    actionToCreditAccount.put(FinancialActionConstants.MANDATORYDEPOSIT_ADJUSTMENT, glcode);
    actionToCreditAccount.put(FinancialActionConstants.MANDATORYWITHDRAWAL_ADJUSTMENT, glcode);
    actionToCreditAccount.put(FinancialActionConstants.ROUNDING, glcode);
    FinancialRules.getInstance().setActionToCreditAccount(actionToCreditAccount);
    Map<FinancialActionConstants, String> actionToDebitAccount = new HashMap<FinancialActionConstants, String>();
    actionToDebitAccount.put(FinancialActionConstants.SAVINGS_INTERESTPOSTING, glcode);
    actionToDebitAccount.put(FinancialActionConstants.MANDATORYDEPOSIT, glcode);
    actionToDebitAccount.put(FinancialActionConstants.MANDATORYWITHDRAWAL, glcode);
    actionToDebitAccount.put(FinancialActionConstants.MANDATORYDEPOSIT_ADJUSTMENT, glcode);
    actionToDebitAccount.put(FinancialActionConstants.MANDATORYWITHDRAWAL_ADJUSTMENT, glcode);
    actionToDebitAccount.put(FinancialActionConstants.ROUNDING, glcode);
    FinancialRules.getInstance().setActionToDebitAccount(actionToDebitAccount);
    FinancialActionTypeEntity roundingAction = new FinancialActionTypeEntity();
    roundingAction.setId(FinancialActionConstants.ROUNDING.getValue());
    FinancialActionTypeEntity depositAction = new FinancialActionTypeEntity();
    depositAction.setId(FinancialActionConstants.MANDATORYDEPOSIT.getValue());
    FinancialActionTypeEntity withdrawalAction = new FinancialActionTypeEntity();
    withdrawalAction.setId(FinancialActionConstants.MANDATORYWITHDRAWAL.getValue());
    FinancialActionTypeEntity depositAdjustmentAction = new FinancialActionTypeEntity();
    depositAdjustmentAction.setId(FinancialActionConstants.MANDATORYDEPOSIT_ADJUSTMENT.getValue());
    FinancialActionTypeEntity withdrawalAdjustmentAction = new FinancialActionTypeEntity();
    withdrawalAdjustmentAction.setId(FinancialActionConstants.MANDATORYWITHDRAWAL_ADJUSTMENT.getValue());
    FinancialActionTypeEntity interestPostingAction = new FinancialActionTypeEntity();
    interestPostingAction.setId(FinancialActionConstants.SAVINGS_INTERESTPOSTING.getValue());
    FinancialActionCache.addToCache(depositAction);
    FinancialActionCache.addToCache(withdrawalAction);
    FinancialActionCache.addToCache(depositAdjustmentAction);
    FinancialActionCache.addToCache(withdrawalAdjustmentAction);
    FinancialActionCache.addToCache(interestPostingAction);
    FinancialActionCache.addToCache(roundingAction);
}
Also used : FinancialActionConstants(org.mifos.accounts.financial.util.helpers.FinancialActionConstants) FinancialActionTypeEntity(org.mifos.accounts.financial.business.FinancialActionTypeEntity) HashMap(java.util.HashMap) ChartOfAccountsCache(org.mifos.accounts.financial.util.helpers.ChartOfAccountsCache) COABO(org.mifos.accounts.financial.business.COABO) GLCodeEntity(org.mifos.accounts.financial.business.GLCodeEntity) BeforeClass(org.junit.BeforeClass)

Example 5 with FinancialActionConstants

use of org.mifos.accounts.financial.util.helpers.FinancialActionConstants in project head by mifos.

the class SavingsAdjustmentTest method setupChartOfAccountsAndFinancialTransactions.

@BeforeClass
public static void setupChartOfAccountsAndFinancialTransactions() {
    defaultCurrency = TestUtils.RUPEE;
    Money.setDefaultCurrency(defaultCurrency);
    Short glcodeId = Short.valueOf("1");
    String glcode = "123456";
    GLCodeEntity glCodeEntity = new GLCodeEntity(glcodeId, glcode);
    COABO coabo = new COABO("testAccountName", glCodeEntity);
    ChartOfAccountsCache chartOfAccountsCache = new ChartOfAccountsCache();
    chartOfAccountsCache.clear();
    chartOfAccountsCache.add(coabo);
    Map<FinancialActionConstants, String> actionToCreditAccount = new HashMap<FinancialActionConstants, String>();
    actionToCreditAccount.put(FinancialActionConstants.MANDATORYDEPOSIT, glcode);
    actionToCreditAccount.put(FinancialActionConstants.MANDATORYWITHDRAWAL, glcode);
    actionToCreditAccount.put(FinancialActionConstants.MANDATORYDEPOSIT_ADJUSTMENT, glcode);
    actionToCreditAccount.put(FinancialActionConstants.MANDATORYWITHDRAWAL_ADJUSTMENT, glcode);
    FinancialRules.getInstance().setActionToCreditAccount(actionToCreditAccount);
    Map<FinancialActionConstants, String> actionToDebitAccount = new HashMap<FinancialActionConstants, String>();
    actionToDebitAccount.put(FinancialActionConstants.MANDATORYDEPOSIT, glcode);
    actionToDebitAccount.put(FinancialActionConstants.MANDATORYWITHDRAWAL, glcode);
    actionToDebitAccount.put(FinancialActionConstants.MANDATORYDEPOSIT_ADJUSTMENT, glcode);
    actionToDebitAccount.put(FinancialActionConstants.MANDATORYWITHDRAWAL_ADJUSTMENT, glcode);
    FinancialRules.getInstance().setActionToDebitAccount(actionToDebitAccount);
    FinancialActionTypeEntity depositAction = new FinancialActionTypeEntity();
    depositAction.setId(FinancialActionConstants.MANDATORYDEPOSIT.getValue());
    FinancialActionTypeEntity withdrawalAction = new FinancialActionTypeEntity();
    withdrawalAction.setId(FinancialActionConstants.MANDATORYWITHDRAWAL.getValue());
    FinancialActionTypeEntity depositAdjustmentAction = new FinancialActionTypeEntity();
    depositAdjustmentAction.setId(FinancialActionConstants.MANDATORYDEPOSIT_ADJUSTMENT.getValue());
    FinancialActionTypeEntity withdrawalAdjustmentAction = new FinancialActionTypeEntity();
    withdrawalAdjustmentAction.setId(FinancialActionConstants.MANDATORYWITHDRAWAL_ADJUSTMENT.getValue());
    FinancialActionCache.addToCache(depositAction);
    FinancialActionCache.addToCache(withdrawalAction);
    FinancialActionCache.addToCache(depositAdjustmentAction);
    FinancialActionCache.addToCache(withdrawalAdjustmentAction);
}
Also used : FinancialActionConstants(org.mifos.accounts.financial.util.helpers.FinancialActionConstants) FinancialActionTypeEntity(org.mifos.accounts.financial.business.FinancialActionTypeEntity) HashMap(java.util.HashMap) ChartOfAccountsCache(org.mifos.accounts.financial.util.helpers.ChartOfAccountsCache) COABO(org.mifos.accounts.financial.business.COABO) GLCodeEntity(org.mifos.accounts.financial.business.GLCodeEntity) BeforeClass(org.junit.BeforeClass)

Aggregations

FinancialActionConstants (org.mifos.accounts.financial.util.helpers.FinancialActionConstants)5 COABO (org.mifos.accounts.financial.business.COABO)3 FinancialActionTypeEntity (org.mifos.accounts.financial.business.FinancialActionTypeEntity)3 HashMap (java.util.HashMap)2 BeforeClass (org.junit.BeforeClass)2 Test (org.junit.Test)2 GLCategoryType (org.mifos.accounts.financial.business.GLCategoryType)2 GLCodeEntity (org.mifos.accounts.financial.business.GLCodeEntity)2 ChartOfAccountsCache (org.mifos.accounts.financial.util.helpers.ChartOfAccountsCache)2 SavingsType (org.mifos.accounts.productdefinition.util.helpers.SavingsType)2 Before (org.junit.Before)1 FinancialException (org.mifos.accounts.financial.exceptions.FinancialException)1