Package org.multibit.mbm.client.interfaces.rest.api.cart

Examples of org.multibit.mbm.client.interfaces.rest.api.cart.CartItemDto


    // Read the cart items
    Collection<Map.Entry<String,ReadableRepresentation>> cartitemRepresentations = rr.getResources();

    for (Map.Entry<String, ReadableRepresentation> cartItemRepresentation : cartitemRepresentations) {

      CartItemDto cartItem = buildClientCartItem(cartItemRepresentation.getValue().getProperties());

      // Extract the embedded item
      Preconditions.checkArgument(cartItemRepresentation.getValue().getResources().size()==1);

      // TODO Fix or replace this
View Full Code Here


    return clientCart;
  }

  private CartItemDto buildClientCartItem(Map<String, Object> properties) {

    CartItemDto cartItem = new CartItemDto();
    Integer index = getMandatoryPropertyAsInteger("index",properties);
    Integer quantity = getMandatoryPropertyAsInteger("quantity", properties);
    String priceSubtotal = getMandatoryPropertyAsString("price_subtotal", properties);
    String taxSubtotal = getMandatoryPropertyAsString("tax_subtotal", properties);
    String cartItemSubtotal = getMandatoryPropertyAsString("cart_item_subtotal", properties);

    cartItem.setIndex(index);
    cartItem.setQuantity(quantity);
    cartItem.setPriceSubtotal(priceSubtotal);
    cartItem.setTaxSubtotal(taxSubtotal);
    cartItem.setCartItemSubtotal(cartItemSubtotal);

    return cartItem;
  }
View Full Code Here

public class CopyCartItem implements DomainAdapter<CartItemDto, CartItem> {

  @Override
  public CartItemDto on(CartItem cartItem) {

    CartItemDto dto = new CartItemDto();

    dto.setIndex(cartItem.getIndex());

    dto.setQuantity(cartItem.getQuantity());

    dto.setItem(ItemAdapters.copyItem(cartItem.getItem()));

    // Sub totals
    dto.setCartItemSubtotal(cartItem.getCartItemSubtotal().toString());
    dto.setPriceSubtotal(cartItem.getPriceSubtotal().toString());
    dto.setTaxSubtotal(cartItem.getTaxSubtotal().toString());

    return dto;
  }
View Full Code Here

    // Read the cart items
    Collection<Map.Entry<String, ReadableRepresentation>> cartitemResources = rr.getResources();

    for (Map.Entry<String, ReadableRepresentation> cartItemResource : cartitemResources) {

      CartItemDto cartItem = buildClientCartItem(cartItemResource.getValue().getProperties());

      // Extract the embedded item
      Preconditions.checkArgument(cartItemResource.getValue().getResources().size()==1);

      // TODO Fix or replace this
View Full Code Here

    return clientCart;
  }

  private CartItemDto buildClientCartItem(Map<String, Object> properties) {

    CartItemDto cartItem = new CartItemDto();
    Integer index = getMandatoryPropertyAsInteger("index",properties);
    Integer quantity = getMandatoryPropertyAsInteger("quantity", properties);
    String priceSubtotal = getMandatoryPropertyAsString("price_subtotal", properties);
    String taxSubtotal = getMandatoryPropertyAsString("tax_subtotal", properties);
    String cartItemSubtotal = getMandatoryPropertyAsString("cart_item_subtotal", properties);

    cartItem.setIndex(index);
    cartItem.setQuantity(quantity);
    cartItem.setPriceSubtotal(priceSubtotal);
    cartItem.setTaxSubtotal(taxSubtotal);
    cartItem.setCartItemSubtotal(cartItemSubtotal);

    return cartItem;
  }
View Full Code Here

TOP

Related Classes of org.multibit.mbm.client.interfaces.rest.api.cart.CartItemDto

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.