Package com.globant.google.mendoza.malbec.schema._2

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


   */
  private List<String> getRequestedMethodNameList(
      final MendozaMerchantCalculation merchantCalculation) {
    log.trace("Entering getRequestedMethodNameList");
    List<String> result = new ArrayList<String>();
    Calculate calculate = getCallbackCalculate(merchantCalculation);
    if (calculate != null) {
      Calculate.Shipping shippings = calculate.getShipping();
      List<Method> shippingMethods = shippings.getMethod();
      /** Get all the shipping methods from the callback */
      for (Method method : shippingMethods) {
        result.add(method.getName());
      }
View Full Code Here


   */
  private List<String> getRequestedAddressIdList(
      final MendozaMerchantCalculation merchantCalculation) {
    log.trace("Entering getRequestedAddressIdList");
    List<String> result = new ArrayList<String>();
    Calculate calculate = getCallbackCalculate(merchantCalculation);
    if (calculate != null) {
      List<AnonymousAddress> addresses =
        calculate.getAddresses().getAnonymousAddress();
      /** Get all the address id from the callback */
      for (AnonymousAddress address : addresses) {
        result.add(address.getId());
      }
    }
View Full Code Here

      headers.put(current.getKey(), current.getValue());
    }
    request.setAdditionalHeaders(headers);
    try {
      Page page = client.getPage(request);     
      CheckoutRedirect response = (CheckoutRedirect) CartUtils.unmarshal(
          page.getWebResponse().getContentAsString()).getValue();
      URL url = new URL(URLDecoder.decode(response.getRedirectUrl(), "UTF-8"));
      String path = url.getFile();
      return path;
    } catch (Exception e) {
      throw new RuntimeException("Could not connect to " + postURL);
    }
View Full Code Here

   * contents.
   * @param response the xml response content.
   */
  private void processResponse(final String response) {
    try {
      ErrorResponse errorResponse =
        (ErrorResponse) CartUtils.unmarshal(response).getValue();
      this.responseMessage = errorResponse.getErrorMessage();
    } catch (Exception e) {
      // In case the message cannot be parsed, assign a default value to it.
      //log.warn("Could not parse message", e);
      log.warn("Could not parse message");
      log.warn("Using default value for response message");
View Full Code Here

   * @return Returns the callbak calculate.
   */
  private Calculate getCallbackCalculate(
      final MendozaMerchantCalculation merchantCalculation) {
    log.trace("Entering getCallbackCalculate");
    MerchantCalculationCallback callback =
      merchantCalculation.getMerchantCalculationCallback();
    log.trace("Leaving getCallbackCalculate");
    return callback.getCalculate();
  }
View Full Code Here

      log.debug("Merchant calculation result message: " + resultMsg);
      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);
View Full Code Here

   * @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

      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

    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

      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

TOP

Related Classes of com.globant.google.mendoza.malbec.schema._2.MerchantCalculationCallback

Copyright © 2018 www.massapicom. 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.