-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Checkout plugins rework #4980
Checkout plugins rework #4980
Conversation
saleor/checkout/base_calculations.py
Outdated
checkout: "Checkout", discounts: "DiscountsListType" = None | ||
) -> TaxedMoney: | ||
"""Return checkout shipping price.""" | ||
# FIXME: should it take discounts in account? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@korycins wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any usage of discount for shipping, so I assume that we can skip them for base but plugin should still recieve a discounts for calculate_checkout_shipping
There are conflicts to be fixed - but I would like to hear what do you think bout those changes |
saleor/checkout/base_calculations.py
Outdated
checkout: "Checkout", discounts: "DiscountsListType" = None | ||
) -> TaxedMoney: | ||
"""Return checkout shipping price.""" | ||
# FIXME: should it take discounts in account? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any usage of discount for shipping, so I assume that we can skip them for base but plugin should still recieve a discounts for calculate_checkout_shipping
CENTS = Decimal("0.01") | ||
if TYPE_CHECKING: | ||
from ..product.models import ProductVariant | ||
from django_measurement import Weight |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if isort
handled that. Maybe we could separate 3rd packages from our modules? Or just put it above the if
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Related issue: PyCQA/isort#818
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe laziness is speaking thru me, but unless any tool does not manage that, I don't want to go back to pre isort/black time and deal with it manually :/ Type checking sections tend to be way smaller than usual imports so maybe it's not an issue?
I don't understand codeclimate. According to http://pylint.pycqa.org/en/latest/whatsnew/2.0.html TYPE_CHECKING should be handled by pylint :/ |
Here is the report for 08efd3a (krzysztofwolski/saleor @ checkout-plugins-rework) No differences were found. (click me)
# api.benchmark checkout
test name left count right count duplicate count
------------------------------------------- ----------- ----------- ---------------
add billing address to checkout 34 34 20
add shipping to checkout 7 7 0
checkout payment charge 10 10 0
complete checkout 8 8 0
create checkout 50 50 24
# api.benchmark homepage
test name left count right count duplicate count
------------------------------------------- ----------- ----------- ---------------
retrieve main menu 5 5 0
retrieve product list 4 4 0
retrieve secondary menu 5 5 0
retrieve shop 2 2 0
# api.benchmark product
test name left count right count duplicate count
------------------------------------------- ----------- ----------- ---------------
product details 15 15 3
retrieve product attributes 9 9 0
# api.benchmark variant
test name left count right count duplicate count
------------------------------------------- ----------- ----------- ---------------
product variant bulk create 51 51 3
retrieve variant list 15 15 6
# api product sorting attributes
test name left count right count duplicate count
------------------------------------------- ----------- ----------- ---------------
sort product not having attribute data 21 21 0 |
Codecov Report
@@ Coverage Diff @@
## master #4980 +/- ##
==========================================
- Coverage 91.21% 91.01% -0.21%
==========================================
Files 351 353 +2
Lines 21404 21434 +30
Branches 2044 2050 +6
==========================================
- Hits 19524 19508 -16
- Misses 1326 1371 +45
- Partials 554 555 +1
Continue to review full report at Codecov.
|
Thats because lines total handles taxes by default
I want to merge this change because...
Screenshots
Pull Request Checklist