Examples of MerchantCalculationResults


Examples of com.globant.google.mendoza.malbec.schema._2.MerchantCalculationResults

   * @return Returns the calculation results.
   */
  private List<Result> getResultList(
      final MendozaMerchantCalculation merchantCalculation) {
    log.trace("Entering getResultList");
    MerchantCalculationResults result =
      merchantCalculation.getMerchantCalculationResult();
     MerchantCalculationResults.Results results = result.getResults();
     log.trace("Leaving getResultList");
     return results.getResult();
  }
View Full Code Here

Examples of com.globant.google.mendoza.malbec.schema._2.MerchantCalculationResults

      public MerchantCalculationResults calculate(final Long buyerId,
          final ShoppingCart cart, final String language,
          final MerchantCalculationCallback callback) {
        System.out.println(
            "Merchant Sample App: Merchant calculation callback received");
        return new MerchantCalculationResults();
      };
    };

    /* Create the merchant order listener */
    OrderListener orderListener = new OrderListener() {
View Full Code Here

Examples of com.globant.google.mendoza.malbec.schema._2.MerchantCalculationResults

    Object result = calculationListener.calculate(
        getBuyerId(), getShoppingCart(), getBuyerLanguage(), this);

    if (result instanceof MerchantCalculationResults) {
      MerchantCalculationResults results = (MerchantCalculationResults) result;
      ObjectFactory factory = new ObjectFactory();
      return factory.createMerchantCalculationResults(results);
    } else if (result instanceof String) {
      String stringResult = (String) result;
      return stringResult;
View Full Code Here

Examples of com.globant.google.mendoza.malbec.schema._2.MerchantCalculationResults

      log.debug("The merchant calculation result message is not a valid XML: "
      + validationMessage);
    }

    MerchantCalculationCallback merchantCalculationCallback = null;
    MerchantCalculationResults merchantCalculationResult = null;
    try {
      /* Callback */
      JAXBElement callbackNode =
        (JAXBElement) CartUtils.unmarshal(callbackMsg);
      merchantCalculationCallback =
View Full Code Here

Examples of com.google.checkout.MerchantCalculationResults

    }
   
    try {
      // Authorization matches, grab the request
      MerchantCalculationCallback callback = (MerchantCalculationCallback) Unmarshaller.unmarshal(MerchantCalculationCallback.class, _request.getReader());
      MerchantCalculationResults results = HandlerFactory.getCalculationHandler().performCalculation(callback);
      _response.addHeader("Content-Type", "application/xml");
      _response.addHeader("Accepts", "application/xml");
      results.marshal(_response.getWriter());
      _response.setStatus(HttpStatus.SC_OK);
    } catch (IOException e) {
      if (LOG.isErrorEnabled()) {
        LOG.error("IOException processing Google Callback: " + e.getLocalizedMessage(), e);
      }
View Full Code Here

Examples of com.google.checkout.MerchantCalculationResults

  public static final String CONFIG_GOOGLE_CALC_SHIPPING_DEFAULT = new StringBuffer(CONFIG_GOOGLE_CALC_SHIPPING).append(".default").toString();
  public static final BigDecimal DEFAULT_SHIPPING = new BigDecimal("0.00");
  public static final String DOT_DEFAULT = ".default";

  public MerchantCalculationResults performCalculation(MerchantCalculationCallback _callback) throws CalculationException {
    MerchantCalculationResults mcResults = new MerchantCalculationResults();
    Results results = new Results();
    mcResults.setResults(results);
    boolean calcTax = _callback.getCalculate().getTax();
    boolean calcShipping = false;
    if (_callback.getCalculate().getShipping() != null) {
      calcShipping = true;
    }
View Full Code Here

Examples of com.google.checkout.merchantcalculation.MerchantCalculationResults

           
            Iterator addresses = callback.getAnonymousAddresses().iterator();
            Iterator shippingMethods;
            Iterator merchantCodes;
           
            MerchantCalculationResults results = new MerchantCalculationResults();
            AnonymousAddress address;
            String shipping;
            MerchantCodeString code;
           
            while (addresses.hasNext()) {
                address = (AnonymousAddress) addresses.next();
               
                shippingMethods = callback.getShippingMethods().iterator();
                while (shippingMethods.hasNext()) {
                    shipping = (String) shippingMethods.next();
                   
                    merchantCodes = callback.getMerchantCodes().iterator();
                    Collection codeResults = new ArrayList();
                    while (merchantCodes.hasNext()) {
                        code = (MerchantCodeString) merchantCodes.next();
                        CouponResult coupon = new CouponResult(false, 0.0f,
                                mc.getCurrencyCode(),
                                code.getCode(), "Not supported in this example.");
                        codeResults.add(coupon);
                    }
                   
                    results.addResult(shipping, address.getId(), true, 0.0d, 0.0d,
                            mc.getCurrencyCode(), codeResults);
                }
            }
            return results.getXml();
        } catch (Exception e) {
            throw new CheckoutException(e);
        }
    }   
View Full Code Here

Examples of com.google.checkout.merchantcalculation.MerchantCalculationResults

    Iterator addresses = callback.getAnonymousAddresses().iterator();
    Iterator shippingMethods;
    Iterator merchantCodes;

    MerchantCalculationResults results = new MerchantCalculationResults();
    AnonymousAddress address;
    String shipping;
    MerchantCodeString code;

    while (addresses.hasNext()) {
      address = (AnonymousAddress) addresses.next();

      shippingMethods = callback.getShippingMethods().iterator();
      while (shippingMethods.hasNext()) {
        shipping = (String) shippingMethods.next();

        merchantCodes = callback.getMerchantCodes().iterator();
        Collection codeResults = new ArrayList();
        while (merchantCodes.hasNext()) {
          code = (MerchantCodeString) merchantCodes.next();
          CouponResult coupon = new CouponResult(false, 0.0f,
              merchantConstants.getCurrencyCode(),
              code.getCode(), "Not supported in this example.");
          codeResults.add(coupon);
        }

        results.addResult(shipping, address.getId(), true, 0.0d, 0.0d,
            merchantConstants.getCurrencyCode(), codeResults);
      }
    }
    return results;
  }
View Full Code Here

Examples of com.google.checkout.merchantcalculation.MerchantCalculationResults

          mc);

      InputStream in = request.getInputStream();
      MerchantCalculationCallback callback = new MerchantCalculationCallback(
          in);
      MerchantCalculationResults results = cp.process(callback);

      PrintWriter out = response.getWriter();
      out.print(results.getXml());

    } catch (Exception ex) {
      ex.printStackTrace();
      response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, ex
          .getMessage());
View Full Code Here

Examples of com.google.checkout.merchantcalculation.MerchantCalculationResults

          mc);

      InputStream in = request.getInputStream();
      MerchantCalculationCallback callback = new MerchantCalculationCallback(
          in);
      MerchantCalculationResults results = cp.process(callback);

      PrintWriter out = response.getWriter();
      out.print(results.getXml());

    } catch (Exception ex) {
      ex.printStackTrace();
      response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, ex
          .getMessage());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.