Package com.google.code.magja.model.cart

Examples of com.google.code.magja.model.cart.Cart


    }

    @Test
    public void testCreate() {
        try {
            Cart cart = service.create(0);
            if (cart == null) {
                fail("Could not create cart [cart.create]");
            }
            System.out.println("Created cart " + cart);
        } catch (ServiceException e) {
View Full Code Here


    public void testSetCustomer() {
        try {
            Customer customer = generateCustomer();
            customerService.save(customer);

            Cart cart = service.create(0);
            System.out.println("Created cart " + cart);
            cart.setCustomer(customer);
            service.setCustomer(cart);
        } catch (ServiceException e) {
            fail(e.getMessage());
        }
    }
View Full Code Here

    }

    @Test
    public void testGetLicenseAgreements() {
        try {
            Cart cart = service.create(0);
            System.out.println("Created cart " + cart);
            service.getLicenseAgreements(cart);
            System.out.println("Received licenses: " + cart.getLicenseAgreements().size());
            for (CartLicense item : cart.getLicenseAgreements()) {
                System.out.println("    license " + item);
            }
        } catch (ServiceException e) {
            fail(e.getMessage());
        }
View Full Code Here

    }

    @Test
    public void testGetTotals() {
        try {
            Cart cart = service.create(0);
            System.out.println("Created cart " + cart);
            service.getTotals(cart);
            System.out.println("Received totals: " + cart.getLicenseAgreements().size());
            for (CartTotal item : cart.getTotals()) {
                System.out.println("    total " + item);
            }
        } catch (ServiceException e) {
            fail(e.getMessage());
        }
View Full Code Here

    public void testGetById() {
        try {
            Customer customer = generateCustomer();
            customerService.save(customer);

            Cart cart = service.create(0);
            cart.setCustomer(customer);
            service.setCustomer(cart);

            Cart other = service.getById(cart.getId(), cart.getStoreId());
            Assert.assertEquals(cart.getId(), other.getId());
            Assert.assertEquals(cart.getStoreId(), other.getStoreId());
            Assert.assertEquals(cart.getCustomer().getId(), other.getCustomer().getId());
        } catch (ServiceException e) {
            fail(e.getMessage());
        }
    }
View Full Code Here

            customerAddressService.save(shipAddr);
            System.out.println("Creating default bill addr");
            customerAddressService.save(billAddr);

            System.out.println("Creating cart");
            Cart cart = service.create(0);
            System.out.println("Created cart " + cart);

            System.out.println("Setting customer");
            cart.setCustomer(customer);
            service.setCustomer(cart);

            System.out.println("Adding product");
            Product p = new Product();
            p.setSku("NI3TP");      //FIXME
            p.setId(53);            //FIXME
            service.addProduct(cart, p, 1);

            System.out.println("Setting cart addresses");
            System.err.println(shipAddr.getAllProperties());
            CartAddress cartShipAddr = CartAddress.fromAttributes(shipAddr.getAllProperties());
            CartAddress cartBillAddr = CartAddress.fromAttributes(billAddr.getAllProperties());
            cart.setBillingaddress(cartBillAddr);
            cart.setShippingAddress(cartShipAddr);
            service.setAddresses(cart);

            System.out.println("Creating order");
            service.order(cart);
        } catch (ServiceException e) {
View Full Code Here

  @Override
  public Cart create(Integer storeId) throws ServiceException {
    try {
      Integer id = (Integer) soapClient.call(
          ResourcePath.ShoppingCartCreate, storeId);
      Cart cart = new Cart();
      cart.setId(id);
      cart.setStoreId(storeId);
      return cart;
    } catch (AxisFault e) {
      if (debug) {
        e.printStackTrace();
      }
View Full Code Here

TOP

Related Classes of com.google.code.magja.model.cart.Cart

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.