Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cart: move all calculations to cart behaviour implementation #339

Merged
merged 35 commits into from
Nov 18, 2021
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
c6f8b10
cart: work on reducing calculations
tessig Sep 27, 2021
a0c04ba
Remove item builder, update item splitter to fill newly added fields
carstendietrich Sep 29, 2021
0215d5e
Remove cart builder, remove cart/delivery calculations. Start test re…
carstendietrich Sep 29, 2021
ae92674
cart: add tests for item and splitter
tessig Sep 29, 2021
09d967b
Remove delivery builder, add test boilerplate for delivery
carstendietrich Sep 29, 2021
3fefe30
cart: test payment required items
tessig Sep 29, 2021
6897922
Fix discount tests, switch to new fields in many places
carstendietrich Sep 30, 2021
d8c01d5
Fix more discount
carstendietrich Sep 30, 2021
afb2d4c
Fix more tests
carstendietrich Sep 30, 2021
8353b7d
Bump test coverage of delivery domain model
carstendietrich Sep 30, 2021
ef71c4a
Fix cart tests
carstendietrich Sep 30, 2021
c265532
Add more test coverage
carstendietrich Sep 30, 2021
84f803e
Bump cart test coverage
carstendietrich Sep 30, 2021
487ba23
Fix default in memory cart WIP
carstendietrich Sep 30, 2021
0c2bd51
cart: calculate totals
tessig Sep 30, 2021
1797f0c
Fix all the tests
carstendietrich Sep 30, 2021
b90c7c0
Go generate
carstendietrich Sep 30, 2021
8370608
adjust changelog
tessig Sep 30, 2021
a4974e5
update documentation
tessig Oct 1, 2021
2bebe4c
251306: update changelog and create migration help
tessig Oct 1, 2021
e982866
fix sed script, remove obsolete changelog files, regenerate
carstendietrich Oct 4, 2021
ddca644
remove sum from price fields
tessig Oct 4, 2021
fcd2d90
remove sum from price fields
tessig Oct 4, 2021
f084893
Fix item splitting
carstendietrich Oct 5, 2021
62da647
remove todo
carstendietrich Oct 7, 2021
3f41def
Work again on item splitter
carstendietrich Nov 2, 2021
f6aeba2
cart: make item split sum-invariant
tessig Nov 3, 2021
9d4afef
Merge branch 'master' into refactor-cart-calculations
carstendietrich Nov 8, 2021
eed0110
cart: introduce net values and duties
tessig Nov 9, 2021
a61834f
cart: remove duties again
tessig Nov 9, 2021
9962b2c
cart: add basic calculation of new grand total net field
carstendietrich Nov 9, 2021
71c45bf
Update changelog, add new fields move to 3.6.0
carstendietrich Nov 9, 2021
1872009
Check if there are taxes before adding
carstendietrich Nov 9, 2021
58144d1
Merge branch 'master' into refactor-cart-calculations
carstendietrich Nov 18, 2021
19d2f08
Update changelog to final version
carstendietrich Nov 18, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,60 @@
# Changelog
## v3.6.0 [upcoming]

**cart**
* **Breaking**: Move all calculations to cart behaviour implementation
* By moving calculation responsibility, we enable different implementation possibilities for calculations like tax before or after discounts, tax on single item or sum and different tax rounding modes instead of having it hard-coded in the flamingo cart.
* All calculation functions on cart item, shipping item, delivery and cart are now public fields for which the values must be set by the cart behaviour implementation
* The `DefaultCartBehaviour` calculates all new fields accordingly
* To help with the migration there are sed commands for the following fields in `cart/migration.sed`: run `find . -type f -iname '*.go' -exec gsed -i -f migration.sed "{}" +;`
* Cart items
* | Old Function | New Field |
|----------------------------------------|--------------------------------------|
| RowPriceGrossWithDiscount() | RowPriceGrossWithDiscount |
| RowPriceGrossWithItemRelatedDiscount() | RowPriceGrossWithItemRelatedDiscount |
| RowPriceNetWithDiscount() | RowPriceNetWithDiscount |
| RowPriceNetWithItemRelatedDiscount() | RowPriceNetWithItemRelatedDiscount |
| TotalDiscountAmount() | TotalDiscountAmount |
| ItemRelatedDiscountAmount() | ItemRelatedDiscountAmount |
| NonItemRelatedDiscountAmount() | NonItemRelatedDiscountAmount |
* Shipping items
* | Old Function | New Field |
|----------------------------|-------------------------|
| TotalWithDiscountInclTax() | PriceGrossWithDiscounts |
| - | PriceNetWithDiscounts |
* Deliveries
* | Old Function | New Field |
|-----------------------------------|---------------------------------|
| SubTotalGross() | SubTotalGross |
| SubTotalNet() | SubTotalNet |
| SumTotalDiscountAmount() | TotalDiscountAmount |
| SumSubTotalDiscountAmount() | SubTotalDiscountAmount |
| SumNonItemRelatedDiscountAmount() | NonItemRelatedDiscountAmount |
| SumItemRelatedDiscountAmount() | ItemRelatedDiscountAmount |
| SubTotalGrossWithDiscounts() | SubTotalGrossWithDiscounts |
| SubTotalNetWithDiscounts() | SubTotalNetWithDiscounts |
| GrandTotal() | GrandTotal |
* Cart
* | Old Function | New Field |
|-----------------------------------|---------------------------------|
| GrandTotal() | GrandTotal |
| - | GrandTotalNet |
| SumShippingNet() | ShippingNet |
| SumShippingNetWithDiscounts() | ShippingNetWithDiscounts |
| SumShippingGross() | ShippingGross |
| SumShippingGrossWithDiscounts() | ShippingGrossWithDiscounts |
| SubTotalGross() | SubTotalGross |
| SubTotalNet() | SubTotalNet |
| SubTotalGrossWithDiscounts() | SubTotalGrossWithDiscounts |
| SubTotalNetWithDiscounts() | SubTotalNetWithDiscounts |
| SumTotalDiscountAmount() | TotalDiscountAmount |
| SumNonItemRelatedDiscountAmount() | NonItemRelatedDiscountAmount |
| SumItemRelatedDiscountAmount() | ItemRelatedDiscountAmount |
| SumAppliedGiftCards() | TotalGiftCardAmount |
| SumGrandTotalWithGiftCards() | GrandTotalWithGiftCards |
| - | GrandTotalNetWithGiftCards |


## v3.5.0
**general**
* Switch to MIT License
Expand Down Expand Up @@ -36,6 +90,7 @@
* **Breaking**: `Commerce_Cart_UpdateDeliveryShippingOptions` mutation responded with slice of `Commerce_Cart_DeliveryAddressForm` which was incorrect as we don't process any form data within the mutation. It responds now rightly only with `processed` state.
* **Breaking**: Upgrade github.com/go-playground/form to v4, all types are fully compatible, but import paths have to be changed


**checkout**
* Introducing Flamingo events on final states of the place order process
* Introduce a max ttl for the checkout state machine to avoid polluting the redis with stale checkout processes, defaults to 2h
Expand Down
102 changes: 0 additions & 102 deletions cart/Changelog.md

This file was deleted.

Loading