Examples of MerchantCalculationResults


Examples of com.google.checkout.merchantcalculation.MerchantCalculationResults

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

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

    while (addresses.hasNext()) {
      address = (AnonymousAddress) addresses.next();
      //compute the taxes if required, using strikeiron tax service
      double tax = 0.0d;
      if (callback.isCalculateTax()) {
        double rate = getTaxRate(address.getPostalCode());
        items = callback.getItems().iterator();
        while (items.hasNext()) {
          item = (Item)items.next();
          tax =+ rate * item.getUnitPriceAmount() * item.getQuantity();
        }
      }

      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, tax, 0.0d,
            merchantConstants.getCurrencyCode(), codeResults);
      }
    }
    return results;
  }
View Full Code Here

Examples of com.google.checkout.schema._2.MerchantCalculationResults

    individualResult.setTotalTax(createMoney(totalTaxAmount));
    individualResult.setMerchantCodeResults(merchantCodeResults);
   
    Results results = _objectFact.createMerchantCalculationResultsResults();
    results.getResult().add(individualResult);
    MerchantCalculationResults mResults
        = _objectFact.createMerchantCalculationResults();
    mResults.setResults(results);
    JAXBElement elem = _objectFact.createMerchantCalculationResults(mResults);
    return convertToDOM(elem);
  }
View Full Code Here

Examples of com.google.checkout.schema._2.MerchantCalculationResults

      individualResult.setMerchantCodeResults(merchantCodeResults);
     
      ResultsType results
          = _objectFact.createMerchantCalculationResultsResultsType();
      results.getResult().add(individualResult);
      MerchantCalculationResults mResults
          = _objectFact.createMerchantCalculationResultsElement();
      mResults.setResults(results);
      return convertToDOM(mResults);
    } catch (JAXBException jaxbEx) {
      throw new ProtocolException(jaxbEx.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.