Package de.marcusschiesser.dbpendler.server.bahnwrapper.handler

Examples of de.marcusschiesser.dbpendler.server.bahnwrapper.handler.PreCommitValidationHandler


        "lang=de&" +
        "Zahlungsart=" + ((paymentType==PaymentType.creditCard) ? "kk" : "ls") +
        "&button.weiter_p=Weiter");
   
    inputStream = HTTPUtils.stringToStream(response);
    PreCommitValidationHandler preCommitHandler = new PreCommitValidationHandler(paymentType);
    reader.setContentHandler(preCommitHandler);
    reader.parse(new InputSource(inputStream));
    return preCommitHandler;
  }
View Full Code Here


    Date bookTime = DateUtils.unifyDateTime(date, time);
    if(bookTime.before(actTime)) {
      String msg = "Can not book tickets for the past.";
      ExceptionUtils.throwError(msg);
    }
    PreCommitValidationHandler preCommitHandler = doPreBooking(session, start, destination, date, time, bookingtype, reservationType, paymentType);
    if(!preCommitHandler.isValid()) {
      String msg = "The parser seems to have an error. The pre commit response does not look valid. Please either report or fix this problem.";
      ExceptionUtils.throwError(msg);
      log.severe(msg);
    }
    String mobileNumber = preCommitHandler.getMobileNumber();
    String bahncardNumber = preCommitHandler.getBahncardNumber();
   
    String commitParam = "lang=de" +
    "&mobilnr=" + mobileNumber +
    ((paymentType==PaymentType.creditCard) ? "&kreditkartePruefziffer="+creditCardCheckNumber : "")+
    "&bahncard.nummerNummer=" + bahncardNumber;
View Full Code Here

    double price = doPreBooking(BookingType.bookonly);
    Assert.assertEquals("booking costs 37.00", 37.00d, price, 0);
  }

  private double doPreBooking(BookingType bookingType) throws SAXException, IOException, ParseException {
    PreCommitValidationHandler handler = null;
    for (ReservationType reservationType : ReservationType.values()) {
      for (PaymentType paymentType : PaymentType.values()) {
        HTTPSession session = Login.getInstance().login(LoginTest.TEST_USER_LOGIN, LoginTest.TEST_USER_PIN);
        Date date = DateUtils.getDateFormat().parse("25.07.2011");
        Date queryTime = DateUtils.getTimeFormat().parse("08:00");
        handler = Booking.getInstance().doPreBooking(session, new StationVO("Karlsruhe Hbf"), new StationVO("Frankfurt(Main)Hbf"),
            date, queryTime, bookingType, reservationType, paymentType);
        Assert.assertTrue("precommit price must not be undefined for payment:" + paymentType.name() + " and reservation: " + reservationType.name(), handler.getPrice()!=null);
      }
    }
    return handler.getPrice();
  }
View Full Code Here

TOP

Related Classes of de.marcusschiesser.dbpendler.server.bahnwrapper.handler.PreCommitValidationHandler

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.