public CreditRequest getCreditRequest() {
   if (creditRequest == null) {
     if (FacesContext.getCurrentInstance().isPostback()) {
       creditRequest = new CreditRequest();
       creditRequest.setMoney(new Money());
       creditRequest.setDuration(new Duration());
     } else {
       String requestId =
           FacesContext.getCurrentInstance()
               .getExternalContext()
               .getRequestParameterMap()
               .get("requestId");
       if (requestId == null) {
         throw new IllegalStateException("no credit request id set to update");
       }
       try {
         creditRequest = contractManagement.getContract(requestId);
         if (creditRequest.getState() != CreditRequestState.Offer) {
           throw new IllegalStateException("try to update credit request not in offer state");
         }
       } catch (Exception e) {
         e.printStackTrace();
       }
     }
   }
   return creditRequest;
 }
  public String acceptOffer() {
    LOG.info("acceptOffer");
    LOG.info(Data.encodeToXml(creditRequest));
    getCreditRequest().setState(CreditRequestState.Accept);
    String ret = creditApprovalProcess.process(creditRequest);

    if (ret != null && ret.equals("success")) {
      FacesContext.getCurrentInstance()
          .getExternalContext()
          .getSessionMap()
          .put("shippingClient", creditApprovalProcess.getShippingClient());
      FacesContext.getCurrentInstance()
          .getExternalContext()
          .getSessionMap()
          .put("requestId", creditRequest.getRequestId());

      return "step_finalize.xhtml";
    }
    return "step_update.xhtml";
  }