public void createCashBasedJournalEntriesAndReversalsForSavingsTax(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 savingsId,final String transactionId,final Date transactionDate,final BigDecimal amount,final Boolean isReversal,final List<TaxPaymentDTO> taxDetails){
  for (  TaxPaymentDTO taxPaymentDTO : taxDetails) {
    if (taxPaymentDTO.getAmount() != null) {
      if (taxPaymentDTO.getCreditAccountId() == null) {
        createCashBasedCreditJournalEntriesAndReversalsForSavings(office,currencyCode,accountTypeToBeCredited.getValue(),savingsProductId,paymentTypeId,savingsId,transactionId,transactionDate,taxPaymentDTO.getAmount(),isReversal);
      }
 else {
        createCashBasedCreditJournalEntriesAndReversalsForSavings(office,currencyCode,taxPaymentDTO.getCreditAccountId(),savingsId,transactionId,transactionDate,taxPaymentDTO.getAmount(),isReversal);
      }
    }
  }
  createCashBasedDebitJournalEntriesAndReversalsForSavings(office,currencyCode,accountTypeToBeDebited.getValue(),savingsProductId,paymentTypeId,savingsId,transactionId,transactionDate,amount,isReversal);
}

public void createCashBasedJournalEntriesAndReversalsForSavingsTax ( 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 savingsId , final String transactionId , final Date transactionDate , final BigDecimal amount , final Boolean isReversal , final List < TaxPaymentDTO > taxDetails ) { for ( TaxPaymentDTO taxPaymentDTO : taxDetails ) { if ( taxPaymentDTO . getAmount ( ) != null ) { if ( taxPaymentDTO . getCreditAccountId ( ) == null ) { createCashBasedCreditJournalEntriesAndReversalsForSavings ( office , currencyCode , accountTypeToBeCredited . getValue ( ) , savingsProductId , paymentTypeId , savingsId , transactionId , transactionDate , taxPaymentDTO . getAmount ( ) , isReversal ) ; } else { createCashBasedCreditJournalEntriesAndReversalsForSavings ( office , currencyCode , taxPaymentDTO . getCreditAccountId ( ) , savingsId , transactionId , transactionDate , taxPaymentDTO . getAmount ( ) , isReversal ) ; } } } createCashBasedDebitJournalEntriesAndReversalsForSavings ( office , currencyCode , accountTypeToBeDebited . getValue ( ) , savingsProductId , paymentTypeId , savingsId , transactionId , transactionDate , amount , isReversal ) ; }
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
