@@ -80,12 +80,12 @@ public class DepositAccountDomainServiceJpa implements DepositAccountDomainServi
8080
8181 @ Autowired
8282 public DepositAccountDomainServiceJpa (final SavingsAccountRepositoryWrapper savingsAccountRepository ,
83- final JournalEntryWritePlatformService journalEntryWritePlatformService , final AccountNumberGenerator accountNumberGenerator ,
84- final DepositAccountAssembler depositAccountAssembler , final SavingsAccountDomainService savingsAccountDomainService ,
85- final AccountTransfersWritePlatformService accountTransfersWritePlatformService ,
86- final ConfigurationDomainService configurationDomainService ,
87- final AccountNumberFormatRepositoryWrapper accountNumberFormatRepository ,
88- final CalendarInstanceRepository calendarInstanceRepository ) {
83+ final JournalEntryWritePlatformService journalEntryWritePlatformService , final AccountNumberGenerator accountNumberGenerator ,
84+ final DepositAccountAssembler depositAccountAssembler , final SavingsAccountDomainService savingsAccountDomainService ,
85+ final AccountTransfersWritePlatformService accountTransfersWritePlatformService ,
86+ final ConfigurationDomainService configurationDomainService ,
87+ final AccountNumberFormatRepositoryWrapper accountNumberFormatRepository ,
88+ final CalendarInstanceRepository calendarInstanceRepository ) {
8989 this .savingsAccountRepository = savingsAccountRepository ;
9090 this .journalEntryWritePlatformService = journalEntryWritePlatformService ;
9191 this .accountNumberGenerator = accountNumberGenerator ;
@@ -100,8 +100,8 @@ public DepositAccountDomainServiceJpa(final SavingsAccountRepositoryWrapper savi
100100 @ Transactional
101101 @ Override
102102 public SavingsAccountTransaction handleWithdrawal (final SavingsAccount account , final DateTimeFormatter fmt ,
103- final LocalDate transactionDate , final BigDecimal transactionAmount , final PaymentDetail paymentDetail ,
104- final boolean applyWithdrawFee , final boolean isRegularTransaction ) {
103+ final LocalDate transactionDate , final BigDecimal transactionAmount , final PaymentDetail paymentDetail ,
104+ final boolean applyWithdrawFee , final boolean isRegularTransaction ) {
105105 boolean isAccountTransfer = false ;
106106 boolean isInterestTransfer = false ;
107107 boolean isWithdrawBalance = false ;
@@ -115,7 +115,7 @@ public SavingsAccountTransaction handleWithdrawal(final SavingsAccount account,
115115 @ Transactional
116116 @ Override
117117 public SavingsAccountTransaction handleFDDeposit (final FixedDepositAccount account , final DateTimeFormatter fmt ,
118- final LocalDate transactionDate , final BigDecimal transactionAmount , final PaymentDetail paymentDetail ) {
118+ final LocalDate transactionDate , final BigDecimal transactionAmount , final PaymentDetail paymentDetail ) {
119119 boolean isAccountTransfer = false ;
120120 boolean isRegularTransaction = false ;
121121 final boolean backdatedTxnsAllowedTill = false ;
@@ -126,8 +126,8 @@ public SavingsAccountTransaction handleFDDeposit(final FixedDepositAccount accou
126126 @ Transactional
127127 @ Override
128128 public SavingsAccountTransaction handleRDDeposit (final RecurringDepositAccount account , final DateTimeFormatter fmt ,
129- final LocalDate transactionDate , final BigDecimal transactionAmount , final PaymentDetail paymentDetail ,
130- final boolean isRegularTransaction ) {
129+ final LocalDate transactionDate , final BigDecimal transactionAmount , final PaymentDetail paymentDetail ,
130+ final boolean isRegularTransaction ) {
131131 final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this .configurationDomainService
132132 .isSavingsInterestPostingAtCurrentPeriodEnd ();
133133 final Integer financialYearBeginningMonth = this .configurationDomainService .retrieveFinancialYearBeginningMonth ();
@@ -159,8 +159,8 @@ public SavingsAccountTransaction handleRDDeposit(final RecurringDepositAccount a
159159 @ Transactional
160160 @ Override
161161 public SavingsAccountTransaction handleSavingDeposit (final SavingsAccount account , final DateTimeFormatter fmt ,
162- final LocalDate transactionDate , final BigDecimal transactionAmount , final PaymentDetail paymentDetail ,
163- final boolean isRegularTransaction ) {
162+ final LocalDate transactionDate , final BigDecimal transactionAmount , final PaymentDetail paymentDetail ,
163+ final boolean isRegularTransaction ) {
164164 boolean isAccountTransfer = false ;
165165 final boolean backdatedTxnsAllowedTill = false ;
166166 final SavingsAccountTransaction deposit = this .savingsAccountDomainService .handleDeposit (account , fmt , transactionDate ,
@@ -185,7 +185,7 @@ private boolean isAnyActivationChargesDue(final RecurringDepositAccount account)
185185 @ Transactional
186186 @ Override
187187 public Long handleFDAccountClosure (final FixedDepositAccount account , final PaymentDetail paymentDetail , final AppUser user ,
188- final JsonCommand command , final Map <String , Object > changes ) {
188+ final JsonCommand command , final Map <String , Object > changes ) {
189189 final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this .configurationDomainService
190190 .isSavingsInterestPostingAtCurrentPeriodEnd ();
191191 final Integer financialYearBeginningMonth = this .configurationDomainService .retrieveFinancialYearBeginningMonth ();
@@ -214,7 +214,6 @@ public Long handleFDAccountClosure(final FixedDepositAccount account, final Paym
214214 account .postMaturityInterest (isSavingsInterestPostingAtCurrentPeriodEnd , financialYearBeginningMonth );
215215 final Integer onAccountClosureId = command .integerValueOfParameterNamed (onAccountClosureIdParamName );
216216 final DepositAccountOnClosureType onClosureType = DepositAccountOnClosureType .fromInt (onAccountClosureId );
217- account .setClosedOnDate (closedDate );
218217 if (onClosureType .isReinvest ()) {
219218 FixedDepositAccount reinvestedDeposit = account .reInvest (account .getAccountBalance ());
220219 this .depositAccountAssembler .assignSavingAccountHelpers (reinvestedDeposit );
@@ -253,8 +252,8 @@ public Long handleFDAccountClosure(final FixedDepositAccount account, final Paym
253252 @ Transactional
254253 @ Override
255254 public Long handleFDAccountMaturityClosure (final FixedDepositAccount account , final PaymentDetail paymentDetail , final AppUser user ,
256- final DateTimeFormatter fmt , final LocalDate closedDate , final Integer onAccountClosureId , final Long toSavingsId ,
257- final String transferDescription , Map <String , Object > changes ) {
255+ final DateTimeFormatter fmt , final LocalDate closedDate , final Integer onAccountClosureId , final Long toSavingsId ,
256+ final String transferDescription , Map <String , Object > changes ) {
258257
259258 final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this .configurationDomainService
260259 .isSavingsInterestPostingAtCurrentPeriodEnd ();
@@ -274,7 +273,7 @@ public Long handleFDAccountMaturityClosure(final FixedDepositAccount account, fi
274273 Long savingsTransactionId = null ;
275274 account .postMaturityInterest (isSavingsInterestPostingAtCurrentPeriodEnd , financialYearBeginningMonth );
276275 final DepositAccountOnClosureType onClosureType = DepositAccountOnClosureType .fromInt (onAccountClosureId );
277- if (onClosureType .isReinvest () && account . getClosedOnDate () != null ) {
276+ if (onClosureType .isReinvest ()) {
278277 BigDecimal reInvestAmount ;
279278 if (onClosureType .isReinvestPrincipal ()) {
280279 reInvestAmount = account .getDepositAmount ();
@@ -331,7 +330,7 @@ public Long handleFDAccountMaturityClosure(final FixedDepositAccount account, fi
331330 @ Transactional
332331 @ Override
333332 public Long handleRDAccountClosure (final RecurringDepositAccount account , final PaymentDetail paymentDetail , final AppUser user ,
334- final JsonCommand command , final Map <String , Object > changes ) {
333+ final JsonCommand command , final Map <String , Object > changes ) {
335334
336335 final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this .configurationDomainService
337336 .isSavingsInterestPostingAtCurrentPeriodEnd ();
@@ -368,7 +367,6 @@ public Long handleRDAccountClosure(final RecurringDepositAccount account, final
368367 this .calendarInstanceRepository .save (calendarInstance );
369368 final Calendar calendar = calendarInstance .getCalendar ();
370369 final PeriodFrequencyType frequencyType = CalendarFrequencyType .from (CalendarUtils .getFrequency (calendar .getRecurrence ()));
371- final Long relaxingDaysConfigForPivotDate = this .configurationDomainService .retrieveRelaxingDaysConfigForPivotDate ();
372370 Integer frequency = CalendarUtils .getInterval (calendar .getRecurrence ());
373371 frequency = frequency == -1 ? 1 : frequency ;
374372 reinvestedDeposit .generateSchedule (frequencyType , frequency , calendar );
@@ -383,14 +381,9 @@ public Long handleRDAccountClosure(final RecurringDepositAccount account, final
383381 savingsTransactionId = withdrawal .getId ();
384382
385383 } else if (onClosureType .isTransferToSavings ()) {
386- final Long toSavingsId = command .longValueOfParameterNamed (toSavingsAccountIdParamName ) != null
387- ? command .longValueOfParameterNamed (toSavingsAccountIdParamName )
388- : command .getSavingsId ();
389- ;
390- final SavingsAccount SavingsAccount = this .depositAccountAssembler .assembleFrom (toSavingsId ,
391- DepositAccountType .RECURRING_DEPOSIT );
384+ final Long toSavingsId = command .longValueOfParameterNamed (toSavingsAccountIdParamName );
392385 final String transferDescription = command .stringValueOfParameterNamed (transferDescriptionParamName );
393- final SavingsAccount toSavingsAccount = this .depositAccountAssembler .getClientSavingAccount ( SavingsAccount . getClient (). getId () ,
386+ final SavingsAccount toSavingsAccount = this .depositAccountAssembler .assembleFrom ( toSavingsId ,
394387 DepositAccountType .SAVINGS_DEPOSIT );
395388 final boolean isExceptionForBalanceCheck = false ;
396389 final AccountTransferDTO accountTransferDTO = new AccountTransferDTO (closedDate , transactionAmount ,
@@ -450,7 +443,7 @@ private void autoGenerateAccountNumber(final SavingsAccount account) {
450443 @ Transactional
451444 @ Override
452445 public Long handleFDAccountPreMatureClosure (final FixedDepositAccount account , final PaymentDetail paymentDetail , final AppUser user ,
453- final JsonCommand command , final Map <String , Object > changes ) {
446+ final JsonCommand command , final Map <String , Object > changes ) {
454447
455448 final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this .configurationDomainService
456449 .isSavingsInterestPostingAtCurrentPeriodEnd ();
@@ -505,7 +498,7 @@ public Long handleFDAccountPreMatureClosure(final FixedDepositAccount account, f
505498 @ Transactional
506499 @ Override
507500 public Long handleRDAccountPreMatureClosure (final RecurringDepositAccount account , final PaymentDetail paymentDetail ,
508- final AppUser user , final JsonCommand command , final Map <String , Object > changes ) {
501+ final AppUser user , final JsonCommand command , final Map <String , Object > changes ) {
509502
510503 final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this .configurationDomainService
511504 .isSavingsInterestPostingAtCurrentPeriodEnd ();
@@ -557,13 +550,13 @@ public Long handleRDAccountPreMatureClosure(final RecurringDepositAccount accoun
557550 }
558551
559552 private void updateExistingTransactionsDetails (SavingsAccount account , Set <Long > existingTransactionIds ,
560- Set <Long > existingReversedTransactionIds ) {
553+ Set <Long > existingReversedTransactionIds ) {
561554 existingTransactionIds .addAll (account .findExistingTransactionIds ());
562555 existingReversedTransactionIds .addAll (account .findExistingReversedTransactionIds ());
563556 }
564557
565558 private void postJournalEntries (final SavingsAccount savingsAccount , final Set <Long > existingTransactionIds ,
566- final Set <Long > existingReversedTransactionIds , boolean isAccountTransfer ) {
559+ final Set <Long > existingReversedTransactionIds , boolean isAccountTransfer ) {
567560
568561 final boolean backdatedTxnsAllowedTill = false ;
569562
@@ -584,4 +577,4 @@ private void updateAlreadyPostedTransactions(final Set<Long> existingTransaction
584577 }
585578 }
586579 }
587- }
580+ }
0 commit comments