From 92276c07d8892324c97c1d42e75c1801a3e63ef5 Mon Sep 17 00:00:00 2001 From: Vusumuzi Khoza Date: Mon, 1 Jun 2026 14:54:30 +0200 Subject: [PATCH] bug fixes --- .../tm/domain/services/VelocityPaymentService.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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); }