From da4a2903ad64a1ee1d8dfea3ab21e0aa2acb68f7 Mon Sep 17 00:00:00 2001 From: sathish Ramesh Date: Sun, 27 Oct 2024 19:47:39 +0530 Subject: [PATCH] feat:Feature Exception for remote depoist and payments --- .../accessor/feature/FeatureException.java | 5 ++-- .../accessor/payment/PaymentException.java | 25 +++++++++++++++++++ .../RemoteDepositException.java | 25 +++++++++++++++++++ 3 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 mdx-models/src/main/java/com/mx/path/model/mdx/accessor/payment/PaymentException.java create mode 100644 mdx-models/src/main/java/com/mx/path/model/mdx/accessor/remote_deposit/RemoteDepositException.java diff --git a/mdx-models/src/main/java/com/mx/path/model/mdx/accessor/feature/FeatureException.java b/mdx-models/src/main/java/com/mx/path/model/mdx/accessor/feature/FeatureException.java index f089f992..4b4b4582 100644 --- a/mdx-models/src/main/java/com/mx/path/model/mdx/accessor/feature/FeatureException.java +++ b/mdx-models/src/main/java/com/mx/path/model/mdx/accessor/feature/FeatureException.java @@ -12,9 +12,8 @@ *

* Usage: *

- * To create a new feature-specific exception, extend this class and implement - * the {@code getFeatureName} method to return the corresponding feature name. - * Use the constructor to set the user message and error descriptor. + * To create a new feature-specific exception, extend this class and use the + * constructor to set the user message, feature, and error descriptor. */ public abstract class FeatureException extends PathRequestException { diff --git a/mdx-models/src/main/java/com/mx/path/model/mdx/accessor/payment/PaymentException.java b/mdx-models/src/main/java/com/mx/path/model/mdx/accessor/payment/PaymentException.java new file mode 100644 index 00000000..c7f8be91 --- /dev/null +++ b/mdx-models/src/main/java/com/mx/path/model/mdx/accessor/payment/PaymentException.java @@ -0,0 +1,25 @@ +package com.mx.path.model.mdx.accessor.payment; + +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.FeatureException; + +/** + * Exception thrown when there is an error related to payment. + *

+ * This exception is used for payment-related errors, allowing for specific + * error descriptors to be specified. + *

+ */ +public class PaymentException extends FeatureException { + + /** + * Constructs a PaymentException with a specific user message and error descriptor. + * + * @param userMessage The message to be displayed to the user. + * @param errorDescriptor The error descriptor for this exception. + */ + public PaymentException(String userMessage, ErrorDescriptor errorDescriptor) { + super(userMessage, Feature.PAYMENTS, errorDescriptor); + } +} diff --git a/mdx-models/src/main/java/com/mx/path/model/mdx/accessor/remote_deposit/RemoteDepositException.java b/mdx-models/src/main/java/com/mx/path/model/mdx/accessor/remote_deposit/RemoteDepositException.java new file mode 100644 index 00000000..44876013 --- /dev/null +++ b/mdx-models/src/main/java/com/mx/path/model/mdx/accessor/remote_deposit/RemoteDepositException.java @@ -0,0 +1,25 @@ +package com.mx.path.model.mdx.accessor.remote_deposit; + +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.FeatureException; + +/** + * Exception thrown when there is an error related to remote deposit. + *

+ * This exception is used for remote deposit-related errors, allowing for specific + * error descriptors to be specified. + *

+ */ +public class RemoteDepositException extends FeatureException { + + /** + * Constructs a RemoteDepositException with a specific user message and error descriptor. + * + * @param userMessage The message to be displayed to the user. + * @param errorDescriptor The error descriptor for this exception. + */ + public RemoteDepositException(String userMessage, ErrorDescriptor errorDescriptor) { + super(userMessage, Feature.REMOTE_DEPOSITS, errorDescriptor); + } +}