Examples of PurchaseException


Examples of com.cin.exceptions.PurchaseException

      throw new UserNotFoundException("Customer on the policy is not registered.");
    }
   
    calculateScoreForUser(user);
    if (user.getScore() <= 0) {
      throw new PurchaseException("Customer is not eligible for policy.");
    }

    int newQuote = calculateQuoteForPolicy(policy);
    if (newQuote != policy.getQuote()) {
      throw new InvalidInputValueException("Quota on the policy is not correct.");
    }

    if (policy.getPropertyName() == null || policy.getPropertyName().equals("")) {
      throw new MissingInputValueException("Policy must include property name.");
    }

    if (policy.getPropertyValue() <= 0) {
      throw new InvalidInputValueException(
          "Policy must include valid property value.");
    }

    if (policy.getDeductibles() < 0) {
      throw new InvalidInputValueException("Deductibles can't be negative.");
    }

    if (policy.getStartDate() != null) {
      throw new PurchaseException("New policy can't include start date.");
    }

    if (policy.getEndDate() != null) {
      throw new PurchaseException("New policy can't include end date.");
    }

    // compensate agent
    try {
      sendPurchaseMessage(policy);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.