bumbummen99 / LaravelShoppingcart

A simple shopping cart implementation for Laravel
MIT License
505 stars 234 forks source link

Refactoring #145

Closed bumbummen99 closed 1 year ago

bumbummen99 commented 2 years ago
codecov-commenter commented 2 years ago

Codecov Report

Merging #145 (b14f991) into master (82a1e7d) will decrease coverage by 5.14%. The diff coverage is 91.56%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #145      +/-   ##
============================================
- Coverage     98.41%   93.27%   -5.15%     
+ Complexity      168      130      -38     
============================================
  Files             7        5       -2     
  Lines           442      342     -100     
============================================
- Hits            435      319     -116     
- Misses            7       23      +16     
Flag Coverage Δ
unittests 93.27% <91.56%> (-5.15%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/CartItemOptions.php 100.00% <ø> (ø)
src/Cart.php 91.66% <89.18%> (-7.58%) :arrow_down:
src/CartItem.php 97.50% <96.15%> (-1.65%) :arrow_down:
src/Config/cart.php 100.00% <100.00%> (ø)
src/ShoppingcartServiceProvider.php 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 82a1e7d...b14f991. Read the comment docs.

hlorofos commented 2 years ago

Keep going!

Kwaadpepper commented 1 year ago

I have got to the time to look at all of this yet, but I could make this suggestions, there are more benefits to store amounts in a smaller unit. Like the price to be stored in cents.

I have worked with some payment apis and the do work with cents instead of euro.

This simplify calculations. Then you round strategy could be used for getters and setters

This is a big change but this PR is a big refactor already.

EDIT : My bad just saw the vendor Money package is for this usage looking at this branch code.

bumbummen99 commented 1 year ago

https://github.com/bumbummen99/LaravelShoppingcart#attention