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
|
||||
* 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)
|
||||
* To be used only in service layer methods that can be triggered via both
|
||||
* the API and batch Jobs (which do not have an authenticated user)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
+21
-16
@@ -125,7 +125,7 @@ public class LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa
|
||||
private final LoanReadPlatformService loanReadPlatformService;
|
||||
private final LoanRepaymentScheduleInstallmentRepository repaymentScheduleInstallmentRepository;
|
||||
private final LoanAccountDomainService loanAccountDomainService;
|
||||
|
||||
|
||||
@Autowired
|
||||
public LoanApplicationWritePlatformServiceJpaRepositoryImpl(final PlatformSecurityContext context, final FromJsonHelper fromJsonHelper,
|
||||
final LoanApplicationTransitionApiJsonValidator loanApplicationTransitionApiJsonValidator,
|
||||
@@ -166,7 +166,7 @@ public class LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa
|
||||
this.repaymentScheduleInstallmentRepository = repaymentScheduleInstallmentRepository;
|
||||
this.loanReadPlatformService = loanReadPlatformService;
|
||||
this.loanAccountDomainService = loanAccountDomainService;
|
||||
|
||||
|
||||
}
|
||||
|
||||
private LoanLifecycleStateMachine defaultLoanLifecycleStateMachine() {
|
||||
@@ -179,7 +179,7 @@ public class LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa
|
||||
public CommandProcessingResult submitApplication(final JsonCommand command) {
|
||||
|
||||
try {
|
||||
final AppUser currentUser = this.context.authenticatedUser();
|
||||
final AppUser currentUser = getAppUserIfPresent();
|
||||
|
||||
this.fromApiJsonDeserializer.validateForCreate(command.json());
|
||||
|
||||
@@ -360,7 +360,7 @@ public class LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa
|
||||
public CommandProcessingResult modifyApplication(final Long loanId, final JsonCommand command) {
|
||||
|
||||
try {
|
||||
AppUser currentUser = this.context.authenticatedUser();
|
||||
AppUser currentUser = getAppUserIfPresent();
|
||||
|
||||
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
|
||||
* passed in as a part of the request, deem the charges as modified
|
||||
**/
|
||||
if(!possiblyModifedLoanCharges.isEmpty()){
|
||||
if (!possiblyModifedLoanCharges.isEmpty()) {
|
||||
if (!possiblyModifedLoanCharges.containsAll(existingCharges)) {
|
||||
isChargeModified = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* If any new charges are added or values of existing charges are
|
||||
* modified
|
||||
@@ -697,8 +696,6 @@ public class LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa
|
||||
@Override
|
||||
public CommandProcessingResult deleteApplication(final Long loanId) {
|
||||
|
||||
this.context.authenticatedUser();
|
||||
|
||||
final Loan loan = retrieveLoanBy(loanId);
|
||||
checkClientOrGroupActive(loan);
|
||||
|
||||
@@ -722,7 +719,7 @@ public class LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa
|
||||
@Override
|
||||
public CommandProcessingResult approveApplication(final Long loanId, final JsonCommand command) {
|
||||
|
||||
final AppUser currentUser = this.context.authenticatedUser();
|
||||
final AppUser currentUser = getAppUserIfPresent();
|
||||
|
||||
this.loanApplicationTransitionApiJsonValidator.validateApproval(command.json());
|
||||
|
||||
@@ -764,7 +761,7 @@ public class LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa
|
||||
@Override
|
||||
public CommandProcessingResult undoApplicationApproval(final Long loanId, final JsonCommand command) {
|
||||
|
||||
AppUser currentUser = this.context.authenticatedUser();
|
||||
AppUser currentUser = getAppUserIfPresent();
|
||||
|
||||
this.fromApiJsonDeserializer.validateForUndo(command.json());
|
||||
|
||||
@@ -773,16 +770,16 @@ public class LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa
|
||||
|
||||
final Map<String, Object> changes = loan.undoApproval(defaultLoanLifecycleStateMachine());
|
||||
if (!changes.isEmpty()) {
|
||||
|
||||
|
||||
// If loan approved amount is not same as loan amount demanded, then
|
||||
// during undo, restore the demand amount to principal amount.
|
||||
|
||||
|
||||
if (changes.containsKey(LoanApiConstants.approvedLoanAmountParameterName)
|
||||
|| changes.containsKey(LoanApiConstants.disbursementPrincipalParameterName )) {
|
||||
|| changes.containsKey(LoanApiConstants.disbursementPrincipalParameterName)) {
|
||||
ScheduleGeneratorDTO scheduleGeneratorDTO = loanAccountDomainService.buildScheduleGeneratorDTO(loan);
|
||||
loan.regenerateRepaymentSchedule(scheduleGeneratorDTO, currentUser);
|
||||
}
|
||||
|
||||
|
||||
this.loanRepository.save(loan);
|
||||
|
||||
final String noteText = command.stringValueOfParameterNamed("note");
|
||||
@@ -807,7 +804,7 @@ public class LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa
|
||||
@Override
|
||||
public CommandProcessingResult rejectApplication(final Long loanId, final JsonCommand command) {
|
||||
|
||||
final AppUser currentUser = this.context.authenticatedUser();
|
||||
final AppUser currentUser = getAppUserIfPresent();
|
||||
|
||||
this.loanApplicationTransitionApiJsonValidator.validateRejection(command.json());
|
||||
|
||||
@@ -840,7 +837,7 @@ public class LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa
|
||||
@Override
|
||||
public CommandProcessingResult applicantWithdrawsFromApplication(final Long loanId, final JsonCommand command) {
|
||||
|
||||
final AppUser currentUser = this.context.authenticatedUser();
|
||||
final AppUser currentUser = getAppUserIfPresent();
|
||||
|
||||
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) {
|
||||
|
||||
AppUser currentUser = null;
|
||||
if (this.context != null) {
|
||||
currentUser = this.context.authenticatedUser();
|
||||
}
|
||||
AppUser currentUser = getAppUserIfPresent();
|
||||
if (!loan.hasCurrencyCodeOf(chargeDefinition.getCurrencyCode())) {
|
||||
final String errorMessage = "Charge and Loan must have the same currency.";
|
||||
throw new InvalidCurrencyException("loanCharge", "attach.to.loan", errorMessage);
|
||||
@@ -1774,10 +1771,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
@Override
|
||||
public LoanTransaction initiateLoanTransfer(final Long accountId, final LocalDate transferDate) {
|
||||
|
||||
AppUser currentUser = null;
|
||||
if (this.context != null) {
|
||||
currentUser = this.context.authenticatedUser();
|
||||
}
|
||||
AppUser currentUser = getAppUserIfPresent();
|
||||
|
||||
final Loan loan = this.loanAssembler.assembleFrom(accountId);
|
||||
checkClientOrGroupActive(loan);
|
||||
@@ -1803,10 +1797,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
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 = getAppUserIfPresent();
|
||||
|
||||
final Loan loan = this.loanAssembler.assembleFrom(accountId);
|
||||
|
||||
@@ -1837,10 +1828,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
@Override
|
||||
public LoanTransaction withdrawLoanTransfer(final Long accountId, final LocalDate transferDate) {
|
||||
|
||||
AppUser currentUser = null;
|
||||
if (this.context != null) {
|
||||
currentUser = this.context.authenticatedUser();
|
||||
}
|
||||
AppUser currentUser = getAppUserIfPresent();
|
||||
|
||||
final Loan loan = this.loanAssembler.assembleFrom(accountId);
|
||||
|
||||
@@ -2389,7 +2377,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
|
||||
@Override
|
||||
public CommandProcessingResult undoWriteOff(Long loanId) {
|
||||
final AppUser currentUser = this.context.authenticatedUser();
|
||||
final AppUser currentUser = getAppUserIfPresent();
|
||||
|
||||
final Loan loan = this.loanAssembler.assembleFrom(loanId);
|
||||
checkClientOrGroupActive(loan);
|
||||
@@ -2593,10 +2581,7 @@ 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 = getAppUserIfPresent();
|
||||
Loan loan = this.loanAssembler.assembleFrom(loanId);
|
||||
CalendarInstance restCalendarInstance = 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,
|
||||
final ScheduleGeneratorDTO scheduleGeneratorDTO) {
|
||||
AppUser currentUser = this.context.authenticatedUser();
|
||||
AppUser currentUser = getAppUserIfPresent();
|
||||
final LocalDate actualDisbursementDate = command.localDateValueOfParameterNamed("actualDisbursementDate");
|
||||
BigDecimal emiAmount = command.bigDecimalValueOfParameterNamed(LoanApiConstants.emiAmountParameterName);
|
||||
loan.regenerateScheduleOnDisbursement(scheduleGeneratorDTO, recalculateSchedule, actualDisbursementDate, emiAmount, currentUser);
|
||||
@@ -2683,4 +2668,12 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
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
|
||||
public class DepositAccountAssembler {
|
||||
|
||||
private final PlatformSecurityContext context;
|
||||
private final PlatformSecurityContext context;
|
||||
private final SavingsAccountTransactionSummaryWrapper savingsAccountTransactionSummaryWrapper;
|
||||
private final SavingsHelper savingsHelper;
|
||||
private final ClientRepositoryWrapper clientRepository;
|
||||
@@ -110,8 +110,7 @@ public class DepositAccountAssembler {
|
||||
final SavingsAccountChargeAssembler savingsAccountChargeAssembler, final FromJsonHelper fromApiJsonHelper,
|
||||
final DepositProductAssembler depositProductAssembler,
|
||||
final RecurringDepositProductRepository recurringDepositProductRepository,
|
||||
final AccountTransfersReadPlatformService accountTransfersReadPlatformService,
|
||||
final PlatformSecurityContext context) {
|
||||
final AccountTransfersReadPlatformService accountTransfersReadPlatformService, final PlatformSecurityContext context) {
|
||||
|
||||
this.savingsAccountTransactionSummaryWrapper = savingsAccountTransactionSummaryWrapper;
|
||||
this.clientRepository = clientRepository;
|
||||
@@ -394,10 +393,7 @@ public class DepositAccountAssembler {
|
||||
}
|
||||
|
||||
public Collection<SavingsAccountTransactionDTO> assembleBulkMandatorySavingsAccountTransactionDTOs(final JsonCommand command) {
|
||||
AppUser user = null;
|
||||
if (this.context != null) {
|
||||
user = this.context.authenticatedUser();
|
||||
}
|
||||
AppUser user = getAppUserIfPresent();
|
||||
final String json = command.json();
|
||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
||||
@@ -428,4 +424,13 @@ public class DepositAccountAssembler {
|
||||
|
||||
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 boolean isAccountTransfer, final boolean isRegularTransaction) {
|
||||
|
||||
AppUser user = null;
|
||||
if (this.context != null) {
|
||||
user = this.context.authenticatedUser();
|
||||
}
|
||||
AppUser user = getAppUserIfPresent();
|
||||
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
||||
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
||||
final Integer financialYearBeginningMonth = this.configurationDomainService.retrieveFinancialYearBeginningMonth();
|
||||
|
||||
+20
-30
@@ -583,11 +583,8 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo
|
||||
|
||||
@Override
|
||||
public CommandProcessingResult adjustRDTransaction(final Long savingsId, final Long transactionId, final JsonCommand command) {
|
||||
|
||||
AppUser user = null;
|
||||
if (this.context != null) {
|
||||
user = this.context.authenticatedUser();
|
||||
}
|
||||
|
||||
AppUser user = getAppUserIfPresent();
|
||||
|
||||
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
||||
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
||||
@@ -830,10 +827,7 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo
|
||||
public SavingsAccountTransaction initiateSavingsTransfer(final Long accountId, final LocalDate transferDate,
|
||||
final DepositAccountType depositAccountType) {
|
||||
|
||||
AppUser user = null;
|
||||
if (this.context != null) {
|
||||
user = this.context.authenticatedUser();
|
||||
}
|
||||
AppUser user = getAppUserIfPresent();
|
||||
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
||||
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
||||
final Integer financialYearBeginningMonth = this.configurationDomainService.retrieveFinancialYearBeginningMonth();
|
||||
@@ -864,11 +858,8 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo
|
||||
@Override
|
||||
public SavingsAccountTransaction withdrawSavingsTransfer(final Long accountId, final LocalDate transferDate,
|
||||
final DepositAccountType depositAccountType) {
|
||||
|
||||
AppUser user = null;
|
||||
if (this.context != null) {
|
||||
user = this.context.authenticatedUser();
|
||||
}
|
||||
|
||||
AppUser user = getAppUserIfPresent();
|
||||
|
||||
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
||||
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
||||
@@ -908,11 +899,8 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo
|
||||
public SavingsAccountTransaction acceptSavingsTransfer(final Long accountId, final LocalDate transferDate,
|
||||
final Office acceptedInOffice, final Staff fieldOfficer, final DepositAccountType depositAccountType) {
|
||||
|
||||
AppUser user = null;
|
||||
if (this.context != null) {
|
||||
user = this.context.authenticatedUser();
|
||||
}
|
||||
|
||||
AppUser user = getAppUserIfPresent();
|
||||
|
||||
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
||||
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
||||
final Integer financialYearBeginningMonth = this.configurationDomainService.retrieveFinancialYearBeginningMonth();
|
||||
@@ -1057,10 +1045,7 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo
|
||||
public CommandProcessingResult waiveCharge(final Long savingsAccountId, final Long savingsAccountChargeId,
|
||||
@SuppressWarnings("unused") final DepositAccountType depositAccountType) {
|
||||
|
||||
AppUser user = null;
|
||||
if (this.context != null) {
|
||||
user = this.context.authenticatedUser();
|
||||
}
|
||||
AppUser user = getAppUserIfPresent();
|
||||
|
||||
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
||||
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
||||
@@ -1131,8 +1116,8 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo
|
||||
public CommandProcessingResult payCharge(final Long savingsAccountId, final Long savingsAccountChargeId, final JsonCommand command,
|
||||
@SuppressWarnings("unused") final DepositAccountType depositAccountType) {
|
||||
|
||||
this.context.authenticatedUser();
|
||||
|
||||
this.context.authenticatedUser();
|
||||
|
||||
this.savingsAccountChargeDataValidator.validatePayCharge(command.json());
|
||||
final Locale locale = command.extractLocale();
|
||||
final DateTimeFormatter fmt = DateTimeFormat.forPattern(command.dateFormat()).withLocale(locale);
|
||||
@@ -1191,11 +1176,8 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo
|
||||
@Transactional
|
||||
private void payCharge(final SavingsAccountCharge savingsAccountCharge, final LocalDate transactionDate, final BigDecimal amountPaid,
|
||||
final DateTimeFormatter formatter) {
|
||||
|
||||
AppUser user = null;
|
||||
if (this.context != null) {
|
||||
user = this.context.authenticatedUser();
|
||||
}
|
||||
|
||||
AppUser user = getAppUserIfPresent();
|
||||
|
||||
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
||||
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
||||
@@ -1277,4 +1259,12 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo
|
||||
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,
|
||||
final Set<Long> existingReversedTransactionIds) {
|
||||
|
||||
AppUser user = null;
|
||||
if (this.context != null) {
|
||||
user = this.context.authenticatedUser();
|
||||
}
|
||||
AppUser user = getAppUserIfPresent();
|
||||
|
||||
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
||||
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
||||
@@ -297,10 +294,7 @@ 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 = getAppUserIfPresent();
|
||||
|
||||
final SavingsAccountCharge savingsAccountCharge = this.savingsAccountChargeRepository.findOneWithNotFoundDetection(
|
||||
savingsAccountChargeId, accountId);
|
||||
@@ -471,10 +465,7 @@ 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 = getAppUserIfPresent();
|
||||
|
||||
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
||||
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
||||
@@ -640,10 +631,7 @@ 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 = getAppUserIfPresent();
|
||||
|
||||
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
||||
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
||||
@@ -675,10 +663,7 @@ 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 = getAppUserIfPresent();
|
||||
|
||||
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
||||
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
||||
@@ -718,10 +703,7 @@ 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 = getAppUserIfPresent();
|
||||
|
||||
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
||||
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
||||
@@ -866,10 +848,7 @@ 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 = getAppUserIfPresent();
|
||||
|
||||
final boolean isSavingsInterestPostingAtCurrentPeriodEnd = this.configurationDomainService
|
||||
.isSavingsInterestPostingAtCurrentPeriodEnd();
|
||||
@@ -939,10 +918,7 @@ 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 = getAppUserIfPresent();
|
||||
|
||||
this.savingsAccountChargeDataValidator.validatePayCharge(command.json());
|
||||
final Locale locale = command.extractLocale();
|
||||
@@ -1186,4 +1162,13 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
|
||||
.with(actualChanges) //
|
||||
.build();
|
||||
}
|
||||
|
||||
private AppUser getAppUserIfPresent() {
|
||||
AppUser user = null;
|
||||
if (this.context != null) {
|
||||
user = this.context.getAuthenticatedUserIfPresent();
|
||||
}
|
||||
return user;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user