Untitled
public void validateRequest(String userId, String transactionId ) { log.info("PerlasService.validateRequest"); Optional<Customer> customer = customerRepository.findById(Long.valueOf(userId)); if (customer.isEmpty()) { log.info("PerlasService.validateRequest.NoCustomerException.CustomerId:{}.TransactionId:{}", userId, transactionId); throw new NoCustomerException("No customer with customerId:" + userId); } //if its checkId request, then do this check boolean earlierCheckIdRequestExists = salesOrdersRepository.existsByTransactionIdAndStatus(transactionId,"CHECK ID"); if (earlierCheckIdRequestExists) { System.out.println("DUPLICATE"); log.info("PerlasService.validateRequest.DuplicateRequestException.CustomerId:{}.TransactionId:{}", userId,transactionId); throw new DuplicateRequestException("Duplicate checkId request.UserId:" + userId + ".TransactionId:" + transactionId); } }
Leave a Comment