Package com.mes.sdk.exception

Examples of com.mes.sdk.exception.ValidationException


        }
        sum += n;
        alternate = !alternate;
      }
    } catch(NumberFormatException e) {
      throw new ValidationException(e.getMessage());
    }
    return (sum % 10 == 0);
  }
View Full Code Here


      break;
    }
   
    if(requestTable.containsKey("invoice_num")) {
      if(requestTable.get("invoice_num").length() > 17)
        throw new ValidationException("\"invoice_num\" must be <= 17 characters.");
    }
  }
View Full Code Here

    }
  }
 
  private void validateRequiredField(String field) {
    if(!requestTable.containsKey(field))
      throw new ValidationException(type+" requires \""+field+"\"");
  }
View Full Code Here

      throw new ValidationException(type+" requires \""+field+"\"");
  }
 
  private void validateCardData() {
    if(!requestTable.containsKey("transaction_amount"))
      throw new ValidationException(type+" requires a \"transaction_amount\".");
   
    if(requestTable.containsKey("card_number")) {
      // attempt to sanitize ccnum
     
      if(!Util.CheckCC(requestTable.get("card_number")))
        throw new MesRuntimeException("Card number is invalid");
      if(!requestTable.containsKey("card_exp_date"))
        throw new ValidationException(type+" using \"card_number\" requires \"card_exp_date\".");
    }
    else if(requestTable.containsKey("card_id")) {
      if(!requestTable.containsKey("card_exp_date"))
        throw new ValidationException(type+" using \"card_id\" requires \"card_exp_date\".");     
    }
    else if(requestTable.containsKey("card_swipe")) {
      //... validate sentinels?
    }
    else
      throw new ValidationException("Card data missing.");
  }
View Full Code Here

TOP

Related Classes of com.mes.sdk.exception.ValidationException

Copyright © 2018 www.massapicom. 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.