コード例 #1
0
ファイル: HttpUtil.java プロジェクト: gimmelamb/yes-cart
  private static void dumpParamsAndAttrs(
      final ServletRequest req, final StringBuilder stringBuilder) {

    stringBuilder.append(HttpParamsUtils.stringify("\nParameters\n", req.getParameterMap()));

    Enumeration attributeNames = req.getAttributeNames();
    final Map<String, String> map = new HashMap<String, String>();
    while (attributeNames.hasMoreElements()) {
      final String key = (String) attributeNames.nextElement();
      map.put(key, String.valueOf(req.getAttribute(key)));
    }
    stringBuilder.append(HttpParamsUtils.stringify("\nAttributes\n", map));
  }
コード例 #2
0
ファイル: HttpUtil.java プロジェクト: gimmelamb/yes-cart
 private static void dumpCookies(
     final HttpServletRequest hReq, final StringBuilder stringBuilder) {
   final Cookie[] cookies = hReq.getCookies();
   if (cookies != null) {
     final Map<String, String> map = new HashMap<String, String>();
     for (Cookie cookie : cookies) {
       map.put(cookie.getName(), cookie.getValue());
     }
     stringBuilder.append(HttpParamsUtils.stringify("\nCookies", map));
   }
 }
コード例 #3
0
ファイル: HttpUtil.java プロジェクト: gimmelamb/yes-cart
 private static void dumpHeaders(
     final HttpServletRequest hReq, final StringBuilder stringBuilder) {
   final Enumeration headerNames = hReq.getHeaderNames();
   if (headerNames != null) {
     final Map<String, String> map = new HashMap<String, String>();
     while (headerNames.hasMoreElements()) {
       final String key = (String) headerNames.nextElement();
       map.put(key, String.valueOf(hReq.getHeader(key)));
     }
     stringBuilder.append(HttpParamsUtils.stringify("\nHeaders\n", map));
   }
 }
コード例 #4
0
  /**
   * Process public call back request from payment gateway.
   *
   * @param operation
   * @param privateCallBackParameters get/post parameters
   * @return true in case in payment was ok, false in case if payment failed
   */
  public Payment createPaymentPrototype(
      final String operation, final Map privateCallBackParameters) {

    final Payment payment = new PaymentImpl();

    final Map<String, String> params =
        HttpParamsUtils.createSingleValueMap(privateCallBackParameters);

    payment.setTransactionReferenceId(params.get("x_trans_id"));
    payment.setTransactionAuthorizationCode(params.get("x_auth_code"));

    final CallbackResult res = getExternalCallbackResult(params);

    payment.setPaymentProcessorResult(res.getStatus());
    payment.setPaymentProcessorBatchSettlement(res.isSettled());
    payment.setTransactionOperationResultCode(params.get("x_response_code"));
    payment.setTransactionOperationResultMessage(
        params.get("x_response_reason_code") + " " + params.get("x_response_reason_text"));
    payment.setCardNumber(params.get("x_account_number"));
    payment.setShopperIpAddress(params.get(PaymentMiscParam.CLIENT_IP));

    return payment;
  }
コード例 #5
0
 /** {@inheritDoc} */
 public String restoreOrderGuid(final Map privateCallBackParameters) {
   return HttpParamsUtils.getSingleValue(privateCallBackParameters.get(ORDER_GUID));
 }