Abhishek Chaudhary created FINERACT-2908:
--------------------------------------------

             Summary: Post Interest For Savings job does not withhold tax on 
posted interest
                 Key: FINERACT-2908
                 URL: https://issues.apache.org/jira/browse/FINERACT-2908
             Project: Apache Fineract
          Issue Type: Improvement
            Reporter: Abhishek Chaudhary


The scheduled *Post Interest For Savings* job never withholds tax. For a 
savings account with withhold tax enabled, the job credits the full interest, 
creates no withhold-tax transaction and books no tax liability. Posting 
interest manually through the API (command=postInterest) on the same account 
does withhold tax.

*Cause*
The job loads accounts through {{SavingAccountMapperForInterestPosting}}, which 
builds the tax group with {{TaxGroupData.lookup(taxGroupId, null)}}. That 
leaves the tax associations {{null}}, so 
{{SavingsAccountInterestPostingServiceImpl.createWithHoldTransaction}} returns 
without creating a transaction. The manual path uses the {{SavingsAccount}} 
entity, whose tax group has its mappings, so it works.

The same guard affects re-posting: when the job corrects an interest posting 
for a period that already had tax withheld, it reverses the old withhold-tax 
transaction and creates no replacement.

*Steps to reproduce*
# Create a tax group (e.g. 10%) and a savings product with withhold tax enabled 
and that tax group.
# Activate an account, deposit, and let interest accrue for a posting period.
# Run the Post Interest For Savings job.
# Expected: a withhold-tax transaction for 10% of the interest, and journal 
entries debiting Savings Control and crediting the tax component's account. 
Actual: neither.

*What a fix needs*
* Load the tax group's components (percentage, validity dates, credit account) 
for the job.
* Insert the withhold-tax transaction and its 
{{m_savings_account_transaction_tax_details}} rows in the job's batch insert.
* Book Savings Control against each tax component's credit account, as 
{{CashBasedAccountingProcessorForSavings}} and 
{{AccrualBasedAccountingProcessorForSavings}} do. 
{{SavingsSchedularInterestPoster.batchUpdateJournalEntries}} writes one 
debit/credit pair per transaction, so it needs to support one credit per tax 
component.

Found while reviewing FINERACT-2705 (PR #6174).




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to