Adam Saghy created FINERACT-2406:
------------------------------------

             Summary: Null resourceExternalId On Backbook Loan Transactions
                 Key: FINERACT-2406
                 URL: https://issues.apache.org/jira/browse/FINERACT-2406
             Project: Apache Fineract
          Issue Type: Bug
    Affects Versions: 1.13.0
            Reporter: Adam Saghy
            Assignee: Adam Saghy


When creating a backbook loan that undergoes charge-off followed by an interest 
payment waiver transaction, the charge-off processing requires creating missing 
accrual transactions. This triggers a database query to check if external ID 
auto-generation is enabled (calls [this 
method|https://github.com/apache/fineract/blob/d21a1a98a29e4910b834bc74bcac3eee866d59f4/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/GlobalConfigurationRepositoryWrapper.java#L44-L51]).
 This query causes a premature flush of pending entities. This causes the 
interest waiver to be committed to the DB, which populates a transaction ID. 
This causes the new transaction to be treated as existing ([see 
here|https://github.com/apache/fineract/blob/d21a1a98a29e4910b834bc74bcac3eee866d59f4/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/impl/AdvancedPaymentScheduleTransactionProcessor.java#L1094]),
 and clears the external ID ([see 
here|https://github.com/apache/fineract/blob/d21a1a98a29e4910b834bc74bcac3eee866d59f4/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/impl/AdvancedPaymentScheduleTransactionProcessor.java#L1220]).
 The batch call fails on the GET transaction request (after the interest 
payment waiver) because of the missing resourceExternalId (missing [at this 
point|https://github.com/apache/fineract/blob/d21a1a98a29e4910b834bc74bcac3eee866d59f4/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java#L1055]).
 The flow:
 * Interest waiver created (id=null) → charge-off processing queries config DB 
→ auto-flush fires → waiver gets ID → reprocessing treats it as "existing" → 
external ID cleared on old one, new transaction is created, but the old one is 
returned as result → GET transaction fails due to missing resourceExternalId.



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

Reply via email to