GitHub PullRequestReviewCommentEvent at 2014-04-30 06:21:44
Repository: mifosx
Actor: vishwasbabu
Payload: {"comment":{"url":"https://api.github.com/repos/openMF/mifosx/pulls/comments/12129945","id":12129945,"diff_hunk":"@@ -203,6 +209,43 @@ private void createJournalEntriesForRepayments(final LoanDTO loanDTO, final Loan\n     }\n \n     /**\n+     * Create a single Debit to fund source and multiple credits if applicable\n+     * (loan portfolio for principal repayments, Interest on loans for interest\n+     * repayments, Income from fees for fees payment and Income from penalties\n+     * for penalty payment)\n+     *\n+     * In case the loan transaction is a reversal, all debits are turned into\n+     * credits and vice versa\n+     */\n+    private void createJournalEntriesForRecoveryRepayments(final LoanDTO loanDTO, final LoanTransactionDTO loanTransactionDTO, final Office office) {\n+        // loan properties\n+        final Long loanProductId = loanDTO.getLoanProductId();\n+        final Long loanId = loanDTO.getLoanId();\n+        final String currencyCode = loanDTO.getCurrencyCode();\n+\n+        // transaction properties\n+        final String transactionId = loanTransactionDTO.getTransactionId();\n+        final Date transactionDate = loanTransactionDTO.getTransactionDate();\n+        final BigDecimal recoveryPaymentAmount = loanTransactionDTO.getRecoveryPayment();\n+        final boolean isReversal = loanTransactionDTO.isReversed();\n+        final Long paymentTypeId = loanTransactionDTO.getPaymentTypeId();\n+\n+        BigDecimal totalDebitAmount = new BigDecimal(0);\n+\n+        if (recoveryPaymentAmount != null && !(recoveryPaymentAmount.compareTo(BigDecimal.ZERO) == 0)) {\n+            totalDebitAmount = totalDebitAmount.add(recoveryPaymentAmount);\n+            this.helper.createCreditJournalEntryOrReversalForLoan(office, currencyCode, CASH_ACCOUNTS_FOR_LOAN.INCOME_FROM_RECOVERY, loanProductId,\n+                    paymentTypeId, loanId, transactionId, transactionDate, recoveryPaymentAmount, isReversal);\n+        }\n+\n+        /*** create a single debit entry (or reversal) for the entire amount **/\n+        this.helper.createDebitJournalEntryOrReversalForLoan(office, currencyCode, CASH_ACCOUNTS_FOR_LOAN.FUND_SOURCE, loanProductId,\n+                paymentTypeId, loanId, transactionId, transactionDate, totalDebitAmount, isReversal);\n+    }\n+","path":"mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/CashBasedAccountingProcessorForLoan.java","position":59,"original_position":59,"commit_id":"ece7c9a60095af1c6389f229f037029ebaf2d64d","original_commit_id":"ece7c9a60095af1c6389f229f037029ebaf2d64d","user":{"login":"vishwasbabu","id":542697,"avatar_url":"https://avatars.githubusercontent.com/u/542697?","gravatar_id":"1a34f3c7bc67aec3890f9b58a8f61867","url":"https://api.github.com/users/vishwasbabu","html_url":"https://github.com/vishwasbabu","followers_url":"https://api.github.com/users/vishwasbabu/followers","following_url":"https://api.github.com/users/vishwasbabu/following{/other_user}","gists_url":"https://api.github.com/users/vishwasbabu/gists{/gist_id}","starred_url":"https://api.github.com/users/vishwasbabu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vishwasbabu/subscriptions","organizations_url":"https://api.github.com/users/vishwasbabu/orgs","repos_url":"https://api.github.com/users/vishwasbabu/repos","events_url":"https://api.github.com/users/vishwasbabu/events{/privacy}","received_events_url":"https://api.github.com/users/vishwasbabu/received_events","type":"User","site_admin":false},"body":"Should always create a Balanced Journal entry (atleast one debit and a credit). So If I have a check for recovery payment > 0, both the credit and debit should be within the check.\r\n\r\nIdeally the portfolio should not allow a recovery transaction which doe not have a recovery portion (so this check can be skipped entirely by the accounting processor)\r\n\r\n ","created_at":"2014-04-30T06:21:44Z","updated_at":"2014-04-30T06:21:44Z","html_url":"https://github.com/openMF/mifosx/pull/873#discussion_r12129945","pull_request_url":"https://api.github.com/repos/openMF/mifosx/pulls/873","_links":{"self":{"href":"https://api.github.com/repos/openMF/mifosx/pulls/comments/12129945"},"html":{"href":"https://github.com/openMF/mifosx/pull/873#discussion_r12129945"},"pull_request":{"href":"https://api.github.com/repos/openMF/mifosx/pulls/873"}}}}