@Override
  public BookingInfo payWithStripe(@Named("token") String token, BookingInfo bookingInfo) {
    ObjectifyService.begin();
    logger.info("payWithStripe" + bookingInfo.getPaidPrice());
    Profil profil = bookingServiceManager.getProfil();
    logger.info("payWithStripe" + bookingInfo.getPaidPrice());
    Route route = ofy().load().type(Route.class).id(bookingInfo.getRouteId()).now();
    ContractorInfo contractorInfo = bookingServiceManager.getContractor(bookingInfo);
    Agent agent = ofy().load().type(Agent.class).id(contractorInfo.getAgentId()).now();
    Long orderCount = agent.getOrderCount();
    String orderRef = orderCount + "_" + bookingInfo.getName();

    String refusal = stripePayment.charge(token, bookingInfo, profil.getStripeSecret(), orderRef);
    if (refusal == null) {
      bookingInfo = bookingServiceManager.setPayed(profil, bookingInfo, OrderStatus.PAID, orderRef);
      if (bookingInfo != null) {
        AgentInfo agentInfo = bookingServiceManager.getAgent(contractorInfo);
        Mailer.sendConfirmation(bookingInfo, profil, agentInfo, contractorInfo);
        financeManager.addPayment(bookingInfo, new Date());
        ofy().save().entity(agent).now();
      }
    } else {
      bookingInfo.setStripeRefusalReason(refusal);
    }
    return bookingInfo;
  }
 @Override
 // @ApiMethod(name = "share.request.send", httpMethod = "post")
 public BookingInfo sendShareRequest(BookingInfo bookingInfo) {
   ObjectifyService.begin();
   Profil profil = bookingServiceManager.getProfil();
   BookingInfo parentBooking = bookingServiceManager.getBookingAsInfo(bookingInfo.getParentId());
   Mailer.sendShareRequest(parentBooking, bookingInfo, profil);
   return bookingInfo;
 }
  public void sendRatingRequest() {
    Profil profil = bookingServiceManager.getProfil();
    List<BookingInfo> list = bookingServiceManager.getListFeedbackRequest();
    logger.info("todo size:" + list.size());
    for (BookingInfo bi : list) {
      Mailer.setFeedbackRequest(bi, profil);
    }

    for (BookingInfo bi : bookingServiceManager.getArchiveList()) {
      bookingServiceManager.archive(bi);
    }
  }
  @Override
  @ApiMethod(name = "bookings.share.accepted", httpMethod = "post")
  public List<BookingInfo> handleShareAccepted(@Named("id") Long sharerId)
      throws IllegalArgumentException {
    ObjectifyService.begin();
    BookingInfo sharer = bookingServiceManager.getBookingAsInfo(sharerId);
    BookingInfo parentBookingInfo = bookingServiceManager.getBookingAsInfo(sharer.getParentId());

    BookingInfo sharerBookingInfo = bookingServiceManager.setShareAccepted(sharer);
    List<BookingInfo> list = null;
    if (sharerBookingInfo.getStatus() == SHARE_ACCEPTED) {
      list = Lists.newArrayList(parentBookingInfo, sharerBookingInfo);
      Mailer.sendShareAccepted(
          sharerBookingInfo.getEmail(),
          parentBookingInfo,
          sharer,
          bookingServiceManager.getProfil());
    } else {
      logger.severe("share failed " + sharerId);
    }
    return list;
  }