ordercloud-api / headstart

A complete and opinionated eCommerce solution using OrderCloud as the backbone - built with .NET Core and Angular
MIT License
31 stars 74 forks source link

Resolved lineitem xp reset #421

Closed ajsuth closed 2 years ago

ajsuth commented 2 years ago

Amended patch of lineitem with concrete xp class to dynamic xp class to avoid overwriting/resetting all xp of the lineitem during the order calculate process.

ajsuth commented 2 years ago

After realising the gotcha with the patching partial classes using dynamic xp (from buyer.xp.MarkupPercent), I validated that this line of code was resetting all other lineitem xp to null, which was not the intention.

In considering whether we further investigate removing null properties to avoid data loss on top of minimising xp pollution, this may not be ideal as there may be valid reasons to want to null an existing xp value, which may require overengineering to manage long-term.