PaymentException.java

package com.tradecloud.domain.settlement;

import com.tradecloud.domain.exception.EnumBusinessException;

/**
 * Exception thrown for payment issues.
 */
public class PaymentException extends EnumBusinessException {

    private static final long serialVersionUID = 1L;
    private PlannedSettlement plannedSettlement;

    public PaymentException(PaymentExceptionType exceptionType) {
        super(exceptionType);
    }

    public PaymentException(Enum<?> exceptionType, String message) {
        super(exceptionType, message);
    }

    public PaymentException(Enum<?> exceptionType, String message, PlannedSettlement plannedSettlement) {
        super(exceptionType, message);
        this.plannedSettlement = plannedSettlement;
    }

    public PaymentException(PaymentExceptionType exceptionType, Throwable t) {
        super(exceptionType, t);
    }

    @Override
    public PaymentExceptionType getExceptionType() {
        return cast(PaymentExceptionType.class, exceptionType);
    }

    public static enum PaymentExceptionType {
        AMOUNT_EXCEEDED, POSITIVE_VALUE_REQUIRED, INCORRECT_INVOICE_STATE, TOTAL_PAYMENT_LESS_THAN_ZERO, INCORRECT_ORDER_STATE;
    }

    public PlannedSettlement getPlannedSettlement() {
        return plannedSettlement;
    }
}