Add null and empty checks for GL code and account number

Introduced validation to ensure GL code and account number are not null or empty in transaction processing. Throws specific exceptions when required fields are missing to prevent invalid transactions.
dev-pending-01-02-2026
Naeem Ullah 1 week ago
parent 8a21307b27
commit 53f9a53888

@ -60,6 +60,15 @@ public class TransactionService {
Double creditAmount = accountGLTransactionRequest.getCreditGl().getSgtGntramtfc(); Double creditAmount = accountGLTransactionRequest.getCreditGl().getSgtGntramtfc();
Double debitAmount = accountGLTransactionRequest.getDebitAcc().getSgtGntramtfc(); Double debitAmount = accountGLTransactionRequest.getDebitAcc().getSgtGntramtfc();
if (accountGLTransactionRequest.getCreditGl().getPcaGlaccode() == null || accountGLTransactionRequest.getCreditGl().getPcaGlaccode().isEmpty()) {
throw new MissingGLCodeException(accountGLTransactionRequest.getPorOrgacode());
}
if (accountGLTransactionRequest.getDebitAcc().getMbmBkmsnumber() == null || accountGLTransactionRequest.getDebitAcc().getMbmBkmsnumber().isEmpty()) {
throw new MissingAccountException(accountGLTransactionRequest.getPorOrgacode());
}
if (creditAmount == null || debitAmount == null) { if (creditAmount == null || debitAmount == null) {
throw new MissingTransactionAmountException(accountGLTransactionRequest.getPorOrgacode()); throw new MissingTransactionAmountException(accountGLTransactionRequest.getPorOrgacode());
} }
@ -211,6 +220,14 @@ public class TransactionService {
BigDecimal creditAmount = glToAccountDTO.getCreditAcc().getSgtGntramtfc(); BigDecimal creditAmount = glToAccountDTO.getCreditAcc().getSgtGntramtfc();
BigDecimal debitAmount = glToAccountDTO.getDebitGl().getSgtGntramtfc(); BigDecimal debitAmount = glToAccountDTO.getDebitGl().getSgtGntramtfc();
if (glToAccountDTO.getDebitGl().getPcaGlaccode() == null || glToAccountDTO.getDebitGl().getPcaGlaccode().isEmpty()) {
throw new MissingGLCodeException(glToAccountDTO.getPorOrgacode());
}
if (glToAccountDTO.getCreditAcc().getMbmBkmsnumber() == null || glToAccountDTO.getCreditAcc().getMbmBkmsnumber().isEmpty()) {
throw new MissingAccountException(glToAccountDTO.getPorOrgacode());
}
if (!creditAmount.equals(debitAmount)) { if (!creditAmount.equals(debitAmount)) {
throw new TransactionAmountException(glToAccountDTO.getPorOrgacode()); throw new TransactionAmountException(glToAccountDTO.getPorOrgacode());
} }

Loading…
Cancel
Save