Skip to content

Commit

Permalink
251306: update changelog and create migration help
Browse files Browse the repository at this point in the history
  • Loading branch information
tessig committed Oct 1, 2021
1 parent 8dfa5c2 commit 4d7a5a8
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 1 deletion.
48 changes: 47 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,53 @@
* **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
* 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() | SumTotalDiscountAmount |
| SumSubTotalDiscountAmount() | SumSubTotalDiscountAmount |
| SumNonItemRelatedDiscountAmount() | SumNonItemRelatedDiscountAmount |
| SumItemRelatedDiscountAmount() | SumItemRelatedDiscountAmount |
| SubTotalGrossWithDiscounts() | SubTotalGrossWithDiscounts |
| SubTotalNetWithDiscounts() | SubTotalNetWithDiscounts |
| GrandTotal() | GrandTotal |
* Cart
* | Old Function | New Field |
|-----------------------------------|---------------------------------|
| GrandTotal() | GrandTotal |
| SumShippingNet() | SumShippingNet |
| SumShippingNetWithDiscounts() | SumShippingNetWithDiscounts |
| SumShippingGross() | SumShippingGross |
| SumShippingGrossWithDiscounts() | SumShippingGrossWithDiscounts |
| SubTotalGross() | SubTotalGross |
| SubTotalNet() | SubTotalNet |
| SubTotalGrossWithDiscounts() | SubTotalGrossWithDiscounts |
| SubTotalNetWithDiscounts() | SubTotalNetWithDiscounts |
| SumTotalDiscountAmount() | SumTotalDiscountAmount |
| SumNonItemRelatedDiscountAmount() | SumNonItemRelatedDiscountAmount |
| SumItemRelatedDiscountAmount() | SumItemRelatedDiscountAmount |
| - | SumAppliedGiftCards |
| - | SumGrandTotalWithGiftCards |


**checkout**
* Introducing Flamingo events on final states of the place order process
Expand Down
33 changes: 33 additions & 0 deletions cart/migration.sed
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# cart item
s/.RowPriceGrossWithDiscount()/.RowPriceGrossWithDiscount/
s/.RowPriceGrossWithItemRelatedDiscount()/.RowPriceGrossWithItemRelatedDiscount/
s/.RowPriceNetWithDiscount()/.RowPriceNetWithDiscount/
s/.RowPriceNetWithItemRelatedDiscount()/.RowPriceNetWithItemRelatedDiscount/
s/.TotalDiscountAmount()/.TotalDiscountAmount/
s/.ItemRelatedDiscountAmount()/.ItemRelatedDiscountAmount/
s/.NonItemRelatedDiscountAmount()/.NonItemRelatedDiscountAmount/
# shipping item
s/.TotalWithDiscountInclTax()/.PriceGrossWithDiscounts/
# delivery
s/.SubTotalGross()/.SubTotalGross/
s/.SubTotalNet()/.SubTotalNet/
s/.SumTotalDiscountAmount()/.SumTotalDiscountAmount/
s/.SumSubTotalDiscountAmount()/.SumSubTotalDiscountAmount/
s/.SumNonItemRelatedDiscountAmount()/.SumNonItemRelatedDiscountAmount/
s/.SumItemRelatedDiscountAmount()/.SumItemRelatedDiscountAmount/
s/.SubTotalGrossWithDiscounts()/.SubTotalGrossWithDiscounts/
s/.SubTotalNetWithDiscounts()/.SubTotalNetWithDiscounts/
s/.GrandTotal()/.GrandTotal/
# cart
s/.GrandTotal()/.GrandTotal/
s/.SumShippingNet()/.SumShippingNet/
s/.SumShippingNetWithDiscounts()/.SumShippingNetWithDiscounts/
s/.SumShippingGross()/.SumShippingGross/
s/.SumShippingGrossWithDiscounts()/.SumShippingGrossWithDiscounts/
s/.SubTotalGross()/.SubTotalGross/
s/.SubTotalNet()/.SubTotalNet/
s/.SubTotalGrossWithDiscounts()/.SubTotalGrossWithDiscounts/
s/.SubTotalNetWithDiscounts()/.SubTotalNetWithDiscounts/
s/.SumTotalDiscountAmount()/.SumTotalDiscountAmount/
s/.SumNonItemRelatedDiscountAmount()/.SumNonItemRelatedDiscountAmount/
s/.SumItemRelatedDiscountAmount()/.SumItemRelatedDiscountAmount/

0 comments on commit 4d7a5a8

Please sign in to comment.