public void createCashBasedJournalEntriesAndReversalsForSavingsCharges(final Office office,final String currencyCode,final CASH_ACCOUNTS_FOR_SAVINGS accountTypeToBeDebited,final CASH_ACCOUNTS_FOR_SAVINGS accountTypeToBeCredited,final Long savingsProductId,final Long paymentTypeId,final Long loanId,final String transactionId,final Date transactionDate,final BigDecimal totalAmount,final Boolean isReversal,final List<ChargePaymentDTO> chargePaymentDTOs){
  if (chargePaymentDTOs.size() != 1) {
    throw new PlatformDataIntegrityException("Recent Portfolio changes w.r.t Charges for Savings have Broken the accounting code","Recent Portfolio changes w.r.t Charges for Savings have Broken the accounting code");
  }
  ChargePaymentDTO chargePaymentDTO=chargePaymentDTOs.get(0);
  final GLAccount chargeSpecificAccount=getLinkedGLAccountForSavingsCharges(savingsProductId,accountTypeToBeCredited.getValue(),chargePaymentDTO.getChargeId());
  final GLAccount savingsControlAccount=getLinkedGLAccountForSavingsProduct(savingsProductId,accountTypeToBeDebited.getValue(),paymentTypeId);
  if (isReversal) {
    createDebitJournalEntryForSavings(office,currencyCode,chargeSpecificAccount,loanId,transactionId,transactionDate,totalAmount);
    createCreditJournalEntryForSavings(office,currencyCode,savingsControlAccount,loanId,transactionId,transactionDate,totalAmount);
  }
 else {
    createDebitJournalEntryForSavings(office,currencyCode,savingsControlAccount,loanId,transactionId,transactionDate,totalAmount);
    createCreditJournalEntryForSavings(office,currencyCode,chargeSpecificAccount,loanId,transactionId,transactionDate,totalAmount);
  }
}

public void createCashBasedJournalEntriesAndReversalsForSavingsCharges ( final Office office , final String currencyCode , final CASH_ACCOUNTS_FOR_SAVINGS accountTypeToBeDebited , final CASH_ACCOUNTS_FOR_SAVINGS accountTypeToBeCredited , final Long savingsProductId , final Long paymentTypeId , final Long loanId , final String transactionId , final Date transactionDate , final BigDecimal totalAmount , final Boolean isReversal , final List < ChargePaymentDTO > chargePaymentDTOs ) { if ( chargePaymentDTOs . size ( ) != 1 ) { throw new PlatformDataIntegrityException ( "Recent Portfolio changes w.r.t Charges for Savings have Broken the accounting code" , "Recent Portfolio changes w.r.t Charges for Savings have Broken the accounting code" ) ; } ChargePaymentDTO chargePaymentDTO = chargePaymentDTOs . get ( 0 ) ; final GLAccount chargeSpecificAccount = getLinkedGLAccountForSavingsCharges ( savingsProductId , accountTypeToBeCredited . getValue ( ) , chargePaymentDTO . getChargeId ( ) ) ; final GLAccount savingsControlAccount = getLinkedGLAccountForSavingsProduct ( savingsProductId , accountTypeToBeDebited . getValue ( ) , paymentTypeId ) ; if ( isReversal ) { createDebitJournalEntryForSavings ( office , currencyCode , chargeSpecificAccount , loanId , transactionId , transactionDate , totalAmount ) ; createCreditJournalEntryForSavings ( office , currencyCode , savingsControlAccount , loanId , transactionId , transactionDate , totalAmount ) ; } else { createDebitJournalEntryForSavings ( office , currencyCode , savingsControlAccount , loanId , transactionId , transactionDate , totalAmount ) ; createCreditJournalEntryForSavings ( office , currencyCode , chargeSpecificAccount , loanId , transactionId , transactionDate , totalAmount ) ; } }
convenience method that creates a pair of related debits and credits for cash based accounting . the target accounts for debits and credits are switched in case of a reversal
