Untitled
unknown
java
a year ago
1.0 kB
23
Indexable
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);
}
}Editor is loading...
Leave a Comment