diff --git a/mdx-models/src/main/java/com/mx/path/model/mdx/accessor/feature/Feature.java b/mdx-models/src/main/java/com/mx/path/model/mdx/accessor/feature/Feature.java deleted file mode 100644 index ee0d7acb..00000000 --- a/mdx-models/src/main/java/com/mx/path/model/mdx/accessor/feature/Feature.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.mx.path.model.mdx.accessor.feature; - -/** - * Enum representing different features in the application. - *

- * This enum serves as a centralized definition of features available in - * the application. Each constant corresponds to a specific feature, - * allowing for type-safe handling and easy reference throughout the codebase. - *

- * Usage: - *

- * Use these feature constants when implementing feature-specific logic, - * error handling, or when setting headers for error responses. - *

- */ -public enum Feature { - TRANSFERS("transfers"), - REMOTE_DEPOSITS("remote_deposits"), - PAYMENTS("payments"); - // todo:All the feature names will be added here. - - private final String featureName; - - Feature(String featureName) { - this.featureName = featureName; - } - - public String getFeatureName() { - return featureName; - } -} diff --git a/mdx-models/src/main/java/com/mx/path/model/mdx/accessor/feature/FeatureMapper.java b/mdx-models/src/main/java/com/mx/path/model/mdx/accessor/feature/FeatureMapper.java new file mode 100644 index 00000000..5f750653 --- /dev/null +++ b/mdx-models/src/main/java/com/mx/path/model/mdx/accessor/feature/FeatureMapper.java @@ -0,0 +1,20 @@ +package com.mx.path.model.mdx.accessor.feature; + +import java.util.HashMap; +import java.util.Map; + +import com.mx.path.core.common.request.Feature; + +public class FeatureMapper { + + private static final Map FEATURE_NAMES = new HashMap<>(); + + static { + FEATURE_NAMES.put(Feature.TRANSFERS, "transfers"); + FEATURE_NAMES.put(Feature.REMOTE_DEPOSITS, "remote_deposits"); + } + + public static String getFeatureName(Feature feature) { + return FEATURE_NAMES.get(feature); + } +} diff --git a/mdx-models/src/main/java/com/mx/path/model/mdx/accessor/ach_transfer/TransfersException.java b/mdx-models/src/main/java/com/mx/path/model/mdx/accessor/transfer/TransfersException.java similarity index 81% rename from mdx-models/src/main/java/com/mx/path/model/mdx/accessor/ach_transfer/TransfersException.java rename to mdx-models/src/main/java/com/mx/path/model/mdx/accessor/transfer/TransfersException.java index 205082ca..a427f64b 100644 --- a/mdx-models/src/main/java/com/mx/path/model/mdx/accessor/ach_transfer/TransfersException.java +++ b/mdx-models/src/main/java/com/mx/path/model/mdx/accessor/transfer/TransfersException.java @@ -1,8 +1,10 @@ -package com.mx.path.model.mdx.accessor.ach_transfer; +package com.mx.path.model.mdx.accessor.transfer; + +import com.mx.path.core.common.request.Feature; import com.mx.path.model.mdx.accessor.feature.ErrorDescriptor; -import com.mx.path.model.mdx.accessor.feature.Feature; import com.mx.path.model.mdx.accessor.feature.FeatureException; +import com.mx.path.model.mdx.accessor.feature.FeatureMapper; /** * Exception thrown when there is an error related to transfers. @@ -29,6 +31,6 @@ public TransfersException(String userMessage, ErrorDescriptor errorDescriptor) { */ @Override protected String getFeatureName() { - return Feature.TRANSFERS.getFeatureName(); + return FeatureMapper.getFeatureName(Feature.TRANSFERS); } }