commercetools-jvm-sdk
commercetools-jvm-sdk copied to clipboard
LineItem from ShoppingList and Cart should have stereotype
http://commercetools.github.io/commercetools-jvm-sdk/apidocs/io/sphere/sdk/carts/LineItem.html and http://commercetools.github.io/commercetools-jvm-sdk/apidocs/io/sphere/sdk/shoppinglists/LineItem.html do not share a common interface so I need to code similar stuff twice. Think also about including to another common interface CustomLineItems from Cart.
Common fields of the LineItem classes are:
- custom
- id
- name
- productId
- productSlug
- productType
- quantity
- variant
Why would this be useful? For example for typed templates to reuse the same template to show an item in the wishlist and in the cart.
cc @lauraluiz
Yep i have noticed too, i agree this need some refactoring. if possible to make a PR there that would be great. Otherwise we'll just include it later in the sdk. WDYT @schleichardt ?
It is not that urgent so I would wait.
In order to refactor we need to use LineItemLike wich is already there but contains members that aren't in shopping lists LineItem, so the refactoring is break changing which unfortunately means it should be postponed to 2.0.
Actually we have 4 classes that can benefit from this: custom line items, regular cart line items, regular shopping list line items and text line items. All of them have different levels of "similarity" among them. For example:
- all 4 of them might share a common interface (haven't checked)
- regular cart and regular shopping list line items share the "product" part.
- regular cart and custom line item share the current LineItemLike interface and it should stay like that (except for the name).
- regular shopping list and text line item might share a common interface (haven't checked).
Just something to take into account for 2.0 :)