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