diff --git a/src/main/java/zw/qantra/tm/domain/services/VelocityPaymentService.java b/src/main/java/zw/qantra/tm/domain/services/VelocityPaymentService.java index db6ab7c..e526fa4 100644 --- a/src/main/java/zw/qantra/tm/domain/services/VelocityPaymentService.java +++ b/src/main/java/zw/qantra/tm/domain/services/VelocityPaymentService.java @@ -75,10 +75,6 @@ public class VelocityPaymentService { if(errors != null && !errors.isEmpty()){ String errorMessage = errors.get(0); - if(errorMessage.contains("already exists")) { - log.warn("Customer already exists in Velocity: {}", errorMessage); - throw new AlreadyExistsException(errorMessage); // or handle as needed - } log.error("Error creating customer: {}", errorMessage); throw new IllegalStateException("Error creating customer: " + errorMessage); } @@ -86,6 +82,11 @@ public class VelocityPaymentService { return null; } catch (Exception e) { log.error("Error creating customer: {}", e.getMessage(), e); + if(e.getMessage().contains("already exists")) { + log.warn("Customer already exists in Velocity: {}", e.getMessage()); + throw new AlreadyExistsException(e.getMessage()); // or handle as needed + } + throw new IllegalStateException("Error creating customer: " + e.getMessage(), e); }