woocommerce / woocommerce-ios

WooCommerce iOS app
https://www.woocommerce.com/mobile
GNU General Public License v2.0
325 stars 114 forks source link

[Woo POS] Make `CartItem` protocol #12920

Open iamgabrielma opened 6 months ago

iamgabrielma commented 6 months ago

Continuation from https://github.com/woocommerce/woocommerce-ios/pull/12882

It would probably be better if this model conformed to a new protocol CartItem, also generic, and only had simple value types. The properties should only be the things it actually needs to display/perform the required actions on the cart.

Adding a makeCartItem() -> CartItem function to the POSItem protocol lets you define the logic for translating from POSProduct to CartProduct in the concrete implementation, but call it here while being ignorant of whether these are products or... any other type of POSItem.

dangermattic commented 6 months ago

Thanks for reporting! 👍

staskus commented 4 months ago

@iamgabrielma do you think it's required for M2 or can we close it / move it from the milestone?

iamgabrielma commented 4 months ago

I don't think is necessary for M2, just a "nice to have" if we can fit it at some point