Merge branch 'dev-pending-20-01-2026' into PRE-PRODUCTION-2026

dev-pending-01-02-2026
Naeem Ullah 6 days ago
commit a68f9a695c

@ -16,6 +16,7 @@ public class AccountToAccountDTO {
private String plcLocacode; private String plcLocacode;
private String porOrgacode; private String porOrgacode;
private String ppmPymdcode; private String ppmPymdcode;
private String ptrTrancode;
private String sgtGntrcreateusr; private String sgtGntrcreateusr;
private String sgtGntrnarration; private String sgtGntrnarration;
private LocalDate sgtGntrvaluedate; private LocalDate sgtGntrvaluedate;

@ -17,6 +17,7 @@ public class GlToAccountDTO {
private String plcLocacode; private String plcLocacode;
private String porOrgacode; private String porOrgacode;
private String ppmPymdcode; private String ppmPymdcode;
private String ptrTrancode;
private String sgtGntrcreateusr; private String sgtGntrcreateusr;
private String sgtGntrnarration; private String sgtGntrnarration;
private LocalDate sgtGntrvaluedate; private LocalDate sgtGntrvaluedate;

@ -93,7 +93,7 @@ public class TransactionLogService {
transactionLog.setUpdatedAt(LocalDateTime.now()); transactionLog.setUpdatedAt(LocalDateTime.now());
transactionLog.setSgtGntrdate(accountToAccountDTO.getSgtGntrvaluedate()); transactionLog.setSgtGntrdate(accountToAccountDTO.getSgtGntrvaluedate());
transactionLog.setTransactionUri(URI); transactionLog.setTransactionUri(URI);
transactionLog.setTransactionCode(""); transactionLog.setTransactionCode(accountToAccountDTO.getPtrTrancode());
return transactionLogRepository.save(transactionLog); return transactionLogRepository.save(transactionLog);
} }
@ -105,14 +105,12 @@ public class TransactionLogService {
transactionLog.setCrMbmbkmsnumber(glToAccountDTO.getCreditAcc().getMbmBkmsnumber()); transactionLog.setCrMbmbkmsnumber(glToAccountDTO.getCreditAcc().getMbmBkmsnumber());
transactionLog.setDrMbmbkmsnumber(""); transactionLog.setDrMbmbkmsnumber("");
transactionLog.setCrPcaglacode(""); transactionLog.setCrPcaglacode("");
transactionLog.setDrPcaGlacode("");
transactionLog.setPpmPymdcode(glToAccountDTO.getPpmPymdcode());
transactionLog.setSgtGntrdate(glToAccountDTO.getSgtGntrvaluedate()); transactionLog.setSgtGntrdate(glToAccountDTO.getSgtGntrvaluedate());
transactionLog.setCreatedAt(LocalDateTime.now()); transactionLog.setCreatedAt(LocalDateTime.now());
transactionLog.setUpdatedAt(LocalDateTime.now()); transactionLog.setUpdatedAt(LocalDateTime.now());
transactionLog.setSgtGntrdate(glToAccountDTO.getSgtGntrvaluedate()); transactionLog.setSgtGntrdate(glToAccountDTO.getSgtGntrvaluedate());
transactionLog.setTransactionUri(URI); transactionLog.setTransactionUri(URI);
transactionLog.setTransactionCode(""); transactionLog.setTransactionCode(glToAccountDTO.getPtrTrancode());
return transactionLogRepository.save(transactionLog); return transactionLogRepository.save(transactionLog);
} }
} }

@ -0,0 +1,10 @@
package com.mfsys.aconnect.usermanagement.exceptions;
import com.mfsys.common.configuration.constant.ERRCode;
import com.mfsys.common.configuration.exception.ApplicationException;
public class NewPasswordException extends ApplicationException {
public NewPasswordException(String porOrgacode) {
super(porOrgacode, ERRCode.NEW_PASSWORD);
}
}

@ -3,6 +3,7 @@ package com.mfsys.aconnect.usermanagement.service;
import com.mfsys.aconnect.security.dto.ChangePasswordDTO; import com.mfsys.aconnect.security.dto.ChangePasswordDTO;
import com.mfsys.aconnect.security.dto.ResetPasswordDTO; import com.mfsys.aconnect.security.dto.ResetPasswordDTO;
import com.mfsys.aconnect.usermanagement.exceptions.EmailAlreadyExistException; import com.mfsys.aconnect.usermanagement.exceptions.EmailAlreadyExistException;
import com.mfsys.aconnect.usermanagement.exceptions.NewPasswordException;
import com.mfsys.aconnect.usermanagement.exceptions.OldPasswordNotMatch; import com.mfsys.aconnect.usermanagement.exceptions.OldPasswordNotMatch;
import com.mfsys.aconnect.usermanagement.exceptions.UsernameAlreadyExistException; import com.mfsys.aconnect.usermanagement.exceptions.UsernameAlreadyExistException;
import com.mfsys.aconnect.usermanagement.model.Role; import com.mfsys.aconnect.usermanagement.model.Role;
@ -55,9 +56,8 @@ public class UserService {
User user = userRepository.findById(request.getUserId()) User user = userRepository.findById(request.getUserId())
.orElseThrow(() -> new EntityNotFoundException("User not found with ID: " + request.getUserId())); .orElseThrow(() -> new EntityNotFoundException("User not found with ID: " + request.getUserId()));
boolean isPasswordValid = PasswordEncryptionService.verifyPassword(request.getOldPassword(), user.getPassword()); if (passwordEncryptionService.matches(request.getNewPassword(), user.getPassword())) {
if(!isPasswordValid) { throw new NewPasswordException(request.getPorOrgacode());
throw new OldPasswordNotMatch(request.getPorOrgacode());
} }
user.setPassword(passwordEncryptionService.hashPassword(request.getNewPassword())); user.setPassword(passwordEncryptionService.hashPassword(request.getNewPassword()));
userRepository.save(user); userRepository.save(user);
@ -69,10 +69,9 @@ public class UserService {
User user = userRepository.findById(request.getUserId()) User user = userRepository.findById(request.getUserId())
.orElseThrow(() -> new EntityNotFoundException("User not found with ID: " + request.getUserId())); .orElseThrow(() -> new EntityNotFoundException("User not found with ID: " + request.getUserId()));
boolean isPasswordValid = PasswordEncryptionService.verifyPassword(request.getOldPassword(), user.getPassword()); if (passwordEncryptionService.matches(request.getNewPassword(), user.getPassword())) {
if(!isPasswordValid) { throw new NewPasswordException(request.getPorOrgacode());
throw new OldPasswordNotMatch(request.getPorOrgacode()); }
}
user.setPassword(passwordEncryptionService.hashPassword(request.getNewPassword())); user.setPassword(passwordEncryptionService.hashPassword(request.getNewPassword()));
user.setFirstLogin(false); user.setFirstLogin(false);
userRepository.save(user); userRepository.save(user);
@ -84,6 +83,9 @@ public class UserService {
User user = userRepository.findById(request.getUserId()) User user = userRepository.findById(request.getUserId())
.orElseThrow(() -> new EntityNotFoundException("User not found with ID: " + request.getUserId())); .orElseThrow(() -> new EntityNotFoundException("User not found with ID: " + request.getUserId()));
if (passwordEncryptionService.matches(request.getNewPassword(), user.getPassword())) {
throw new NewPasswordException(request.getPorOrgacode());
}
user.setPassword(passwordEncryptionService.hashPassword(request.getNewPassword())); user.setPassword(passwordEncryptionService.hashPassword(request.getNewPassword()));
user.setFirstLogin(false); user.setFirstLogin(false);
userRepository.save(user); userRepository.save(user);

@ -15,7 +15,8 @@ public enum ERRCode implements ErrorMessage {
MISSING_GL_CODE("ERR_GL_0001","Credit and Debit GL codes are required"), MISSING_GL_CODE("ERR_GL_0001","Credit and Debit GL codes are required"),
SAMEGLCODE("ERR_GL_0002","Credit and Debit GL codes must be different"), SAMEGLCODE("ERR_GL_0002","Credit and Debit GL codes must be different"),
MISSING_ACCOUNT_NUMBER("ERR_ACCT_0001","Account number is required"), MISSING_ACCOUNT_NUMBER("ERR_ACCT_0001","Account number is required"),
SAMEACCOUNTNUMBER("ERR_ACCT_0002","Account number must be different"); SAMEACCOUNTNUMBER("ERR_ACCT_0002","Account number must be different"),
NEW_PASSWORD("ERR_SEC_0007","New password cannot be same as old password");

@ -14,4 +14,8 @@ public class PasswordEncryptionService {
return BCrypt.checkpw(plainPassword, hashedPassword); return BCrypt.checkpw(plainPassword, hashedPassword);
} }
public boolean matches(String rawPassword, String encodedPassword) {
return BCrypt.checkpw(rawPassword, encodedPassword);
}
} }

Loading…
Cancel
Save