@Override public Receipt bookTransportationFromQuote( String idQuote, String payer, String card, String reduction) throws UnknownQuoteFault { Double reduc = Double.parseDouble(reduction); Quote q = daoContractors.getQuote(idQuote); q.calculateQuote(); Transportation transportation = new Transportation(q, new Company(payer), true, card); double price = transportation.quote.getCost() - (transportation.quote.getCost() * reduc); // TODO payment transportation.isPayed = true; daoTranportation.addTransportation(transportation); String paymentDate = LocalDateTime.now().format(DateTimeFormatter.ofPattern("uuuu-MM-dd'_'HH:mm")); return new Receipt( transportation.quote.getIdQuote(), paymentDate, price, transportation.quote.getEtaString()); }
@Override public Receipt bookTransportation( String sender, String fromAddress, String fromzipcode, String fromcity, String receiver, String toAddress, String tozipcode, String tocity, double height, double width, double depth, double weight, String pickupDate, String payer, String card, String reduction) { Double reduc = Double.parseDouble(reduction); Parcel parcel = new Parcel("parcel_", StatusParcel.UNKNOWN, width, height, depth, weight); parcel.idParcel += parcel.dimension.getVolume(); LocalDateTime date = LocalDateTime.parse(pickupDate, DateTimeFormatter.ofPattern("uuuu-MM-dd'_'HH:mm")); Quote q = new Quote( "idquote1234", new Company(sender), new Address(fromAddress, fromzipcode, fromcity), new Company(receiver), new Address(toAddress, tozipcode, tocity), parcel, date); daoContractors.addQuote(q); q.calculateQuote(); Transportation transportation = new Transportation(q, new Company(payer), true, card); double price = transportation.quote.getCost() - (transportation.quote.getCost() * reduc); // TODO payment transportation.isPayed = true; daoTranportation.addTransportation(transportation); String paymentDate = LocalDateTime.now().format(DateTimeFormatter.ofPattern("uuuu-MM-dd'_'HH:mm")); return new Receipt( transportation.quote.getIdQuote(), paymentDate, price, transportation.quote.getEtaString()); }