fixing failing Client integration tests
This commit is contained in:
+2
-2
@@ -16,8 +16,8 @@ public interface PlatformSecurityContext {
|
|||||||
* Convenience method returns null (does not throw an exception) if an
|
* Convenience method returns null (does not throw an exception) if an
|
||||||
* authenticated user is not present
|
* authenticated user is not present
|
||||||
*
|
*
|
||||||
* Mainly used in methods that can be triggered via both the API and batch
|
* To be used only in service layer methods that can be triggered via both
|
||||||
* Jobs (which do not have an authenticated user)
|
* the API and batch Jobs (which do not have an authenticated user)
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|||||||
+21
-16
@@ -125,7 +125,7 @@ public class LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa
|
|||||||
private final LoanReadPlatformService loanReadPlatformService;
|
private final LoanReadPlatformService loanReadPlatformService;
|
||||||
private final LoanRepaymentScheduleInstallmentRepository repaymentScheduleInstallmentRepository;
|
private final LoanRepaymentScheduleInstallmentRepository repaymentScheduleInstallmentRepository;
|
||||||
private final LoanAccountDomainService loanAccountDomainService;
|
private final LoanAccountDomainService loanAccountDomainService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public LoanApplicationWritePlatformServiceJpaRepositoryImpl(final PlatformSecurityContext context, final FromJsonHelper fromJsonHelper,
|
public LoanApplicationWritePlatformServiceJpaRepositoryImpl(final PlatformSecurityContext context, final FromJsonHelper fromJsonHelper,
|
||||||
final LoanApplicationTransitionApiJsonValidator loanApplicationTransitionApiJsonValidator,
|
final LoanApplicationTransitionApiJsonValidator loanApplicationTransitionApiJsonValidator,
|
||||||
@@ -166,7 +166,7 @@ public class LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa
|
|||||||
this.repaymentScheduleInstallmentRepository = repaymentScheduleInstallmentRepository;
|
this.repaymentScheduleInstallmentRepository = repaymentScheduleInstallmentRepository;
|
||||||
this.loanReadPlatformService = loanReadPlatformService;
|
this.loanReadPlatformService = loanReadPlatformService;
|
||||||
this.loanAccountDomainService = loanAccountDomainService;
|
this.loanAccountDomainService = loanAccountDomainService;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private LoanLifecycleStateMachine defaultLoanLifecycleStateMachine() {
|
private LoanLifecycleStateMachine defaultLoanLifecycleStateMachine() {
|
||||||
@@ -179,7 +179,7 @@ public class LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa
|
|||||||
public CommandProcessingResult submitApplication(final JsonCommand command) {
|
public CommandProcessingResult submitApplication(final JsonCommand command) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final AppUser currentUser = this.context.authenticatedUser();
|
final AppUser currentUser = getAppUserIfPresent();
|
||||||
|
|
||||||
this.fromApiJsonDeserializer.validateForCreate(command.json());
|
this.fromApiJsonDeserializer.validateForCreate(command.json());
|
||||||
|
|
||||||
@@ -360,7 +360,7 @@ public class LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa
|
|||||||
public CommandProcessingResult modifyApplication(final Long loanId, final JsonCommand command) {
|
public CommandProcessingResult modifyApplication(final Long loanId, final JsonCommand command) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
AppUser currentUser = this.context.authenticatedUser();
|
AppUser currentUser = getAppUserIfPresent();
|
||||||
|
|
||||||
this.fromApiJsonDeserializer.validateForModify(command.json());
|
this.fromApiJsonDeserializer.validateForModify(command.json());
|
||||||
|
|
||||||
@@ -389,13 +389,12 @@ public class LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa
|
|||||||
* If there are any charges already present, which are now not
|
* If there are any charges already present, which are now not
|
||||||
* passed in as a part of the request, deem the charges as modified
|
* passed in as a part of the request, deem the charges as modified
|
||||||
**/
|
**/
|
||||||
if(!possiblyModifedLoanCharges.isEmpty()){
|
if (!possiblyModifedLoanCharges.isEmpty()) {
|
||||||
if (!possiblyModifedLoanCharges.containsAll(existingCharges)) {
|
if (!possiblyModifedLoanCharges.containsAll(existingCharges)) {
|
||||||
isChargeModified = true;
|
isChargeModified = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If any new charges are added or values of existing charges are
|
* If any new charges are added or values of existing charges are
|
||||||
* modified
|
* modified
|
||||||
@@ -697,8 +696,6 @@ public class LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa
|
|||||||
@Override
|
@Override
|
||||||
public CommandProcessingResult deleteApplication(final Long loanId) {
|
public CommandProcessingResult deleteApplication(final Long loanId) {
|
||||||
|
|
||||||
this.context.authenticatedUser();
|
|
||||||
|
|
||||||
final Loan loan = retrieveLoanBy(loanId);
|
final Loan loan = retrieveLoanBy(loanId);
|
||||||
checkClientOrGroupActive(loan);
|
checkClientOrGroupActive(loan);
|
||||||
|
|
||||||
@@ -722,7 +719,7 @@ public class LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa
|
|||||||
@Override
|
@Override
|
||||||
public CommandProcessingResult approveApplication(final Long loanId, final JsonCommand command) {
|
public CommandProcessingResult approveApplication(final Long loanId, final JsonCommand command) {
|
||||||
|
|
||||||
final AppUser currentUser = this.context.authenticatedUser();
|
final AppUser currentUser = getAppUserIfPresent();
|
||||||
|
|
||||||
this.loanApplicationTransitionApiJsonValidator.validateApproval(command.json());
|
this.loanApplicationTransitionApiJsonValidator.validateApproval(command.json());
|
||||||
|
|
||||||
@@ -764,7 +761,7 @@ public class LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa
|
|||||||
@Override
|
@Override
|
||||||
public CommandProcessingResult undoApplicationApproval(final Long loanId, final JsonCommand command) {
|
public CommandProcessingResult undoApplicationApproval(final Long loanId, final JsonCommand command) {
|
||||||
|
|
||||||
AppUser currentUser = this.context.authenticatedUser();
|
AppUser currentUser = getAppUserIfPresent();
|
||||||
|
|
||||||
this.fromApiJsonDeserializer.validateForUndo(command.json());
|
this.fromApiJsonDeserializer.validateForUndo(command.json());
|
||||||
|
|
||||||
@@ -773,16 +770,16 @@ public class LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa
|
|||||||
|
|
||||||
final Map<String, Object> changes = loan.undoApproval(defaultLoanLifecycleStateMachine());
|
final Map<String, Object> changes = loan.undoApproval(defaultLoanLifecycleStateMachine());
|
||||||
if (!changes.isEmpty()) {
|
if (!changes.isEmpty()) {
|
||||||
|
|
||||||
// If loan approved amount is not same as loan amount demanded, then
|
// If loan approved amount is not same as loan amount demanded, then
|
||||||
// during undo, restore the demand amount to principal amount.
|
// during undo, restore the demand amount to principal amount.
|
||||||
|
|
||||||
if (changes.containsKey(LoanApiConstants.approvedLoanAmountParameterName)
|
if (changes.containsKey(LoanApiConstants.approvedLoanAmountParameterName)
|
||||||
|| changes.containsKey(LoanApiConstants.disbursementPrincipalParameterName )) {
|
|| changes.containsKey(LoanApiConstants.disbursementPrincipalParameterName)) {
|
||||||
ScheduleGeneratorDTO scheduleGeneratorDTO = loanAccountDomainService.buildScheduleGeneratorDTO(loan);
|
ScheduleGeneratorDTO scheduleGeneratorDTO = loanAccountDomainService.buildScheduleGeneratorDTO(loan);
|
||||||
loan.regenerateRepaymentSchedule(scheduleGeneratorDTO, currentUser);
|
loan.regenerateRepaymentSchedule(scheduleGeneratorDTO, currentUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.loanRepository.save(loan);
|
this.loanRepository.save(loan);
|
||||||
|
|
||||||
final String noteText = command.stringValueOfParameterNamed("note");
|
final String noteText = command.stringValueOfParameterNamed("note");
|
||||||
@@ -807,7 +804,7 @@ public class LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa
|
|||||||
@Override
|
@Override
|
||||||
public CommandProcessingResult rejectApplication(final Long loanId, final JsonCommand command) {
|
public CommandProcessingResult rejectApplication(final Long loanId, final JsonCommand command) {
|
||||||
|
|
||||||
final AppUser currentUser = this.context.authenticatedUser();
|
final AppUser currentUser = getAppUserIfPresent();
|
||||||
|
|
||||||
this.loanApplicationTransitionApiJsonValidator.validateRejection(command.json());
|
this.loanApplicationTransitionApiJsonValidator.validateRejection(command.json());
|
||||||
|
|
||||||
@@ -840,7 +837,7 @@ public class LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa
|
|||||||
@Override
|
@Override
|
||||||
public CommandProcessingResult applicantWithdrawsFromApplication(final Long loanId, final JsonCommand command) {
|
public CommandProcessingResult applicantWithdrawsFromApplication(final Long loanId, final JsonCommand command) {
|
||||||
|
|
||||||
final AppUser currentUser = this.context.authenticatedUser();
|
final AppUser currentUser = getAppUserIfPresent();
|
||||||
|
|
||||||
this.loanApplicationTransitionApiJsonValidator.validateApplicantWithdrawal(command.json());
|
this.loanApplicationTransitionApiJsonValidator.validateApplicantWithdrawal(command.json());
|
||||||
|
|
||||||
@@ -937,4 +934,12 @@ public class LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private AppUser getAppUserIfPresent() {
|
||||||
|
AppUser user = null;
|
||||||
|
if (this.context != null) {
|
||||||
|
user = this.context.getAuthenticatedUserIfPresent();
|
||||||
|
}
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+15
-22
@@ -1374,10 +1374,7 @@ 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 = getAppUserIfPresent();
|
||||||
if (this.context != null) {
|
|
||||||
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);
|
||||||
@@ -1774,10 +1771,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
|||||||
@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 = getAppUserIfPresent();
|
||||||
if (this.context != null) {
|
|
||||||
currentUser = this.context.authenticatedUser();
|
|
||||||
}
|
|
||||||
|
|
||||||
final Loan loan = this.loanAssembler.assembleFrom(accountId);
|
final Loan loan = this.loanAssembler.assembleFrom(accountId);
|
||||||
checkClientOrGroupActive(loan);
|
checkClientOrGroupActive(loan);
|
||||||
@@ -1803,10 +1797,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
|||||||
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 = getAppUserIfPresent();
|
||||||
if (this.context != null) {
|
|
||||||
currentUser = this.context.authenticatedUser();
|
|
||||||
}
|
|
||||||
|
|
||||||
final Loan loan = this.loanAssembler.assembleFrom(accountId);
|
final Loan loan = this.loanAssembler.assembleFrom(accountId);
|
||||||
|
|
||||||
@@ -1837,10 +1828,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
|||||||
@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 = getAppUserIfPresent();
|
||||||
if (this.context != null) {
|
|
||||||
currentUser = this.context.authenticatedUser();
|
|
||||||
}
|
|
||||||
|
|
||||||
final Loan loan = this.loanAssembler.assembleFrom(accountId);
|
final Loan loan = this.loanAssembler.assembleFrom(accountId);
|
||||||
|
|
||||||
@@ -2389,7 +2377,7 @@ 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 = getAppUserIfPresent();
|
||||||
|
|
||||||
final Loan loan = this.loanAssembler.assembleFrom(loanId);
|
final Loan loan = this.loanAssembler.assembleFrom(loanId);
|
||||||
checkClientOrGroupActive(loan);
|
checkClientOrGroupActive(loan);
|
||||||
@@ -2593,10 +2581,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
|||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void recalculateInterest(final long loanId) {
|
public void recalculateInterest(final long loanId) {
|
||||||
AppUser currentUser = null;
|
AppUser currentUser = getAppUserIfPresent();
|
||||||
if (this.context != null) {
|
|
||||||
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;
|
||||||
@@ -2662,7 +2647,7 @@ 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 = getAppUserIfPresent();
|
||||||
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, currentUser);
|
loan.regenerateScheduleOnDisbursement(scheduleGeneratorDTO, recalculateSchedule, actualDisbursementDate, emiAmount, currentUser);
|
||||||
@@ -2683,4 +2668,12 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
|||||||
return installments;
|
return installments;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private AppUser getAppUserIfPresent() {
|
||||||
|
AppUser user = null;
|
||||||
|
if (this.context != null) {
|
||||||
|
user = this.context.getAuthenticatedUserIfPresent();
|
||||||
|
}
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+12
-7
@@ -89,7 +89,7 @@ import com.google.gson.JsonObject;
|
|||||||
@Service
|
@Service
|
||||||
public class DepositAccountAssembler {
|
public class DepositAccountAssembler {
|
||||||
|
|
||||||
private final PlatformSecurityContext context;
|
private final PlatformSecurityContext context;
|
||||||
private final SavingsAccountTransactionSummaryWrapper savingsAccountTransactionSummaryWrapper;
|
private final SavingsAccountTransactionSummaryWrapper savingsAccountTransactionSummaryWrapper;
|
||||||
private final SavingsHelper savingsHelper;
|
private final SavingsHelper savingsHelper;
|
||||||
private final ClientRepositoryWrapper clientRepository;
|
private final ClientRepositoryWrapper clientRepository;
|
||||||
@@ -110,8 +110,7 @@ public class DepositAccountAssembler {
|
|||||||
final SavingsAccountChargeAssembler savingsAccountChargeAssembler, final FromJsonHelper fromApiJsonHelper,
|
final SavingsAccountChargeAssembler savingsAccountChargeAssembler, final FromJsonHelper fromApiJsonHelper,
|
||||||
final DepositProductAssembler depositProductAssembler,
|
final DepositProductAssembler depositProductAssembler,
|
||||||
final RecurringDepositProductRepository recurringDepositProductRepository,
|
final RecurringDepositProductRepository recurringDepositProductRepository,
|
||||||
final AccountTransfersReadPlatformService accountTransfersReadPlatformService,
|
final AccountTransfersReadPlatformService accountTransfersReadPlatformService, final PlatformSecurityContext context) {
|
||||||
final PlatformSecurityContext context) {
|
|
||||||
|
|
||||||
this.savingsAccountTransactionSummaryWrapper = savingsAccountTransactionSummaryWrapper;
|
this.savingsAccountTransactionSummaryWrapper = savingsAccountTransactionSummaryWrapper;
|
||||||
this.clientRepository = clientRepository;
|
this.clientRepository = clientRepository;
|
||||||
@@ -394,10 +393,7 @@ public class DepositAccountAssembler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Collection<SavingsAccountTransactionDTO> assembleBulkMandatorySavingsAccountTransactionDTOs(final JsonCommand command) {
|
public Collection<SavingsAccountTransactionDTO> assembleBulkMandatorySavingsAccountTransactionDTOs(final JsonCommand command) {
|
||||||
AppUser user = null;
|
AppUser user = getAppUserIfPresent();
|
||||||
if (this.context != null) {
|
|
||||||
user = this.context.authenticatedUser();
|
|
||||||
}
|
|
||||||
final String json = command.json();
|
final String json = command.json();
|
||||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||||
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
||||||
@@ -428,4 +424,13 @@ public class DepositAccountAssembler {
|
|||||||
|
|
||||||
return savingsAccountTransactions;
|
return savingsAccountTransactions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private AppUser getAppUserIfPresent() {
|
||||||
|
AppUser user = null;
|
||||||
|
if (this.context != null) {
|
||||||
|
user = this.context.getAuthenticatedUserIfPresent();
|
||||||
|
}
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+1
-4
@@ -107,10 +107,7 @@ public class SavingsAccountDomainServiceJpa implements SavingsAccountDomainServi
|
|||||||
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 = getAppUserIfPresent();
|
||||||
if (this.context != null) {
|
|
||||||
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();
|
||||||
|
|||||||
+20
-30
@@ -583,11 +583,8 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommandProcessingResult adjustRDTransaction(final Long savingsId, final Long transactionId, final JsonCommand command) {
|
public CommandProcessingResult adjustRDTransaction(final Long savingsId, final Long transactionId, final JsonCommand command) {
|
||||||
|
|
||||||
AppUser user = null;
|
AppUser user = getAppUserIfPresent();
|
||||||
if (this.context != null) {
|
|
||||||
user = this.context.authenticatedUser();
|
|
||||||
}
|
|
||||||
|
|
||||||
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
||||||
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
||||||
@@ -830,10 +827,7 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo
|
|||||||
public SavingsAccountTransaction initiateSavingsTransfer(final Long accountId, final LocalDate transferDate,
|
public SavingsAccountTransaction initiateSavingsTransfer(final Long accountId, final LocalDate transferDate,
|
||||||
final DepositAccountType depositAccountType) {
|
final DepositAccountType depositAccountType) {
|
||||||
|
|
||||||
AppUser user = null;
|
AppUser user = getAppUserIfPresent();
|
||||||
if (this.context != null) {
|
|
||||||
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();
|
||||||
@@ -864,11 +858,8 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo
|
|||||||
@Override
|
@Override
|
||||||
public SavingsAccountTransaction withdrawSavingsTransfer(final Long accountId, final LocalDate transferDate,
|
public SavingsAccountTransaction withdrawSavingsTransfer(final Long accountId, final LocalDate transferDate,
|
||||||
final DepositAccountType depositAccountType) {
|
final DepositAccountType depositAccountType) {
|
||||||
|
|
||||||
AppUser user = null;
|
AppUser user = getAppUserIfPresent();
|
||||||
if (this.context != null) {
|
|
||||||
user = this.context.authenticatedUser();
|
|
||||||
}
|
|
||||||
|
|
||||||
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
||||||
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
||||||
@@ -908,11 +899,8 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo
|
|||||||
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 DepositAccountType depositAccountType) {
|
final Office acceptedInOffice, final Staff fieldOfficer, final DepositAccountType depositAccountType) {
|
||||||
|
|
||||||
AppUser user = null;
|
AppUser user = getAppUserIfPresent();
|
||||||
if (this.context != null) {
|
|
||||||
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();
|
||||||
@@ -1057,10 +1045,7 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo
|
|||||||
public CommandProcessingResult waiveCharge(final Long savingsAccountId, final Long savingsAccountChargeId,
|
public CommandProcessingResult waiveCharge(final Long savingsAccountId, final Long savingsAccountChargeId,
|
||||||
@SuppressWarnings("unused") final DepositAccountType depositAccountType) {
|
@SuppressWarnings("unused") final DepositAccountType depositAccountType) {
|
||||||
|
|
||||||
AppUser user = null;
|
AppUser user = getAppUserIfPresent();
|
||||||
if (this.context != null) {
|
|
||||||
user = this.context.authenticatedUser();
|
|
||||||
}
|
|
||||||
|
|
||||||
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
||||||
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
||||||
@@ -1131,8 +1116,8 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo
|
|||||||
public CommandProcessingResult payCharge(final Long savingsAccountId, final Long savingsAccountChargeId, final JsonCommand command,
|
public CommandProcessingResult payCharge(final Long savingsAccountId, final Long savingsAccountChargeId, final JsonCommand command,
|
||||||
@SuppressWarnings("unused") final DepositAccountType depositAccountType) {
|
@SuppressWarnings("unused") final DepositAccountType depositAccountType) {
|
||||||
|
|
||||||
this.context.authenticatedUser();
|
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);
|
||||||
@@ -1191,11 +1176,8 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo
|
|||||||
@Transactional
|
@Transactional
|
||||||
private void payCharge(final SavingsAccountCharge savingsAccountCharge, final LocalDate transactionDate, final BigDecimal amountPaid,
|
private void payCharge(final SavingsAccountCharge savingsAccountCharge, final LocalDate transactionDate, final BigDecimal amountPaid,
|
||||||
final DateTimeFormatter formatter) {
|
final DateTimeFormatter formatter) {
|
||||||
|
|
||||||
AppUser user = null;
|
AppUser user = getAppUserIfPresent();
|
||||||
if (this.context != null) {
|
|
||||||
user = this.context.authenticatedUser();
|
|
||||||
}
|
|
||||||
|
|
||||||
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
||||||
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
||||||
@@ -1277,4 +1259,12 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo
|
|||||||
accountTransactionDTO.getPaymentDetail(), isRegularTransaction);
|
accountTransactionDTO.getPaymentDetail(), isRegularTransaction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private AppUser getAppUserIfPresent() {
|
||||||
|
AppUser user = null;
|
||||||
|
if (this.context != null) {
|
||||||
|
user = this.context.getAuthenticatedUserIfPresent();
|
||||||
|
}
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+17
-32
@@ -195,10 +195,7 @@ 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 = getAppUserIfPresent();
|
||||||
if (this.context != null) {
|
|
||||||
user = this.context.authenticatedUser();
|
|
||||||
}
|
|
||||||
|
|
||||||
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
||||||
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
||||||
@@ -297,10 +294,7 @@ 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 = getAppUserIfPresent();
|
||||||
if (this.context != null) {
|
|
||||||
user = this.context.authenticatedUser();
|
|
||||||
}
|
|
||||||
|
|
||||||
final SavingsAccountCharge savingsAccountCharge = this.savingsAccountChargeRepository.findOneWithNotFoundDetection(
|
final SavingsAccountCharge savingsAccountCharge = this.savingsAccountChargeRepository.findOneWithNotFoundDetection(
|
||||||
savingsAccountChargeId, accountId);
|
savingsAccountChargeId, accountId);
|
||||||
@@ -471,10 +465,7 @@ 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 = getAppUserIfPresent();
|
||||||
if (this.context != null) {
|
|
||||||
user = this.context.authenticatedUser();
|
|
||||||
}
|
|
||||||
|
|
||||||
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
||||||
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
||||||
@@ -640,10 +631,7 @@ 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 = getAppUserIfPresent();
|
||||||
if (this.context != null) {
|
|
||||||
user = this.context.authenticatedUser();
|
|
||||||
}
|
|
||||||
|
|
||||||
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
||||||
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
||||||
@@ -675,10 +663,7 @@ 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 = getAppUserIfPresent();
|
||||||
if (this.context != null) {
|
|
||||||
user = this.context.authenticatedUser();
|
|
||||||
}
|
|
||||||
|
|
||||||
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
||||||
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
||||||
@@ -718,10 +703,7 @@ 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 = getAppUserIfPresent();
|
||||||
if (this.context != null) {
|
|
||||||
user = this.context.authenticatedUser();
|
|
||||||
}
|
|
||||||
|
|
||||||
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
||||||
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
||||||
@@ -866,10 +848,7 @@ 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 = getAppUserIfPresent();
|
||||||
if (this.context != null) {
|
|
||||||
user = this.context.authenticatedUser();
|
|
||||||
}
|
|
||||||
|
|
||||||
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
||||||
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
||||||
@@ -939,10 +918,7 @@ 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 = getAppUserIfPresent();
|
||||||
if (this.context != null) {
|
|
||||||
user = this.context.authenticatedUser();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.savingsAccountChargeDataValidator.validatePayCharge(command.json());
|
this.savingsAccountChargeDataValidator.validatePayCharge(command.json());
|
||||||
final Locale locale = command.extractLocale();
|
final Locale locale = command.extractLocale();
|
||||||
@@ -1186,4 +1162,13 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
|
|||||||
.with(actualChanges) //
|
.with(actualChanges) //
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private AppUser getAppUserIfPresent() {
|
||||||
|
AppUser user = null;
|
||||||
|
if (this.context != null) {
|
||||||
|
user = this.context.getAuthenticatedUserIfPresent();
|
||||||
|
}
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user