fixing batch job failures
This commit is contained in:
+11
@@ -12,6 +12,17 @@ public interface PlatformSecurityContext {
|
|||||||
|
|
||||||
AppUser authenticatedUser();
|
AppUser authenticatedUser();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convenience method returns null (does not throw an exception) if an
|
||||||
|
* authenticated user is not present
|
||||||
|
*
|
||||||
|
* Mainly used in methods that can be triggered via both the API and batch
|
||||||
|
* Jobs (which do not have an authenticated user)
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
AppUser getAuthenticatedUserIfPresent();
|
||||||
|
|
||||||
void validateAccessRights(String resourceOfficeHierarchy);
|
void validateAccessRights(String resourceOfficeHierarchy);
|
||||||
|
|
||||||
String officeHierarchy();
|
String officeHierarchy();
|
||||||
|
|||||||
+19
@@ -65,6 +65,25 @@ public class SpringSecurityPlatformSecurityContext implements PlatformSecurityCo
|
|||||||
return currentUser;
|
return currentUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AppUser getAuthenticatedUserIfPresent() {
|
||||||
|
|
||||||
|
AppUser currentUser = null;
|
||||||
|
final SecurityContext context = SecurityContextHolder.getContext();
|
||||||
|
if (context != null) {
|
||||||
|
final Authentication auth = context.getAuthentication();
|
||||||
|
if (auth != null) {
|
||||||
|
currentUser = (AppUser) auth.getPrincipal();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentUser == null) { return null; }
|
||||||
|
|
||||||
|
if (this.doesPasswordHasToBeRenewed(currentUser)) { throw new ResetPasswordException(currentUser.getId()); }
|
||||||
|
|
||||||
|
return currentUser;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AppUser authenticatedUser(CommandWrapper commandWrapper) {
|
public AppUser authenticatedUser(CommandWrapper commandWrapper) {
|
||||||
|
|
||||||
|
|||||||
+7
-10
@@ -104,7 +104,7 @@ public class AccountTransfersWritePlatformServiceImpl implements AccountTransfer
|
|||||||
boolean isAccountTransfer = true;
|
boolean isAccountTransfer = true;
|
||||||
Long fromLoanAccountId = null;
|
Long fromLoanAccountId = null;
|
||||||
boolean isWithdrawBalance = false;
|
boolean isWithdrawBalance = false;
|
||||||
|
|
||||||
if (isSavingsToSavingsAccountTransfer(fromAccountType, toAccountType)) {
|
if (isSavingsToSavingsAccountTransfer(fromAccountType, toAccountType)) {
|
||||||
|
|
||||||
fromSavingsAccountId = command.longValueOfParameterNamed(fromAccountIdParamName);
|
fromSavingsAccountId = command.longValueOfParameterNamed(fromAccountIdParamName);
|
||||||
@@ -142,7 +142,7 @@ public class AccountTransfersWritePlatformServiceImpl implements AccountTransfer
|
|||||||
final boolean isRecoveryRepayment = false;
|
final boolean isRecoveryRepayment = false;
|
||||||
final LoanTransaction loanRepaymentTransaction = this.loanAccountDomainService.makeRepayment(toLoanAccount,
|
final LoanTransaction loanRepaymentTransaction = this.loanAccountDomainService.makeRepayment(toLoanAccount,
|
||||||
new CommandProcessingResultBuilder(), transactionDate, transactionAmount, paymentDetail, null, null,
|
new CommandProcessingResultBuilder(), transactionDate, transactionAmount, paymentDetail, null, null,
|
||||||
isRecoveryRepayment, isAccountTransfer, null); // FIXME: should not be sending null for currentUser for account transfers
|
isRecoveryRepayment, isAccountTransfer);
|
||||||
|
|
||||||
final AccountTransferDetails accountTransferDetails = this.accountTransferAssembler.assembleSavingsToLoanTransfer(command,
|
final AccountTransferDetails accountTransferDetails = this.accountTransferAssembler.assembleSavingsToLoanTransfer(command,
|
||||||
fromSavingsAccount, toLoanAccount, withdrawal, loanRepaymentTransaction);
|
fromSavingsAccount, toLoanAccount, withdrawal, loanRepaymentTransaction);
|
||||||
@@ -157,8 +157,7 @@ public class AccountTransfersWritePlatformServiceImpl implements AccountTransfer
|
|||||||
final Loan fromLoanAccount = this.loanAccountAssembler.assembleFrom(fromLoanAccountId);
|
final Loan fromLoanAccount = this.loanAccountAssembler.assembleFrom(fromLoanAccountId);
|
||||||
|
|
||||||
final LoanTransaction loanRefundTransaction = this.loanAccountDomainService.makeRefund(fromLoanAccountId,
|
final LoanTransaction loanRefundTransaction = this.loanAccountDomainService.makeRefund(fromLoanAccountId,
|
||||||
new CommandProcessingResultBuilder(), transactionDate, transactionAmount, paymentDetail, null, null,
|
new CommandProcessingResultBuilder(), transactionDate, transactionAmount, paymentDetail, null, null);
|
||||||
null); // FIXME: should not be sending null for currentUser for account transfers
|
|
||||||
|
|
||||||
final Long toSavingsAccountId = command.longValueOfParameterNamed(toAccountIdParamName);
|
final Long toSavingsAccountId = command.longValueOfParameterNamed(toAccountIdParamName);
|
||||||
final SavingsAccount toSavingsAccount = this.savingsAccountAssembler.assembleFrom(toSavingsAccountId);
|
final SavingsAccount toSavingsAccount = this.savingsAccountAssembler.assembleFrom(toSavingsAccountId);
|
||||||
@@ -272,14 +271,13 @@ public class AccountTransfersWritePlatformServiceImpl implements AccountTransfer
|
|||||||
loanTransaction = this.loanAccountDomainService.makeChargePayment(toLoanAccount, accountTransferDTO.getChargeId(),
|
loanTransaction = this.loanAccountDomainService.makeChargePayment(toLoanAccount, accountTransferDTO.getChargeId(),
|
||||||
accountTransferDTO.getTransactionDate(), accountTransferDTO.getTransactionAmount(),
|
accountTransferDTO.getTransactionDate(), accountTransferDTO.getTransactionAmount(),
|
||||||
accountTransferDTO.getPaymentDetail(), null, null, accountTransferDTO.getToTransferType(),
|
accountTransferDTO.getPaymentDetail(), null, null, accountTransferDTO.getToTransferType(),
|
||||||
accountTransferDTO.getLoanInstallmentNumber(), null); // FIXME: should not be sending null for currentUser for account transfers
|
accountTransferDTO.getLoanInstallmentNumber());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
final boolean isRecoveryRepayment = false;
|
final boolean isRecoveryRepayment = false;
|
||||||
loanTransaction = this.loanAccountDomainService.makeRepayment(toLoanAccount, new CommandProcessingResultBuilder(),
|
loanTransaction = this.loanAccountDomainService.makeRepayment(toLoanAccount, new CommandProcessingResultBuilder(),
|
||||||
accountTransferDTO.getTransactionDate(), accountTransferDTO.getTransactionAmount(),
|
accountTransferDTO.getTransactionDate(), accountTransferDTO.getTransactionAmount(),
|
||||||
accountTransferDTO.getPaymentDetail(), null, null, isRecoveryRepayment, isAccountTransfer,
|
accountTransferDTO.getPaymentDetail(), null, null, isRecoveryRepayment, isAccountTransfer);
|
||||||
null); // FIXME: should not be sending null for currentUser for account transfers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
accountTransferDetails = this.accountTransferAssembler.assembleSavingsToLoanTransfer(accountTransferDTO, fromSavingsAccount,
|
accountTransferDetails = this.accountTransferAssembler.assembleSavingsToLoanTransfer(accountTransferDTO, fromSavingsAccount,
|
||||||
@@ -346,13 +344,12 @@ public class AccountTransfersWritePlatformServiceImpl implements AccountTransfer
|
|||||||
if (LoanTransactionType.DISBURSEMENT.getValue().equals(accountTransferDTO.getFromTransferType())) {
|
if (LoanTransactionType.DISBURSEMENT.getValue().equals(accountTransferDTO.getFromTransferType())) {
|
||||||
loanTransaction = this.loanAccountDomainService.makeDisburseTransaction(accountTransferDTO.getFromAccountId(),
|
loanTransaction = this.loanAccountDomainService.makeDisburseTransaction(accountTransferDTO.getFromAccountId(),
|
||||||
accountTransferDTO.getTransactionDate(), accountTransferDTO.getTransactionAmount(),
|
accountTransferDTO.getTransactionDate(), accountTransferDTO.getTransactionAmount(),
|
||||||
accountTransferDTO.getPaymentDetail(), accountTransferDTO.getNoteText(), accountTransferDTO.getTxnExternalId(),
|
accountTransferDTO.getPaymentDetail(), accountTransferDTO.getNoteText(), accountTransferDTO.getTxnExternalId());
|
||||||
null); // FIXME: should not be sending null for currentUser for account transfers
|
|
||||||
} else {
|
} else {
|
||||||
loanTransaction = this.loanAccountDomainService.makeRefund(accountTransferDTO.getFromAccountId(),
|
loanTransaction = this.loanAccountDomainService.makeRefund(accountTransferDTO.getFromAccountId(),
|
||||||
new CommandProcessingResultBuilder(), accountTransferDTO.getTransactionDate(),
|
new CommandProcessingResultBuilder(), accountTransferDTO.getTransactionDate(),
|
||||||
accountTransferDTO.getTransactionAmount(), accountTransferDTO.getPaymentDetail(), accountTransferDTO.getNoteText(),
|
accountTransferDTO.getTransactionAmount(), accountTransferDTO.getPaymentDetail(), accountTransferDTO.getNoteText(),
|
||||||
accountTransferDTO.getTxnExternalId(), null); // FIXME: should not be sending null for currentUser for account transfers
|
accountTransferDTO.getTxnExternalId());
|
||||||
}
|
}
|
||||||
|
|
||||||
final SavingsAccountTransaction deposit = this.savingsAccountDomainService.handleDeposit(toSavingsAccount,
|
final SavingsAccountTransaction deposit = this.savingsAccountDomainService.handleDeposit(toSavingsAccount,
|
||||||
|
|||||||
+7
-10
@@ -12,26 +12,23 @@ import org.mifosplatform.infrastructure.core.data.CommandProcessingResultBuilder
|
|||||||
import org.mifosplatform.portfolio.calendar.domain.CalendarInstance;
|
import org.mifosplatform.portfolio.calendar.domain.CalendarInstance;
|
||||||
import org.mifosplatform.portfolio.loanaccount.data.ScheduleGeneratorDTO;
|
import org.mifosplatform.portfolio.loanaccount.data.ScheduleGeneratorDTO;
|
||||||
import org.mifosplatform.portfolio.paymentdetail.domain.PaymentDetail;
|
import org.mifosplatform.portfolio.paymentdetail.domain.PaymentDetail;
|
||||||
import org.mifosplatform.useradministration.domain.AppUser;
|
|
||||||
|
|
||||||
public interface LoanAccountDomainService {
|
public interface LoanAccountDomainService {
|
||||||
|
|
||||||
LoanTransaction makeRepayment(Loan loan, CommandProcessingResultBuilder builderResult, LocalDate transactionDate,
|
LoanTransaction makeRepayment(Loan loan, CommandProcessingResultBuilder builderResult, LocalDate transactionDate,
|
||||||
BigDecimal transactionAmount, PaymentDetail paymentDetail, String noteText, String txnExternalId,
|
BigDecimal transactionAmount, PaymentDetail paymentDetail, String noteText, String txnExternalId,
|
||||||
final boolean isRecoveryRepayment, boolean isAccountTransfer, final AppUser currentUser);
|
final boolean isRecoveryRepayment, boolean isAccountTransfer);
|
||||||
|
|
||||||
LoanTransaction makeRefund(Long accountId, CommandProcessingResultBuilder builderResult, LocalDate transactionDate,
|
LoanTransaction makeRefund(Long accountId, CommandProcessingResultBuilder builderResult, LocalDate transactionDate,
|
||||||
BigDecimal transactionAmount, PaymentDetail paymentDetail, String noteText, String txnExternalId,
|
BigDecimal transactionAmount, PaymentDetail paymentDetail, String noteText, String txnExternalId);
|
||||||
final AppUser currentUser);
|
|
||||||
|
|
||||||
void reverseTransfer(LoanTransaction loanTransaction);
|
void reverseTransfer(LoanTransaction loanTransaction);
|
||||||
|
|
||||||
LoanTransaction makeChargePayment(Loan loan, Long chargeId, LocalDate transactionDate, BigDecimal transactionAmount,
|
LoanTransaction makeChargePayment(Loan loan, Long chargeId, LocalDate transactionDate, BigDecimal transactionAmount,
|
||||||
PaymentDetail paymentDetail, String noteText, String txnExternalId, Integer transactionType, Integer installmentNumber,
|
PaymentDetail paymentDetail, String noteText, String txnExternalId, Integer transactionType, Integer installmentNumber);
|
||||||
final AppUser currentUser);
|
|
||||||
|
|
||||||
LoanTransaction makeDisburseTransaction(Long loanId, LocalDate transactionDate, BigDecimal transactionAmount,
|
LoanTransaction makeDisburseTransaction(Long loanId, LocalDate transactionDate, BigDecimal transactionAmount,
|
||||||
PaymentDetail paymentDetail, String noteText, String txnExternalId, final AppUser currentUser);
|
PaymentDetail paymentDetail, String noteText, String txnExternalId);
|
||||||
|
|
||||||
LocalDate getCalculatedRepaymentsStartingFromDate(LocalDate actualDisbursementDate, Loan loan, CalendarInstance calendarInstance);
|
LocalDate getCalculatedRepaymentsStartingFromDate(LocalDate actualDisbursementDate, Loan loan, CalendarInstance calendarInstance);
|
||||||
|
|
||||||
@@ -43,7 +40,7 @@ public interface LoanAccountDomainService {
|
|||||||
* @param loan
|
* @param loan
|
||||||
*/
|
*/
|
||||||
void recalculateAccruals(Loan loan);
|
void recalculateAccruals(Loan loan);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method is used for building ScheduleGeneratorDTO from loan, usages
|
* This method is used for building ScheduleGeneratorDTO from loan, usages
|
||||||
* are as, if have loan and some of the terms are modified which may impact
|
* are as, if have loan and some of the terms are modified which may impact
|
||||||
@@ -52,7 +49,7 @@ public interface LoanAccountDomainService {
|
|||||||
*
|
*
|
||||||
* @param loan
|
* @param loan
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public ScheduleGeneratorDTO buildScheduleGeneratorDTO(final Loan loan);
|
public ScheduleGeneratorDTO buildScheduleGeneratorDTO(final Loan loan);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+22
-9
@@ -24,6 +24,7 @@ import org.mifosplatform.infrastructure.core.data.DataValidatorBuilder;
|
|||||||
import org.mifosplatform.infrastructure.core.exception.GeneralPlatformDomainRuleException;
|
import org.mifosplatform.infrastructure.core.exception.GeneralPlatformDomainRuleException;
|
||||||
import org.mifosplatform.infrastructure.core.exception.PlatformApiDataValidationException;
|
import org.mifosplatform.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||||
import org.mifosplatform.infrastructure.core.service.DateUtils;
|
import org.mifosplatform.infrastructure.core.service.DateUtils;
|
||||||
|
import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext;
|
||||||
import org.mifosplatform.organisation.holiday.domain.Holiday;
|
import org.mifosplatform.organisation.holiday.domain.Holiday;
|
||||||
import org.mifosplatform.organisation.holiday.domain.HolidayRepository;
|
import org.mifosplatform.organisation.holiday.domain.HolidayRepository;
|
||||||
import org.mifosplatform.organisation.holiday.domain.HolidayStatusType;
|
import org.mifosplatform.organisation.holiday.domain.HolidayStatusType;
|
||||||
@@ -81,6 +82,7 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService {
|
|||||||
private final CalendarInstanceRepository calendarInstanceRepository;
|
private final CalendarInstanceRepository calendarInstanceRepository;
|
||||||
private final LoanRepaymentScheduleInstallmentRepository repaymentScheduleInstallmentRepository;
|
private final LoanRepaymentScheduleInstallmentRepository repaymentScheduleInstallmentRepository;
|
||||||
private final LoanAccrualWritePlatformService accrualWritePlatformService;
|
private final LoanAccrualWritePlatformService accrualWritePlatformService;
|
||||||
|
private final PlatformSecurityContext context;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public LoanAccountDomainServiceJpa(final LoanAssembler loanAccountAssembler, final LoanRepository loanRepository,
|
public LoanAccountDomainServiceJpa(final LoanAssembler loanAccountAssembler, final LoanRepository loanRepository,
|
||||||
@@ -93,7 +95,7 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService {
|
|||||||
final ApplicationCurrencyRepositoryWrapper applicationCurrencyRepository,
|
final ApplicationCurrencyRepositoryWrapper applicationCurrencyRepository,
|
||||||
final CalendarInstanceRepository calendarInstanceRepository,
|
final CalendarInstanceRepository calendarInstanceRepository,
|
||||||
final LoanRepaymentScheduleInstallmentRepository repaymentScheduleInstallmentRepository,
|
final LoanRepaymentScheduleInstallmentRepository repaymentScheduleInstallmentRepository,
|
||||||
final LoanAccrualWritePlatformService accrualWritePlatformService) {
|
final LoanAccrualWritePlatformService accrualWritePlatformService, final PlatformSecurityContext context) {
|
||||||
this.loanAccountAssembler = loanAccountAssembler;
|
this.loanAccountAssembler = loanAccountAssembler;
|
||||||
this.loanRepository = loanRepository;
|
this.loanRepository = loanRepository;
|
||||||
this.loanTransactionRepository = loanTransactionRepository;
|
this.loanTransactionRepository = loanTransactionRepository;
|
||||||
@@ -109,15 +111,15 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService {
|
|||||||
this.calendarInstanceRepository = calendarInstanceRepository;
|
this.calendarInstanceRepository = calendarInstanceRepository;
|
||||||
this.repaymentScheduleInstallmentRepository = repaymentScheduleInstallmentRepository;
|
this.repaymentScheduleInstallmentRepository = repaymentScheduleInstallmentRepository;
|
||||||
this.accrualWritePlatformService = accrualWritePlatformService;
|
this.accrualWritePlatformService = accrualWritePlatformService;
|
||||||
|
this.context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public LoanTransaction makeRepayment(final Loan loan, final CommandProcessingResultBuilder builderResult,
|
public LoanTransaction makeRepayment(final Loan loan, final CommandProcessingResultBuilder builderResult,
|
||||||
final LocalDate transactionDate, final BigDecimal transactionAmount, final PaymentDetail paymentDetail, final String noteText,
|
final LocalDate transactionDate, final BigDecimal transactionAmount, final PaymentDetail paymentDetail, final String noteText,
|
||||||
final String txnExternalId, final boolean isRecoveryRepayment, boolean isAccountTransfer,
|
final String txnExternalId, final boolean isRecoveryRepayment, boolean isAccountTransfer) {
|
||||||
final AppUser currentUser) {
|
AppUser currentUser = getAppUserIfPresent();
|
||||||
|
|
||||||
checkClientOrGroupActive(loan);
|
checkClientOrGroupActive(loan);
|
||||||
|
|
||||||
// TODO: Is it required to validate transaction date with meeting dates
|
// TODO: Is it required to validate transaction date with meeting dates
|
||||||
@@ -262,8 +264,8 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService {
|
|||||||
@Transactional
|
@Transactional
|
||||||
public LoanTransaction makeChargePayment(final Loan loan, final Long chargeId, final LocalDate transactionDate,
|
public LoanTransaction makeChargePayment(final Loan loan, final Long chargeId, final LocalDate transactionDate,
|
||||||
final BigDecimal transactionAmount, final PaymentDetail paymentDetail, final String noteText, final String txnExternalId,
|
final BigDecimal transactionAmount, final PaymentDetail paymentDetail, final String noteText, final String txnExternalId,
|
||||||
final Integer transactionType, Integer installmentNumber, final AppUser currentUser) {
|
final Integer transactionType, Integer installmentNumber) {
|
||||||
|
AppUser currentUser = getAppUserIfPresent();
|
||||||
boolean isAccountTransfer = true;
|
boolean isAccountTransfer = true;
|
||||||
checkClientOrGroupActive(loan);
|
checkClientOrGroupActive(loan);
|
||||||
|
|
||||||
@@ -334,7 +336,8 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService {
|
|||||||
@Override
|
@Override
|
||||||
public LoanTransaction makeRefund(final Long accountId, final CommandProcessingResultBuilder builderResult,
|
public LoanTransaction makeRefund(final Long accountId, final CommandProcessingResultBuilder builderResult,
|
||||||
final LocalDate transactionDate, final BigDecimal transactionAmount, final PaymentDetail paymentDetail, final String noteText,
|
final LocalDate transactionDate, final BigDecimal transactionAmount, final PaymentDetail paymentDetail, final String noteText,
|
||||||
final String txnExternalId, final AppUser currentUser) {
|
final String txnExternalId) {
|
||||||
|
AppUser currentUser = getAppUserIfPresent();
|
||||||
boolean isAccountTransfer = true;
|
boolean isAccountTransfer = true;
|
||||||
final Loan loan = this.loanAccountAssembler.assembleFrom(accountId);
|
final Loan loan = this.loanAccountAssembler.assembleFrom(accountId);
|
||||||
checkClientOrGroupActive(loan);
|
checkClientOrGroupActive(loan);
|
||||||
@@ -375,7 +378,8 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService {
|
|||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public LoanTransaction makeDisburseTransaction(final Long loanId, final LocalDate transactionDate, final BigDecimal transactionAmount,
|
public LoanTransaction makeDisburseTransaction(final Long loanId, final LocalDate transactionDate, final BigDecimal transactionAmount,
|
||||||
final PaymentDetail paymentDetail, final String noteText, final String txnExternalId, final AppUser currentUser) {
|
final PaymentDetail paymentDetail, final String noteText, final String txnExternalId) {
|
||||||
|
AppUser currentUser = getAppUserIfPresent();
|
||||||
final Loan loan = this.loanAccountAssembler.assembleFrom(loanId);
|
final Loan loan = this.loanAccountAssembler.assembleFrom(loanId);
|
||||||
checkClientOrGroupActive(loan);
|
checkClientOrGroupActive(loan);
|
||||||
boolean isAccountTransfer = true;
|
boolean isAccountTransfer = true;
|
||||||
@@ -505,7 +509,8 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService {
|
|||||||
this.accountTransferRepository.save(transferTransaction);
|
this.accountTransferRepository.save(transferTransaction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ScheduleGeneratorDTO buildScheduleGeneratorDTO(final Loan loan) {
|
public ScheduleGeneratorDTO buildScheduleGeneratorDTO(final Loan loan) {
|
||||||
|
|
||||||
final MonetaryCurrency currency = loan.getCurrency();
|
final MonetaryCurrency currency = loan.getCurrency();
|
||||||
@@ -527,4 +532,12 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService {
|
|||||||
return scheduleGeneratorDTO;
|
return scheduleGeneratorDTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private AppUser getAppUserIfPresent() {
|
||||||
|
AppUser user = null;
|
||||||
|
if (this.context != null) {
|
||||||
|
user = this.context.getAuthenticatedUserIfPresent();
|
||||||
|
}
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+73
-78
@@ -215,8 +215,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
|||||||
final CalendarRepository calendarRepository,
|
final CalendarRepository calendarRepository,
|
||||||
final LoanRepaymentScheduleInstallmentRepository repaymentScheduleInstallmentRepository,
|
final LoanRepaymentScheduleInstallmentRepository repaymentScheduleInstallmentRepository,
|
||||||
final LoanScheduleHistoryWritePlatformService loanScheduleHistoryWritePlatformService,
|
final LoanScheduleHistoryWritePlatformService loanScheduleHistoryWritePlatformService,
|
||||||
final LoanApplicationCommandFromApiJsonHelper loanApplicationCommandFromApiJsonHelper,
|
final LoanApplicationCommandFromApiJsonHelper loanApplicationCommandFromApiJsonHelper,
|
||||||
final AccountAssociationsRepository accountAssociationRepository,
|
final AccountAssociationsRepository accountAssociationRepository,
|
||||||
final AccountTransferDetailRepository accountTransferDetailRepository) {
|
final AccountTransferDetailRepository accountTransferDetailRepository) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.loanEventApiJsonValidator = loanEventApiJsonValidator;
|
this.loanEventApiJsonValidator = loanEventApiJsonValidator;
|
||||||
@@ -360,7 +360,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
|||||||
this.accountTransfersWritePlatformService.updateLoanTransaction(mapEntry.getKey(), mapEntry.getValue());
|
this.accountTransfersWritePlatformService.updateLoanTransaction(mapEntry.getKey(), mapEntry.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// auto create standing instruction
|
// auto create standing instruction
|
||||||
createStandingInstruction(loan);
|
createStandingInstruction(loan);
|
||||||
|
|
||||||
@@ -402,22 +402,23 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
|||||||
.with(changes) //
|
.with(changes) //
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* create standing instruction for disbursed loan
|
* create standing instruction for disbursed loan
|
||||||
*
|
*
|
||||||
* @param loan the disbursed loan
|
* @param loan
|
||||||
|
* the disbursed loan
|
||||||
* @return void
|
* @return void
|
||||||
**/
|
**/
|
||||||
private void createStandingInstruction(Loan loan) {
|
private void createStandingInstruction(Loan loan) {
|
||||||
|
|
||||||
if(loan.shouldCreateStandingInstructionAtDisbursement()) {
|
if (loan.shouldCreateStandingInstructionAtDisbursement()) {
|
||||||
AccountAssociations accountAssociations = this.accountAssociationRepository.findByLoanId(loan.getId());
|
AccountAssociations accountAssociations = this.accountAssociationRepository.findByLoanId(loan.getId());
|
||||||
|
|
||||||
if(accountAssociations != null) {
|
if (accountAssociations != null) {
|
||||||
|
|
||||||
SavingsAccount linkedSavingsAccount = accountAssociations.linkedSavingsAccount();
|
SavingsAccount linkedSavingsAccount = accountAssociations.linkedSavingsAccount();
|
||||||
|
|
||||||
// name is auto-generated
|
// name is auto-generated
|
||||||
final String name = "To loan " + loan.getAccountNumber() + " from savings " + linkedSavingsAccount.getAccountNumber();
|
final String name = "To loan " + loan.getAccountNumber() + " from savings " + linkedSavingsAccount.getAccountNumber();
|
||||||
final Office fromOffice = loan.getOffice();
|
final Office fromOffice = loan.getOffice();
|
||||||
@@ -430,15 +431,15 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
|||||||
final Integer status = StandingInstructionStatus.ACTIVE.getValue();
|
final Integer status = StandingInstructionStatus.ACTIVE.getValue();
|
||||||
final Integer recurrenceType = AccountTransferRecurrenceType.AS_PER_DUES.getValue();
|
final Integer recurrenceType = AccountTransferRecurrenceType.AS_PER_DUES.getValue();
|
||||||
final LocalDate validFrom = new LocalDate();
|
final LocalDate validFrom = new LocalDate();
|
||||||
|
|
||||||
AccountTransferDetails accountTransferDetails = AccountTransferDetails.savingsToLoanTransfer(fromOffice,
|
AccountTransferDetails accountTransferDetails = AccountTransferDetails.savingsToLoanTransfer(fromOffice, fromClient,
|
||||||
fromClient, linkedSavingsAccount, toOffice, toClient, loan, transferType);
|
linkedSavingsAccount, toOffice, toClient, loan, transferType);
|
||||||
|
|
||||||
AccountTransferStandingInstruction accountTransferStandingInstruction = AccountTransferStandingInstruction.create(
|
AccountTransferStandingInstruction accountTransferStandingInstruction = AccountTransferStandingInstruction.create(
|
||||||
accountTransferDetails, name, priority, instructionType, status, null, validFrom, null,
|
accountTransferDetails, name, priority, instructionType, status, null, validFrom, null, recurrenceType, null, null,
|
||||||
recurrenceType, null, null, null);
|
null);
|
||||||
accountTransferDetails.updateAccountTransferStandingInstruction(accountTransferStandingInstruction);
|
accountTransferDetails.updateAccountTransferStandingInstruction(accountTransferStandingInstruction);
|
||||||
|
|
||||||
this.accountTransferDetailRepository.save(accountTransferDetails);
|
this.accountTransferDetailRepository.save(accountTransferDetails);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -620,8 +621,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
|||||||
final Locale locale = command.extractLocale();
|
final Locale locale = command.extractLocale();
|
||||||
final DateTimeFormatter fmt = DateTimeFormat.forPattern(command.dateFormat()).withLocale(locale);
|
final DateTimeFormatter fmt = DateTimeFormat.forPattern(command.dateFormat()).withLocale(locale);
|
||||||
for (final Map.Entry<Long, BigDecimal> entrySet : disBuLoanCharges.entrySet()) {
|
for (final Map.Entry<Long, BigDecimal> entrySet : disBuLoanCharges.entrySet()) {
|
||||||
final PortfolioAccountData savingAccountData = this.accountAssociationsReadPlatformService.retriveLoanLinkedAssociation(loan
|
final PortfolioAccountData savingAccountData = this.accountAssociationsReadPlatformService
|
||||||
.getId());
|
.retriveLoanLinkedAssociation(loan.getId());
|
||||||
final SavingsAccount fromSavingsAccount = null;
|
final SavingsAccount fromSavingsAccount = null;
|
||||||
final boolean isRegularTransaction = true;
|
final boolean isRegularTransaction = true;
|
||||||
final AccountTransferDTO accountTransferDTO = new AccountTransferDTO(actualDisbursementDate, entrySet.getValue(),
|
final AccountTransferDTO accountTransferDTO = new AccountTransferDTO(actualDisbursementDate, entrySet.getValue(),
|
||||||
@@ -642,8 +643,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
|||||||
@Override
|
@Override
|
||||||
public CommandProcessingResult undoLoanDisbursal(final Long loanId, final JsonCommand command) {
|
public CommandProcessingResult undoLoanDisbursal(final Long loanId, final JsonCommand command) {
|
||||||
|
|
||||||
final AppUser currentUser = this.context.authenticatedUser();
|
final AppUser currentUser = this.context.authenticatedUser();
|
||||||
|
|
||||||
final Loan loan = this.loanAssembler.assembleFrom(loanId);
|
final Loan loan = this.loanAssembler.assembleFrom(loanId);
|
||||||
checkClientOrGroupActive(loan);
|
checkClientOrGroupActive(loan);
|
||||||
removeLoanCycle(loan);
|
removeLoanCycle(loan);
|
||||||
@@ -670,8 +671,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
|||||||
ScheduleGeneratorDTO scheduleGeneratorDTO = new ScheduleGeneratorDTO(this.loanScheduleFactory, applicationCurrency,
|
ScheduleGeneratorDTO scheduleGeneratorDTO = new ScheduleGeneratorDTO(this.loanScheduleFactory, applicationCurrency,
|
||||||
calculatedRepaymentsStartingFromDate, holidayDetailDTO);
|
calculatedRepaymentsStartingFromDate, holidayDetailDTO);
|
||||||
|
|
||||||
final Map<String, Object> changes = loan
|
final Map<String, Object> changes = loan.undoDisbursal(scheduleGeneratorDTO, existingTransactionIds,
|
||||||
.undoDisbursal(scheduleGeneratorDTO, existingTransactionIds, existingReversedTransactionIds, currentUser);
|
existingReversedTransactionIds, currentUser);
|
||||||
|
|
||||||
if (!changes.isEmpty()) {
|
if (!changes.isEmpty()) {
|
||||||
saveAndFlushLoanWithDataIntegrityViolationChecks(loan);
|
saveAndFlushLoanWithDataIntegrityViolationChecks(loan);
|
||||||
@@ -705,11 +706,6 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
|||||||
@Override
|
@Override
|
||||||
public CommandProcessingResult makeLoanRepayment(final Long loanId, final JsonCommand command, final boolean isRecoveryRepayment) {
|
public CommandProcessingResult makeLoanRepayment(final Long loanId, final JsonCommand command, final boolean isRecoveryRepayment) {
|
||||||
|
|
||||||
AppUser currentUser = null;
|
|
||||||
if (this.context != null) {
|
|
||||||
currentUser = this.context.authenticatedUser();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.loanEventApiJsonValidator.validateNewRepaymentTransaction(command.json());
|
this.loanEventApiJsonValidator.validateNewRepaymentTransaction(command.json());
|
||||||
|
|
||||||
final LocalDate transactionDate = command.localDateValueOfParameterNamed("transactionDate");
|
final LocalDate transactionDate = command.localDateValueOfParameterNamed("transactionDate");
|
||||||
@@ -733,7 +729,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
|||||||
boolean isAccountTransfer = false;
|
boolean isAccountTransfer = false;
|
||||||
final CommandProcessingResultBuilder commandProcessingResultBuilder = new CommandProcessingResultBuilder();
|
final CommandProcessingResultBuilder commandProcessingResultBuilder = new CommandProcessingResultBuilder();
|
||||||
this.loanAccountDomainService.makeRepayment(loan, commandProcessingResultBuilder, transactionDate, transactionAmount,
|
this.loanAccountDomainService.makeRepayment(loan, commandProcessingResultBuilder, transactionDate, transactionAmount,
|
||||||
paymentDetail, noteText, txnExternalId, isRecoveryRepayment, isAccountTransfer, currentUser);
|
paymentDetail, noteText, txnExternalId, isRecoveryRepayment, isAccountTransfer);
|
||||||
|
|
||||||
return commandProcessingResultBuilder.withCommandId(command.commandId()) //
|
return commandProcessingResultBuilder.withCommandId(command.commandId()) //
|
||||||
.withLoanId(loanId) //
|
.withLoanId(loanId) //
|
||||||
@@ -745,7 +741,6 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
|||||||
@Override
|
@Override
|
||||||
public Map<String, Object> makeLoanBulkRepayment(final CollectionSheetBulkRepaymentCommand bulkRepaymentCommand) {
|
public Map<String, Object> makeLoanBulkRepayment(final CollectionSheetBulkRepaymentCommand bulkRepaymentCommand) {
|
||||||
|
|
||||||
AppUser currentUser = this.context.authenticatedUser();
|
|
||||||
final SingleRepaymentCommand[] repaymentCommand = bulkRepaymentCommand.getLoanTransactions();
|
final SingleRepaymentCommand[] repaymentCommand = bulkRepaymentCommand.getLoanTransactions();
|
||||||
final Map<String, Object> changes = new LinkedHashMap<>();
|
final Map<String, Object> changes = new LinkedHashMap<>();
|
||||||
final boolean isRecoveryRepayment = false;
|
final boolean isRecoveryRepayment = false;
|
||||||
@@ -762,7 +757,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
|||||||
final CommandProcessingResultBuilder commandProcessingResultBuilder = new CommandProcessingResultBuilder();
|
final CommandProcessingResultBuilder commandProcessingResultBuilder = new CommandProcessingResultBuilder();
|
||||||
this.loanAccountDomainService.makeRepayment(loan, commandProcessingResultBuilder, bulkRepaymentCommand.getTransactionDate(),
|
this.loanAccountDomainService.makeRepayment(loan, commandProcessingResultBuilder, bulkRepaymentCommand.getTransactionDate(),
|
||||||
singleLoanRepaymentCommand.getTransactionAmount(), paymentDetail, bulkRepaymentCommand.getNote(), null,
|
singleLoanRepaymentCommand.getTransactionAmount(), paymentDetail, bulkRepaymentCommand.getNote(), null,
|
||||||
isRecoveryRepayment, isAccountTransfer, currentUser);
|
isRecoveryRepayment, isAccountTransfer);
|
||||||
|
|
||||||
changes.put("bulkTransactions", singleLoanRepaymentCommand);
|
changes.put("bulkTransactions", singleLoanRepaymentCommand);
|
||||||
}
|
}
|
||||||
@@ -773,10 +768,10 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
|||||||
@Override
|
@Override
|
||||||
public CommandProcessingResult adjustLoanTransaction(final Long loanId, final Long transactionId, final JsonCommand command) {
|
public CommandProcessingResult adjustLoanTransaction(final Long loanId, final Long transactionId, final JsonCommand command) {
|
||||||
|
|
||||||
AppUser currentUser = null;
|
AppUser currentUser = null;
|
||||||
if (this.context != null) {
|
if (this.context != null) {
|
||||||
currentUser = this.context.authenticatedUser();
|
currentUser = this.context.authenticatedUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.loanEventApiJsonValidator.validateTransaction(command.json());
|
this.loanEventApiJsonValidator.validateTransaction(command.json());
|
||||||
|
|
||||||
@@ -1310,10 +1305,10 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void runScheduleRecalculation(Loan loan) {
|
public void runScheduleRecalculation(Loan loan) {
|
||||||
AppUser currentUser = null;
|
AppUser currentUser = null;
|
||||||
if (this.context != null) {
|
if (this.context != null) {
|
||||||
currentUser = this.context.authenticatedUser();
|
currentUser = this.context.authenticatedUser();
|
||||||
}
|
}
|
||||||
if (loan.repaymentScheduleDetail().isInterestRecalculationEnabled()) {
|
if (loan.repaymentScheduleDetail().isInterestRecalculationEnabled()) {
|
||||||
CalendarInstance restCalendarInstance = calendarInstanceRepository.findCalendarInstaneByEntityId(
|
CalendarInstance restCalendarInstance = calendarInstanceRepository.findCalendarInstaneByEntityId(
|
||||||
loan.loanInterestRecalculationDetailId(), CalendarEntityType.LOAN_RECALCULATION_DETAIL.getValue());
|
loan.loanInterestRecalculationDetailId(), CalendarEntityType.LOAN_RECALCULATION_DETAIL.getValue());
|
||||||
@@ -1338,8 +1333,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
|||||||
ScheduleGeneratorDTO generatorDTO = new ScheduleGeneratorDTO(loanScheduleFactory, applicationCurrency,
|
ScheduleGeneratorDTO generatorDTO = new ScheduleGeneratorDTO(loanScheduleFactory, applicationCurrency,
|
||||||
calculatedRepaymentsStartingFromDate, holidayDetailDTO, restCalendarInstance, recalculateFrom,
|
calculatedRepaymentsStartingFromDate, holidayDetailDTO, restCalendarInstance, recalculateFrom,
|
||||||
overdurPenaltyWaitPeriod, lastTransactionDate);
|
overdurPenaltyWaitPeriod, lastTransactionDate);
|
||||||
ChangedTransactionDetail changedTransactionDetail = loan
|
ChangedTransactionDetail changedTransactionDetail = loan.handleRegenerateRepaymentScheduleWithInterestRecalculation(
|
||||||
.handleRegenerateRepaymentScheduleWithInterestRecalculation(generatorDTO, currentUser);
|
generatorDTO, currentUser);
|
||||||
saveLoanWithDataIntegrityViolationChecks(loan);
|
saveLoanWithDataIntegrityViolationChecks(loan);
|
||||||
if (changedTransactionDetail != null) {
|
if (changedTransactionDetail != null) {
|
||||||
for (final Map.Entry<Long, LoanTransaction> mapEntry : changedTransactionDetail.getNewTransactionMappings().entrySet()) {
|
for (final Map.Entry<Long, LoanTransaction> mapEntry : changedTransactionDetail.getNewTransactionMappings().entrySet()) {
|
||||||
@@ -1379,10 +1374,10 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
|||||||
|
|
||||||
private boolean addCharge(final Loan loan, final Charge chargeDefinition, final LoanCharge loanCharge) {
|
private boolean addCharge(final Loan loan, final Charge chargeDefinition, final LoanCharge loanCharge) {
|
||||||
|
|
||||||
AppUser currentUser = null;
|
AppUser currentUser = null;
|
||||||
if (this.context != null) {
|
if (this.context != null) {
|
||||||
currentUser = this.context.authenticatedUser();
|
currentUser = this.context.authenticatedUser();
|
||||||
}
|
}
|
||||||
if (!loan.hasCurrencyCodeOf(chargeDefinition.getCurrencyCode())) {
|
if (!loan.hasCurrencyCodeOf(chargeDefinition.getCurrencyCode())) {
|
||||||
final String errorMessage = "Charge and Loan must have the same currency.";
|
final String errorMessage = "Charge and Loan must have the same currency.";
|
||||||
throw new InvalidCurrencyException("loanCharge", "attach.to.loan", errorMessage);
|
throw new InvalidCurrencyException("loanCharge", "attach.to.loan", errorMessage);
|
||||||
@@ -1687,7 +1682,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
|||||||
|
|
||||||
final Locale locale = command.extractLocale();
|
final Locale locale = command.extractLocale();
|
||||||
final DateTimeFormatter fmt = DateTimeFormat.forPattern(command.dateFormat()).withLocale(locale);
|
final DateTimeFormatter fmt = DateTimeFormat.forPattern(command.dateFormat()).withLocale(locale);
|
||||||
final PortfolioAccountData portfolioAccountData = this.accountAssociationsReadPlatformService.retriveLoanLinkedAssociation(loan.getId());
|
final PortfolioAccountData portfolioAccountData = this.accountAssociationsReadPlatformService.retriveLoanLinkedAssociation(loan
|
||||||
|
.getId());
|
||||||
if (portfolioAccountData == null) {
|
if (portfolioAccountData == null) {
|
||||||
final String errorMessage = "Disburse Loan with id:" + loan.getId() + " requires linked savings account for payment";
|
final String errorMessage = "Disburse Loan with id:" + loan.getId() + " requires linked savings account for payment";
|
||||||
throw new LinkedAccountRequiredException("loan.disburse.to.savings", errorMessage, loan.getId());
|
throw new LinkedAccountRequiredException("loan.disburse.to.savings", errorMessage, loan.getId());
|
||||||
@@ -1777,11 +1773,11 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
|||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public LoanTransaction initiateLoanTransfer(final Long accountId, final LocalDate transferDate) {
|
public LoanTransaction initiateLoanTransfer(final Long accountId, final LocalDate transferDate) {
|
||||||
|
|
||||||
AppUser currentUser = null;
|
AppUser currentUser = null;
|
||||||
if (this.context != null) {
|
if (this.context != null) {
|
||||||
currentUser = this.context.authenticatedUser();
|
currentUser = this.context.authenticatedUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
final Loan loan = this.loanAssembler.assembleFrom(accountId);
|
final Loan loan = this.loanAssembler.assembleFrom(accountId);
|
||||||
checkClientOrGroupActive(loan);
|
checkClientOrGroupActive(loan);
|
||||||
@@ -1790,7 +1786,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
|||||||
final List<Long> existingReversedTransactionIds = new ArrayList<>(loan.findExistingReversedTransactionIds());
|
final List<Long> existingReversedTransactionIds = new ArrayList<>(loan.findExistingReversedTransactionIds());
|
||||||
|
|
||||||
final LoanTransaction newTransferTransaction = LoanTransaction.initiateTransfer(loan.getOffice(), loan, transferDate,
|
final LoanTransaction newTransferTransaction = LoanTransaction.initiateTransfer(loan.getOffice(), loan, transferDate,
|
||||||
DateUtils.getLocalDateTimeOfTenant(), currentUser);
|
DateUtils.getLocalDateTimeOfTenant(), currentUser);
|
||||||
loan.getLoanTransactions().add(newTransferTransaction);
|
loan.getLoanTransactions().add(newTransferTransaction);
|
||||||
loan.setLoanStatus(LoanStatus.TRANSFER_IN_PROGRESS.getValue());
|
loan.setLoanStatus(LoanStatus.TRANSFER_IN_PROGRESS.getValue());
|
||||||
|
|
||||||
@@ -1806,11 +1802,11 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
|||||||
@Override
|
@Override
|
||||||
public LoanTransaction acceptLoanTransfer(final Long accountId, final LocalDate transferDate, final Office acceptedInOffice,
|
public LoanTransaction acceptLoanTransfer(final Long accountId, final LocalDate transferDate, final Office acceptedInOffice,
|
||||||
final Staff loanOfficer) {
|
final Staff loanOfficer) {
|
||||||
|
|
||||||
AppUser currentUser = null;
|
AppUser currentUser = null;
|
||||||
if (this.context != null) {
|
if (this.context != null) {
|
||||||
currentUser = this.context.authenticatedUser();
|
currentUser = this.context.authenticatedUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
final Loan loan = this.loanAssembler.assembleFrom(accountId);
|
final Loan loan = this.loanAssembler.assembleFrom(accountId);
|
||||||
|
|
||||||
@@ -1818,7 +1814,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
|||||||
final List<Long> existingReversedTransactionIds = new ArrayList<>(loan.findExistingReversedTransactionIds());
|
final List<Long> existingReversedTransactionIds = new ArrayList<>(loan.findExistingReversedTransactionIds());
|
||||||
|
|
||||||
final LoanTransaction newTransferAcceptanceTransaction = LoanTransaction.approveTransfer(acceptedInOffice, loan, transferDate,
|
final LoanTransaction newTransferAcceptanceTransaction = LoanTransaction.approveTransfer(acceptedInOffice, loan, transferDate,
|
||||||
DateUtils.getLocalDateTimeOfTenant(), currentUser);
|
DateUtils.getLocalDateTimeOfTenant(), currentUser);
|
||||||
loan.getLoanTransactions().add(newTransferAcceptanceTransaction);
|
loan.getLoanTransactions().add(newTransferAcceptanceTransaction);
|
||||||
if (loan.getTotalOverpaid() != null) {
|
if (loan.getTotalOverpaid() != null) {
|
||||||
loan.setLoanStatus(LoanStatus.OVERPAID.getValue());
|
loan.setLoanStatus(LoanStatus.OVERPAID.getValue());
|
||||||
@@ -1840,11 +1836,11 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
|||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public LoanTransaction withdrawLoanTransfer(final Long accountId, final LocalDate transferDate) {
|
public LoanTransaction withdrawLoanTransfer(final Long accountId, final LocalDate transferDate) {
|
||||||
|
|
||||||
AppUser currentUser = null;
|
AppUser currentUser = null;
|
||||||
if (this.context != null) {
|
if (this.context != null) {
|
||||||
currentUser = this.context.authenticatedUser();
|
currentUser = this.context.authenticatedUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
final Loan loan = this.loanAssembler.assembleFrom(accountId);
|
final Loan loan = this.loanAssembler.assembleFrom(accountId);
|
||||||
|
|
||||||
@@ -1852,7 +1848,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
|||||||
final List<Long> existingReversedTransactionIds = new ArrayList<>(loan.findExistingReversedTransactionIds());
|
final List<Long> existingReversedTransactionIds = new ArrayList<>(loan.findExistingReversedTransactionIds());
|
||||||
|
|
||||||
final LoanTransaction newTransferAcceptanceTransaction = LoanTransaction.withdrawTransfer(loan.getOffice(), loan, transferDate,
|
final LoanTransaction newTransferAcceptanceTransaction = LoanTransaction.withdrawTransfer(loan.getOffice(), loan, transferDate,
|
||||||
DateUtils.getLocalDateTimeOfTenant(), currentUser);
|
DateUtils.getLocalDateTimeOfTenant(), currentUser);
|
||||||
loan.getLoanTransactions().add(newTransferAcceptanceTransaction);
|
loan.getLoanTransactions().add(newTransferAcceptanceTransaction);
|
||||||
loan.setLoanStatus(LoanStatus.ACTIVE.getValue());
|
loan.setLoanStatus(LoanStatus.ACTIVE.getValue());
|
||||||
|
|
||||||
@@ -2393,8 +2389,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommandProcessingResult undoWriteOff(Long loanId) {
|
public CommandProcessingResult undoWriteOff(Long loanId) {
|
||||||
final AppUser currentUser = this.context.authenticatedUser();
|
final AppUser currentUser = this.context.authenticatedUser();
|
||||||
|
|
||||||
final Loan loan = this.loanAssembler.assembleFrom(loanId);
|
final Loan loan = this.loanAssembler.assembleFrom(loanId);
|
||||||
checkClientOrGroupActive(loan);
|
checkClientOrGroupActive(loan);
|
||||||
final List<Long> existingTransactionIds = new ArrayList<>();
|
final List<Long> existingTransactionIds = new ArrayList<>();
|
||||||
@@ -2457,8 +2453,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
|||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public CommandProcessingResult updateDisbursementDateForTranche(final Long loanId, final Long disbursementId, final JsonCommand command) {
|
public CommandProcessingResult updateDisbursementDateForTranche(final Long loanId, final Long disbursementId, final JsonCommand command) {
|
||||||
|
|
||||||
AppUser currentUser = this.context.authenticatedUser();
|
AppUser currentUser = this.context.authenticatedUser();
|
||||||
|
|
||||||
final Loan loan = this.loanAssembler.assembleFrom(loanId);
|
final Loan loan = this.loanAssembler.assembleFrom(loanId);
|
||||||
checkClientOrGroupActive(loan);
|
checkClientOrGroupActive(loan);
|
||||||
@@ -2597,10 +2593,10 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
|||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void recalculateInterest(final long loanId) {
|
public void recalculateInterest(final long loanId) {
|
||||||
AppUser currentUser = null;
|
AppUser currentUser = null;
|
||||||
if (this.context != null) {
|
if (this.context != null) {
|
||||||
currentUser = this.context.authenticatedUser();
|
currentUser = this.context.authenticatedUser();
|
||||||
}
|
}
|
||||||
Loan loan = this.loanAssembler.assembleFrom(loanId);
|
Loan loan = this.loanAssembler.assembleFrom(loanId);
|
||||||
CalendarInstance restCalendarInstance = null;
|
CalendarInstance restCalendarInstance = null;
|
||||||
ApplicationCurrency applicationCurrency = null;
|
ApplicationCurrency applicationCurrency = null;
|
||||||
@@ -2666,11 +2662,10 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
|||||||
|
|
||||||
private void regenerateScheduleOnDisbursement(final JsonCommand command, final Loan loan, final boolean recalculateSchedule,
|
private void regenerateScheduleOnDisbursement(final JsonCommand command, final Loan loan, final boolean recalculateSchedule,
|
||||||
final ScheduleGeneratorDTO scheduleGeneratorDTO) {
|
final ScheduleGeneratorDTO scheduleGeneratorDTO) {
|
||||||
AppUser currentUser = this.context.authenticatedUser();
|
AppUser currentUser = this.context.authenticatedUser();
|
||||||
final LocalDate actualDisbursementDate = command.localDateValueOfParameterNamed("actualDisbursementDate");
|
final LocalDate actualDisbursementDate = command.localDateValueOfParameterNamed("actualDisbursementDate");
|
||||||
BigDecimal emiAmount = command.bigDecimalValueOfParameterNamed(LoanApiConstants.emiAmountParameterName);
|
BigDecimal emiAmount = command.bigDecimalValueOfParameterNamed(LoanApiConstants.emiAmountParameterName);
|
||||||
loan.regenerateScheduleOnDisbursement(scheduleGeneratorDTO, recalculateSchedule, actualDisbursementDate, emiAmount,
|
loan.regenerateScheduleOnDisbursement(scheduleGeneratorDTO, recalculateSchedule, actualDisbursementDate, emiAmount, currentUser);
|
||||||
currentUser);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<LoanRepaymentScheduleInstallment> retrieveRepaymentScheduleFromModel(LoanScheduleModel model) {
|
private List<LoanRepaymentScheduleInstallment> retrieveRepaymentScheduleFromModel(LoanScheduleModel model) {
|
||||||
|
|||||||
-4
@@ -28,7 +28,6 @@ import org.springframework.data.jpa.domain.AbstractPersistable;
|
|||||||
@Table(name = "m_product_loan_guarantee_details")
|
@Table(name = "m_product_loan_guarantee_details")
|
||||||
public class LoanProductGuaranteeDetails extends AbstractPersistable<Long> {
|
public class LoanProductGuaranteeDetails extends AbstractPersistable<Long> {
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
@OneToOne
|
@OneToOne
|
||||||
@JoinColumn(name = "loan_product_id", nullable = false)
|
@JoinColumn(name = "loan_product_id", nullable = false)
|
||||||
private LoanProduct loanProduct;
|
private LoanProduct loanProduct;
|
||||||
@@ -93,17 +92,14 @@ public class LoanProductGuaranteeDetails extends AbstractPersistable<Long> {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public BigDecimal getMandatoryGuarantee() {
|
public BigDecimal getMandatoryGuarantee() {
|
||||||
return this.mandatoryGuarantee;
|
return this.mandatoryGuarantee;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public BigDecimal getMinimumGuaranteeFromOwnFunds() {
|
public BigDecimal getMinimumGuaranteeFromOwnFunds() {
|
||||||
return this.minimumGuaranteeFromOwnFunds;
|
return this.minimumGuaranteeFromOwnFunds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public BigDecimal getMinimumGuaranteeFromGuarantor() {
|
public BigDecimal getMinimumGuaranteeFromGuarantor() {
|
||||||
return this.minimumGuaranteeFromGuarantor;
|
return this.minimumGuaranteeFromGuarantor;
|
||||||
}
|
}
|
||||||
|
|||||||
+29
-31
@@ -33,7 +33,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
@Service
|
@Service
|
||||||
public class SavingsAccountDomainServiceJpa implements SavingsAccountDomainService {
|
public class SavingsAccountDomainServiceJpa implements SavingsAccountDomainService {
|
||||||
|
|
||||||
private final PlatformSecurityContext context;
|
private final PlatformSecurityContext context;
|
||||||
private final SavingsAccountRepositoryWrapper savingsAccountRepository;
|
private final SavingsAccountRepositoryWrapper savingsAccountRepository;
|
||||||
private final SavingsAccountTransactionRepository savingsAccountTransactionRepository;
|
private final SavingsAccountTransactionRepository savingsAccountTransactionRepository;
|
||||||
private final ApplicationCurrencyRepositoryWrapper applicationCurrencyRepositoryWrapper;
|
private final ApplicationCurrencyRepositoryWrapper applicationCurrencyRepositoryWrapper;
|
||||||
@@ -45,8 +45,7 @@ public class SavingsAccountDomainServiceJpa implements SavingsAccountDomainServi
|
|||||||
final SavingsAccountTransactionRepository savingsAccountTransactionRepository,
|
final SavingsAccountTransactionRepository savingsAccountTransactionRepository,
|
||||||
final ApplicationCurrencyRepositoryWrapper applicationCurrencyRepositoryWrapper,
|
final ApplicationCurrencyRepositoryWrapper applicationCurrencyRepositoryWrapper,
|
||||||
final JournalEntryWritePlatformService journalEntryWritePlatformService,
|
final JournalEntryWritePlatformService journalEntryWritePlatformService,
|
||||||
final ConfigurationDomainService configurationDomainService,
|
final ConfigurationDomainService configurationDomainService, final PlatformSecurityContext context) {
|
||||||
final PlatformSecurityContext context) {
|
|
||||||
this.savingsAccountRepository = savingsAccountRepository;
|
this.savingsAccountRepository = savingsAccountRepository;
|
||||||
this.savingsAccountTransactionRepository = savingsAccountTransactionRepository;
|
this.savingsAccountTransactionRepository = savingsAccountTransactionRepository;
|
||||||
this.applicationCurrencyRepositoryWrapper = applicationCurrencyRepositoryWrapper;
|
this.applicationCurrencyRepositoryWrapper = applicationCurrencyRepositoryWrapper;
|
||||||
@@ -60,15 +59,11 @@ public class SavingsAccountDomainServiceJpa implements SavingsAccountDomainServi
|
|||||||
public SavingsAccountTransaction handleWithdrawal(final SavingsAccount account, final DateTimeFormatter fmt,
|
public SavingsAccountTransaction handleWithdrawal(final SavingsAccount account, final DateTimeFormatter fmt,
|
||||||
final LocalDate transactionDate, final BigDecimal transactionAmount, final PaymentDetail paymentDetail,
|
final LocalDate transactionDate, final BigDecimal transactionAmount, final PaymentDetail paymentDetail,
|
||||||
final SavingsTransactionBooleanValues transactionBooleanValues) {
|
final SavingsTransactionBooleanValues transactionBooleanValues) {
|
||||||
|
|
||||||
AppUser user = null;
|
AppUser user = getAppUserIfPresent();
|
||||||
if (this.context != null) {
|
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
||||||
user = this.context.authenticatedUser();
|
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
||||||
}
|
final Integer financialYearBeginningMonth = this.configurationDomainService.retrieveFinancialYearBeginningMonth();
|
||||||
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
|
||||||
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
|
||||||
final Integer financialYearBeginningMonth = this.configurationDomainService
|
|
||||||
.retrieveFinancialYearBeginningMonth();
|
|
||||||
|
|
||||||
if (transactionBooleanValues.isRegularTransaction() && !account.allowWithdrawal()) { throw new DepositAccountTransactionNotAllowedException(
|
if (transactionBooleanValues.isRegularTransaction() && !account.allowWithdrawal()) { throw new DepositAccountTransactionNotAllowedException(
|
||||||
account.getId(), "withdraw", account.depositAccountType()); }
|
account.getId(), "withdraw", account.depositAccountType()); }
|
||||||
@@ -82,14 +77,12 @@ public class SavingsAccountDomainServiceJpa implements SavingsAccountDomainServi
|
|||||||
final MathContext mc = MathContext.DECIMAL64;
|
final MathContext mc = MathContext.DECIMAL64;
|
||||||
if (account.isBeforeLastPostingPeriod(transactionDate)) {
|
if (account.isBeforeLastPostingPeriod(transactionDate)) {
|
||||||
final LocalDate today = DateUtils.getLocalDateOfTenant();
|
final LocalDate today = DateUtils.getLocalDateOfTenant();
|
||||||
account.postInterest(mc, today, transactionBooleanValues.isInterestTransfer(),
|
account.postInterest(mc, today, transactionBooleanValues.isInterestTransfer(), isSavingsInterestPostingAtCurrentPeriodEnd,
|
||||||
isSavingsInterestPostingAtCurrentPeriodEnd,
|
financialYearBeginningMonth);
|
||||||
financialYearBeginningMonth);
|
|
||||||
} else {
|
} else {
|
||||||
final LocalDate today = DateUtils.getLocalDateOfTenant();
|
final LocalDate today = DateUtils.getLocalDateOfTenant();
|
||||||
account.calculateInterestUsing(mc, today, transactionBooleanValues.isInterestTransfer(),
|
account.calculateInterestUsing(mc, today, transactionBooleanValues.isInterestTransfer(),
|
||||||
isSavingsInterestPostingAtCurrentPeriodEnd,
|
isSavingsInterestPostingAtCurrentPeriodEnd, financialYearBeginningMonth);
|
||||||
financialYearBeginningMonth);
|
|
||||||
}
|
}
|
||||||
account.validateAccountBalanceDoesNotBecomeNegative(transactionAmount, transactionBooleanValues.isWithdrawBalance());
|
account.validateAccountBalanceDoesNotBecomeNegative(transactionAmount, transactionBooleanValues.isWithdrawBalance());
|
||||||
saveTransactionToGenerateTransactionId(withdrawal);
|
saveTransactionToGenerateTransactionId(withdrawal);
|
||||||
@@ -100,20 +93,27 @@ public class SavingsAccountDomainServiceJpa implements SavingsAccountDomainServi
|
|||||||
return withdrawal;
|
return withdrawal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private AppUser getAppUserIfPresent() {
|
||||||
|
AppUser user = null;
|
||||||
|
if (this.context != null) {
|
||||||
|
user = this.context.getAuthenticatedUserIfPresent();
|
||||||
|
}
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public SavingsAccountTransaction handleDeposit(final SavingsAccount account, final DateTimeFormatter fmt,
|
public SavingsAccountTransaction handleDeposit(final SavingsAccount account, final DateTimeFormatter fmt,
|
||||||
final LocalDate transactionDate, final BigDecimal transactionAmount, final PaymentDetail paymentDetail,
|
final LocalDate transactionDate, final BigDecimal transactionAmount, final PaymentDetail paymentDetail,
|
||||||
final boolean isAccountTransfer, final boolean isRegularTransaction) {
|
final boolean isAccountTransfer, final boolean isRegularTransaction) {
|
||||||
|
|
||||||
AppUser user = null;
|
AppUser user = null;
|
||||||
if (this.context != null) {
|
if (this.context != null) {
|
||||||
user = this.context.authenticatedUser();
|
user = this.context.authenticatedUser();
|
||||||
}
|
}
|
||||||
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
||||||
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
||||||
final Integer financialYearBeginningMonth = this.configurationDomainService
|
final Integer financialYearBeginningMonth = this.configurationDomainService.retrieveFinancialYearBeginningMonth();
|
||||||
.retrieveFinancialYearBeginningMonth();
|
|
||||||
|
|
||||||
if (isRegularTransaction && !account.allowDeposit()) { throw new DepositAccountTransactionNotAllowedException(account.getId(),
|
if (isRegularTransaction && !account.allowDeposit()) { throw new DepositAccountTransactionNotAllowedException(account.getId(),
|
||||||
"deposit", account.depositAccountType()); }
|
"deposit", account.depositAccountType()); }
|
||||||
@@ -129,13 +129,11 @@ public class SavingsAccountDomainServiceJpa implements SavingsAccountDomainServi
|
|||||||
final MathContext mc = MathContext.DECIMAL64;
|
final MathContext mc = MathContext.DECIMAL64;
|
||||||
if (account.isBeforeLastPostingPeriod(transactionDate)) {
|
if (account.isBeforeLastPostingPeriod(transactionDate)) {
|
||||||
final LocalDate today = DateUtils.getLocalDateOfTenant();
|
final LocalDate today = DateUtils.getLocalDateOfTenant();
|
||||||
account.postInterest(mc, today, isInterestTransfer, isSavingsInterestPostingAtCurrentPeriodEnd,
|
account.postInterest(mc, today, isInterestTransfer, isSavingsInterestPostingAtCurrentPeriodEnd, financialYearBeginningMonth);
|
||||||
financialYearBeginningMonth);
|
|
||||||
} else {
|
} else {
|
||||||
final LocalDate today = DateUtils.getLocalDateOfTenant();
|
final LocalDate today = DateUtils.getLocalDateOfTenant();
|
||||||
account.calculateInterestUsing(mc, today, isInterestTransfer,
|
account.calculateInterestUsing(mc, today, isInterestTransfer, isSavingsInterestPostingAtCurrentPeriodEnd,
|
||||||
isSavingsInterestPostingAtCurrentPeriodEnd,
|
financialYearBeginningMonth);
|
||||||
financialYearBeginningMonth);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
saveTransactionToGenerateTransactionId(deposit);
|
saveTransactionToGenerateTransactionId(deposit);
|
||||||
|
|||||||
+41
-44
@@ -195,11 +195,11 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
|
|||||||
public void processPostActiveActions(final SavingsAccount account, final DateTimeFormatter fmt, final Set<Long> existingTransactionIds,
|
public void processPostActiveActions(final SavingsAccount account, final DateTimeFormatter fmt, final Set<Long> existingTransactionIds,
|
||||||
final Set<Long> existingReversedTransactionIds) {
|
final Set<Long> existingReversedTransactionIds) {
|
||||||
|
|
||||||
AppUser user = null;
|
AppUser user = null;
|
||||||
if (this.context != null) {
|
if (this.context != null) {
|
||||||
user = this.context.authenticatedUser();
|
user = this.context.authenticatedUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
||||||
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
||||||
final Integer financialYearBeginningMonth = this.configurationDomainService.retrieveFinancialYearBeginningMonth();
|
final Integer financialYearBeginningMonth = this.configurationDomainService.retrieveFinancialYearBeginningMonth();
|
||||||
@@ -297,11 +297,11 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
|
|||||||
@Override
|
@Override
|
||||||
public CommandProcessingResult applyAnnualFee(final Long savingsAccountChargeId, final Long accountId) {
|
public CommandProcessingResult applyAnnualFee(final Long savingsAccountChargeId, final Long accountId) {
|
||||||
|
|
||||||
AppUser user = null;
|
AppUser user = null;
|
||||||
if (this.context != null) {
|
if (this.context != null) {
|
||||||
user = this.context.authenticatedUser();
|
user = this.context.authenticatedUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
final SavingsAccountCharge savingsAccountCharge = this.savingsAccountChargeRepository.findOneWithNotFoundDetection(
|
final SavingsAccountCharge savingsAccountCharge = this.savingsAccountChargeRepository.findOneWithNotFoundDetection(
|
||||||
savingsAccountChargeId, accountId);
|
savingsAccountChargeId, accountId);
|
||||||
|
|
||||||
@@ -471,11 +471,11 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
|
|||||||
@Override
|
@Override
|
||||||
public CommandProcessingResult adjustSavingsTransaction(final Long savingsId, final Long transactionId, final JsonCommand command) {
|
public CommandProcessingResult adjustSavingsTransaction(final Long savingsId, final Long transactionId, final JsonCommand command) {
|
||||||
|
|
||||||
AppUser user = null;
|
AppUser user = null;
|
||||||
if (this.context != null) {
|
if (this.context != null) {
|
||||||
user = this.context.authenticatedUser();
|
user = this.context.authenticatedUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
||||||
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
||||||
final Integer financialYearBeginningMonth = this.configurationDomainService.retrieveFinancialYearBeginningMonth();
|
final Integer financialYearBeginningMonth = this.configurationDomainService.retrieveFinancialYearBeginningMonth();
|
||||||
@@ -640,11 +640,11 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
|
|||||||
@Override
|
@Override
|
||||||
public SavingsAccountTransaction initiateSavingsTransfer(final Long accountId, final LocalDate transferDate) {
|
public SavingsAccountTransaction initiateSavingsTransfer(final Long accountId, final LocalDate transferDate) {
|
||||||
|
|
||||||
AppUser user = null;
|
AppUser user = null;
|
||||||
if (this.context != null) {
|
if (this.context != null) {
|
||||||
user = this.context.authenticatedUser();
|
user = this.context.authenticatedUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
||||||
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
||||||
final Integer financialYearBeginningMonth = this.configurationDomainService.retrieveFinancialYearBeginningMonth();
|
final Integer financialYearBeginningMonth = this.configurationDomainService.retrieveFinancialYearBeginningMonth();
|
||||||
@@ -675,11 +675,11 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
|
|||||||
@Override
|
@Override
|
||||||
public SavingsAccountTransaction withdrawSavingsTransfer(final Long accountId, final LocalDate transferDate) {
|
public SavingsAccountTransaction withdrawSavingsTransfer(final Long accountId, final LocalDate transferDate) {
|
||||||
|
|
||||||
AppUser user = null;
|
AppUser user = null;
|
||||||
if (this.context != null) {
|
if (this.context != null) {
|
||||||
user = this.context.authenticatedUser();
|
user = this.context.authenticatedUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
||||||
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
||||||
final Integer financialYearBeginningMonth = this.configurationDomainService.retrieveFinancialYearBeginningMonth();
|
final Integer financialYearBeginningMonth = this.configurationDomainService.retrieveFinancialYearBeginningMonth();
|
||||||
@@ -718,11 +718,11 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
|
|||||||
public SavingsAccountTransaction acceptSavingsTransfer(final Long accountId, final LocalDate transferDate,
|
public SavingsAccountTransaction acceptSavingsTransfer(final Long accountId, final LocalDate transferDate,
|
||||||
final Office acceptedInOffice, final Staff fieldOfficer) {
|
final Office acceptedInOffice, final Staff fieldOfficer) {
|
||||||
|
|
||||||
AppUser user = null;
|
AppUser user = null;
|
||||||
if (this.context != null) {
|
if (this.context != null) {
|
||||||
user = this.context.authenticatedUser();
|
user = this.context.authenticatedUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
||||||
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
||||||
final Integer financialYearBeginningMonth = this.configurationDomainService.retrieveFinancialYearBeginningMonth();
|
final Integer financialYearBeginningMonth = this.configurationDomainService.retrieveFinancialYearBeginningMonth();
|
||||||
@@ -866,10 +866,10 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
|
|||||||
@Override
|
@Override
|
||||||
public CommandProcessingResult waiveCharge(final Long savingsAccountId, final Long savingsAccountChargeId) {
|
public CommandProcessingResult waiveCharge(final Long savingsAccountId, final Long savingsAccountChargeId) {
|
||||||
|
|
||||||
AppUser user = null;
|
AppUser user = null;
|
||||||
if (this.context != null) {
|
if (this.context != null) {
|
||||||
user = this.context.authenticatedUser();
|
user = this.context.authenticatedUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
||||||
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
||||||
@@ -939,11 +939,11 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
|
|||||||
@Override
|
@Override
|
||||||
public CommandProcessingResult payCharge(final Long savingsAccountId, final Long savingsAccountChargeId, final JsonCommand command) {
|
public CommandProcessingResult payCharge(final Long savingsAccountId, final Long savingsAccountChargeId, final JsonCommand command) {
|
||||||
|
|
||||||
AppUser user = null;
|
AppUser user = null;
|
||||||
if (this.context != null) {
|
if (this.context != null) {
|
||||||
user = this.context.authenticatedUser();
|
user = this.context.authenticatedUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.savingsAccountChargeDataValidator.validatePayCharge(command.json());
|
this.savingsAccountChargeDataValidator.validatePayCharge(command.json());
|
||||||
final Locale locale = command.extractLocale();
|
final Locale locale = command.extractLocale();
|
||||||
final DateTimeFormatter fmt = DateTimeFormat.forPattern(command.dateFormat()).withLocale(locale);
|
final DateTimeFormatter fmt = DateTimeFormat.forPattern(command.dateFormat()).withLocale(locale);
|
||||||
@@ -987,11 +987,8 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
|
|||||||
@Override
|
@Override
|
||||||
public void applyChargeDue(final Long savingsAccountChargeId, final Long accountId) {
|
public void applyChargeDue(final Long savingsAccountChargeId, final Long accountId) {
|
||||||
// always use current date as transaction date for batch job
|
// always use current date as transaction date for batch job
|
||||||
AppUser user = null;
|
AppUser user = null;
|
||||||
if (this.context != null) {
|
|
||||||
user = this.context.authenticatedUser();
|
|
||||||
}
|
|
||||||
|
|
||||||
final LocalDate transactionDate = DateUtils.getLocalDateOfTenant();
|
final LocalDate transactionDate = DateUtils.getLocalDateOfTenant();
|
||||||
final SavingsAccountCharge savingsAccountCharge = this.savingsAccountChargeRepository.findOneWithNotFoundDetection(
|
final SavingsAccountCharge savingsAccountCharge = this.savingsAccountChargeRepository.findOneWithNotFoundDetection(
|
||||||
savingsAccountChargeId, accountId);
|
savingsAccountChargeId, accountId);
|
||||||
|
|||||||
Reference in New Issue
Block a user