Skip to content
This repository has been archived by the owner on Dec 4, 2024. It is now read-only.

Commit

Permalink
fix: findCustomerByCpf with or without special characters
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasmzsouza committed May 13, 2024
1 parent d6dd32a commit f8b0a35
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ public CustomerServiceImpl(

@Override
public CustomerDTO findCustomerByCpf(String cpf) {
Optional<CustomerEntity> obj = customerRepository.findCustomerByCpf(cpf);
String cpfStr = CPF.removeNonDigits(cpf);
Optional<CustomerEntity> obj = customerRepository.findCustomerByCpf(cpfStr);
CustomerEntity entity =
obj.orElseThrow(() -> new ResourceNotFoundException("Entity not found"));
return new CustomerDTO(customerMapper.mapFrom(entity));
Expand Down

0 comments on commit f8b0a35

Please sign in to comment.