Currently the product and the payload of the order line items have a purchase price field of type float. For multiple reasons a more complex PriceField with gross and net prices as well as currencies would be much more suitable.
2. What does this change do, exactly?
A new purchase price field purchase_prices of type PriceField was added to the product definition as well as to the order line items (and some corresponding classes).
The old float purchase price field (and some corresponding functions) are marked as deprecated.
A migration was added to migrate the deprecated purchase price field to the new one.
A ApiConverter was added to provide the old purchase price field for the api v1 and the new field for the api v2.
A database trigger was added to keep the deprecated purchase price field in sync with the new one (updating either will update the other).
The existing LineItemPurchasePriceRule was removed in favour of LineItemPurchasePriceGrossRule and LineItemPurchasePriceNetRule.
Existing tests were updated and some new tests were added.
The administration product view was updated to display the new purchase price field. The layout is open for discussion:
3. Describe each step to reproduce the issue or behaviour.
4. Please link to the relevant issues (if any).
5. Checklist
[x] I have written tests and verified that they fail without my change
[x] I have squashed any insignificant commits
[x] I have written or adjusted the documentation according to my changes
[x] This change has comments for package types, values, functions, and non-obvious lines of code
[x] I have read the contribution requirements and fulfil them.
1. Why is this change necessary?
Currently the product and the payload of the order line items have a purchase price field of type
float
. For multiple reasons a more complexPriceField
with gross and net prices as well as currencies would be much more suitable.2. What does this change do, exactly?
purchase_prices
of typePriceField
was added to the product definition as well as to the order line items (and some corresponding classes).float
purchase price field (and some corresponding functions) are marked as deprecated.LineItemPurchasePriceRule
was removed in favour ofLineItemPurchasePriceGrossRule
andLineItemPurchasePriceNetRule
.3. Describe each step to reproduce the issue or behaviour.
4. Please link to the relevant issues (if any).
5. Checklist