budaidev commented on code in PR #5771:
URL: https://github.com/apache/fineract/pull/5771#discussion_r3225016722


##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/service/WorkingCapitalLoanAmortizationScheduleReadServiceImpl.java:
##########
@@ -36,21 +37,17 @@
 @Transactional(readOnly = true)
 public class WorkingCapitalLoanAmortizationScheduleReadServiceImpl implements 
WorkingCapitalLoanAmortizationScheduleReadService {
 
-    // TODO: currency should come from loan product once WCL lifecycle is 
implemented
-    private static final MonetaryCurrency DEFAULT_CURRENCY = new 
MonetaryCurrency("USD", 2, null);
-
     private final WorkingCapitalLoanRepository loanRepository;
     private final ProjectedAmortizationScheduleRepositoryWrapper 
scheduleRepositoryWrapper;
     private final ProjectedAmortizationScheduleMapper mapper;
 
     @Override
     public ProjectedAmortizationScheduleData 
retrieveAmortizationSchedule(final Long loanId) {
-        if (!loanRepository.existsById(loanId)) {
-            throw new WorkingCapitalLoanNotFoundException(loanId);
-        }
+        final WorkingCapitalLoan loan = 
loanRepository.findById(loanId).orElseThrow(() -> new 
WorkingCapitalLoanNotFoundException(loanId));
 
         final MathContext mc = MoneyHelper.getMathContext();
-        final ProjectedAmortizationScheduleModel model = 
scheduleRepositoryWrapper.readModel(loanId, mc, DEFAULT_CURRENCY)
+        final CurrencyData currency = 
WorkingCapitalLoanAmortizationScheduleWriteServiceImpl.resolveCurrency(loan);

Review Comment:
   refactored



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to