public static Cart createWalletCart(com.shopify.buy.model.Cart shopifyCart,Shop shop){
  if (shopifyCart == null) {
    throw new NullPointerException("shopifyCart cannot be null");
  }
  if (shop == null) {
    throw new NullPointerException("shop cannot be null");
  }
  Cart.Builder builder=Cart.newBuilder();
  builder.setCurrencyCode(shop.getCurrency());
  BigDecimal totalPrice=new BigDecimal(0);
  for (  com.shopify.buy.model.LineItem shopifyLineItem : shopifyCart.getLineItems()) {
    LineItem lineItem=createWalletLineItem(shopifyLineItem,shop.getCurrency());
    totalPrice=totalPrice.add(new BigDecimal(lineItem.getTotalPrice()));
    builder.addLineItem(lineItem);
  }
  builder.setTotalPrice(totalPrice.toString());
  return builder.build();
}

public static Cart createWalletCart ( com . shopify . buy . model . Cart shopifyCart , Shop shop ) { if ( shopifyCart == null ) { throw new NullPointerException ( "shopifyCart cannot be null" ) ; } if ( shop == null ) { throw new NullPointerException ( "shop cannot be null" ) ; } Cart . Builder builder = Cart . newBuilder ( ) ; builder . setCurrencyCode ( shop . getCurrency ( ) ) ; BigDecimal totalPrice = new BigDecimal ( 0 ) ; for ( com . shopify . buy . model . LineItem shopifyLineItem : shopifyCart . getLineItems ( ) ) { LineItem lineItem = createWalletLineItem ( shopifyLineItem , shop . getCurrency ( ) ) ; totalPrice = totalPrice . add ( new BigDecimal ( lineItem . getTotalPrice ( ) ) ) ; builder . addLineItem ( lineItem ) ; } builder . setTotalPrice ( totalPrice . toString ( ) ) ; return builder . build ( ) ; }
creates a wallet cart from a shopify cart for use in wallet requests .
