Package com.google.checkout.schema._2

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


      throws ProtocolException {
    if (biggerArea == null) {
      throw new ProtocolException("biggerArea cannot be null");
    }
   
    AllowedAreas allowedAreas
        = _objectFact.createShippingRestrictionsAllowedAreas();
    List allowedList = allowedAreas.getUsStateAreaOrUsZipAreaOrUsCountryArea();
    USCountryArea countryArea = _objectFact.createUSCountryArea();
    countryArea.setCountryArea(biggerArea);
    allowedList.add(countryArea);
    return allowedAreas;
  }
View Full Code Here


   * state abbreviations, U.S. zip codes or zip code patterns.
   * @return ExcludedAreas object
   */
  private ExcludedAreas createExcludedAreaByList(List areas)
      throws ProtocolException {
    ExcludedAreas excludedAreas
        = _objectFact.createShippingRestrictionsExcludedAreas();
    List excludedList
        = excludedAreas.getUsStateAreaOrUsZipAreaOrUsCountryArea();
    for (Object area : areas) {
      excludedList.add(area);
    }
    return excludedAreas;
  }
View Full Code Here

      throws ProtocolException {
    if (biggerArea == null) {
      throw new ProtocolException("biggerArea cannot be null");
    }
   
    ExcludedAreas excludedAreas
        = _objectFact.createShippingRestrictionsExcludedAreas();
    List allowedList = excludedAreas.getUsStateAreaOrUsZipAreaOrUsCountryArea();
    USCountryArea countryArea = _objectFact.createUSCountryArea();
    countryArea.setCountryArea(biggerArea);
    allowedList.add(countryArea);
    return excludedAreas;
  }
View Full Code Here

  public void testCreateShoppingCart() throws Exception {
    CheckoutCartBuilder pBuilder = CheckoutCartBuilder.getInstance();
    List<Item> cartItems = makeCartItems();
    int cartSize = cartItems.size();
    Date cartExpiry = new Date(System.currentTimeMillis() + 3600000L);
    ShoppingCart cart = pBuilder.createShoppingCart(cartItems, cartExpiry, null);
   
    assertNotNull(cart);
    assertEquals(cart.getItems().getItem().size(), cartSize);
    assertNull(cart.getMerchantPrivateData());
  }
View Full Code Here

    if (itemList == null) {
      throw new ProtocolException("itemList cannot be null");
    }
   
    // Create the <items> tag and add each item in the list to the cart
    ShoppingCart cart = _objectFact.createShoppingCart();
    Items items = _objectFact.createShoppingCartItems();
    List<Item> item_list = items.getItem();
    for (Item item : itemList) {
      item_list.add(item);
    }
   
    cart.setItems(items);
   
    // Add the expiration date if one is provided
    if (cartExpire != null) {
      GregorianCalendar gCal = new GregorianCalendar();
      gCal.setTime(cartExpire);
      XMLGregorianCalendar xmlCalendar
          = _dataFactory.newXMLGregorianCalendar(gCal);
      CartExpiration cartExpiry = _objectFact.createCartExpiration();
      cartExpiry.setGoodUntilDate(xmlCalendar);
      cart.setCartExpiration(cartExpiry);
    }

    // Add merchantPrivateData if it is provided
    if (merchantPrivateData != null) {
      AnyType anyType = _objectFact.createAnyType();
      anyType.setAny(merchantPrivateData);
      cart.setMerchantPrivateData(anyType);
    }
   
    return cart;
  }
View Full Code Here

      throw new ProtocolException("itemList cannot be null");
    }
   
    try {
      // Create the <items> tag and add each item in the list to the cart
      ShoppingCart cart = _objectFact.createShoppingCart();
      ItemsType items = _objectFact.createShoppingCartItemsType();
      List item_list = items.getItem();
      for (int i = 0; i < itemList.size(); i++) {
        item_list.add(itemList.get(i));
      }
      cart.setItems(items);
     
      // Add the expiration date if one is provided
      if (cartExpire != null) {
        GregorianCalendar gCal = new GregorianCalendar();
        gCal.setTime(cartExpire);
        CartExpiration cartExpiry = _objectFact.createCartExpiration();
        cartExpiry.setGoodUntilDate(gCal);
        cart.setCartExpiration(cartExpiry);
      }
 
      // Add merchantPrivateData if it is provided
      if (merchantPrivateData != null) {
        AnyType anyType = _objectFact.createAnyType();
        anyType.setAny(merchantPrivateData);
        cart.setMerchantPrivateData(anyType);
      }
     
      return cart;
    } catch (JAXBException jaxbEx) {
      throw new ProtocolException(jaxbEx.getMessage());
View Full Code Here

      throw new ProtocolException("itemList cannot be null");
    }
   
    // Create the <items> tag and add each item in the list to the cart
    ShoppingCart cart = _objectFact.createShoppingCart();
    Items items = _objectFact.createShoppingCartItems();
    List<Item> item_list = items.getItem();
    for (Item item : itemList) {
      item_list.add(item);
    }
   
    cart.setItems(items);
View Full Code Here

      for (AlternateTaxTable aTaxtable : alterTaxTableList) {
        aTaxList.add(aTaxtable);
      }
    }
   
    TaxTables taxTables = _objectFact.createTaxTables();
    taxTables.setDefaultTaxTable(defaultTaxTable);
    taxTables.setAlternateTaxTables(aTables);
   
    MerchantCheckoutFlowSupport mChkoutSupport
        = _objectFact.createMerchantCheckoutFlowSupport();
    mChkoutSupport.setContinueShoppingUrl(continueShoppingUrl);
    mChkoutSupport.setEditCartUrl(editCartUrl);
View Full Code Here

        for (int i = 0; i < alterTaxTableList.size(); i++) {
          aTaxList.add(alterTaxTableList.get(i));
        }
      }
     
      TaxTables taxTables = _objectFact.createTaxTables();
      taxTables.setDefaultTaxTable(defaultTaxTable);
      taxTables.setAlternateTaxTables(aTables);
     
      MerchantCheckoutFlowSupport mChkoutSupport
          = _objectFact.createMerchantCheckoutFlowSupport();
      mChkoutSupport.setContinueShoppingUrl(continueShoppingUrl);
      mChkoutSupport.setEditCartUrl(editCartUrl);
View Full Code Here

      ShippingMethods methods, DefaultTaxTable defaultTaxTable,
      List<AlternateTaxTable> alterTaxTableList,
      MerchantCalculations couponInfo, String editCartUrl,
      String continueShoppingUrl) throws ProtocolException {

    AlternateTaxTables aTables
        = _objectFact.createTaxTablesAlternateTaxTables();
    List<AlternateTaxTable> aTaxList = aTables.getAlternateTaxTable();
    if (alterTaxTableList != null) {
      for (AlternateTaxTable aTaxtable : alterTaxTableList) {
        aTaxList.add(aTaxtable);
      }
    }
View Full Code Here

TOP

Related Classes of com.google.checkout.schema._2.ObjectFactory

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.