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

Drop country middleware #6784

Merged
merged 27 commits into from Feb 10, 2021
Merged

Drop country middleware #6784

merged 27 commits into from Feb 10, 2021

Conversation

maarcingebala
Copy link
Member

@maarcingebala maarcingebala commented Jan 25, 2021

This PR drops the country middleware (saleor.core.middleware.country), which was using GeoIP to determine the user's country. In the new approach, user location is provided as an argument in queries or mutations that need it for tax or stock calculations.

Note: this PR removes CheckoutPaymentCreate.billingAddress input field which is a breaking change. The idea is that we should always use billing address from the checkout instance, to have one way of providing billing addresses for payments. This field will be marked as deprecated in Saleor 2.11.

Fixes #4315

Todo:

  • update test_variant_availability.py tests to use new address parameter
  • add tests for queries that use the new param
  • deprecate CheckoutPaymentCreate.billingAddress input on 2.11

Impact

  • New migrations
  • New/Updated API fields or mutations
  • Deprecated API fields or mutations
  • Removed API types, fields, or mutations
  • Documentation needs to be updated

Pull Request Checklist

  • Privileged queries and mutations are guarded by proper permission checks
  • Database queries are optimized and the number of queries is constant
  • Database migration files are up to date
  • The changes are tested
  • GraphQL schema and type definitions are up to date
  • Changes are mentioned in the changelog

@lgtm-com
Copy link

lgtm-com bot commented Jan 25, 2021

This pull request introduces 2 alerts and fixes 1 when merging 1b7d4ad into d32d5bf - view on LGTM.com

new alerts:

  • 1 for Unused import
  • 1 for Variable defined multiple times

fixed alerts:

  • 1 for Unused local variable

@lgtm-com
Copy link

lgtm-com bot commented Jan 25, 2021

This pull request introduces 2 alerts and fixes 1 when merging db99438 into 50eff94 - view on LGTM.com

new alerts:

  • 1 for Unused import
  • 1 for Variable defined multiple times

fixed alerts:

  • 1 for Unused local variable

@patrys
Copy link
Member

patrys commented Jan 26, 2021

@db-queries
Copy link

db-queries bot commented Jan 26, 2021

Here is the report for dc77bec (mirumee:4315-drop-context-country)
Base comparison is 8a33bfb.

Found 6 differences! (click me)

# saleor.graphql.accountbenchmark account
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
  delete staff members                                       	         32	         32	              0
  query staff user                                           	         20	         20	              4
  staff create                                               	         22	         22	              4
  staff update groups and permissions                        	         33	         33	              5

# saleor.graphql.accountbenchmark permission group
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
  permission group create                                    	         19	         19	              2
  permission group delete                                    	         20	         20	              3
  permission group query                                     	          7	          7	              0
  permission group update                                    	         33	         33	              1
  permission group update remove users with manage staff     	         27	         27	              3

# saleor.graphql.attributebenchmark attribute
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
  query attribute                                            	          7	          7	              2
  query attributes                                           	         11	         11	              3

# saleor.graphql.checkoutbenchmark checkout mutations
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
  add billing address to checkout                            	         53	         53	              8
  add shipping to checkout                                   	         64	         64	             12
  checkout email update                                      	         26	         26	              3
  checkout payment charge                                    	         34	         34	             11
  checkout shipping address update                           	         64	         64	             13
  checkout voucher code                                      	         64	         64	             10
  complete checkout                                          	        109	        109	             20
  create checkout                                            	         79	         79	             16
  customer complete checkout                                 	        146	        146	             34
- update checkout lines                                      	         91	         93	             24

# saleor.graphql.checkoutbenchmark homepage
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
  user checkout details                                      	         39	         39	              2

# saleor.graphql.discountbenchmark sales
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
  sales query with channel slug                              	         16	         16	              0
  sales query withot channel slug                            	         15	         15	              0

# saleor.graphql.discountbenchmark vouchers
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
  vouchers query with channel slug                           	         16	         16	              0
  vouchers query withot channel slug                         	         15	         15	              0

# saleor.graphql.menubenchmark homepage
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
  retrieve main menu                                         	          5	          5	              0
  retrieve secondary menu                                    	          5	          5	              0

# saleor.graphql.orderbenchmark order
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
- user order details                                         	         20	         22	              1

# saleor.graphql.pagebenchmark page type
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
  query page type                                            	         17	         17	              5
  query page types                                           	         19	         19	              5

# saleor.graphql.productbenchmark category
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
- category view                                              	         22	         24	              1

# saleor.graphql.productbenchmark collection
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
  collection view                                            	          6	          6	              0
  retrieve collection channel listings                       	          4	          4	              0

# saleor.graphql.productbenchmark homepage
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
  report product sales                                       	         10	         10	              3
  retrieve product list                                      	          4	          4	              0

# saleor.graphql.productbenchmark product
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
- product details                                            	         24	         26	              0
- retrieve channel listings                                  	         16	         18	              0
  retrieve product attributes                                	          8	          8	              0
  retrive products with product types and attributes         	          6	          6	              0

# saleor.graphql.productbenchmark variant
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
  product variant bulk create                                	         59	         59	              2
- retrieve variant list                                      	         22	         24	              0

# saleor.graphql.productbenchmark variant stocks
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
  product variants stocks create                             	         22	         22	              5
  product variants stocks delete                             	         19	         19	              5
  product variants stocks update                             	         27	         27	              5

# saleor.graphql.producttest product sorting attributes
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
  sort product not having attribute data                     	         23	         23	              0

# saleor.graphql.shippingbenchmark shipping methods
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
  vouchers query with channel slug                           	         10	         10	              0
  vouchers query without channel slug                        	          9	          9	              0

# saleor.graphql.shopbenchmark homepage
  test name                                                  	left count 	right count	duplicate count
  -----------------------------------------------------------	-----------	-----------	---------------
  retrieve shop                                              	          2	          2	              0

@codecov
Copy link

codecov bot commented Jan 26, 2021

Codecov Report

Merging #6784 (6f7f1a5) into master (8a33bfb) will increase coverage by 0.02%.
The diff coverage is 95.55%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6784      +/-   ##
==========================================
+ Coverage   92.91%   92.94%   +0.02%     
==========================================
  Files         395      395              
  Lines       27922    27904      -18     
  Branches     2912     2908       -4     
==========================================
- Hits        25945    25934      -11     
+ Misses       1381     1379       -2     
+ Partials      596      591       -5     
Impacted Files Coverage Δ
saleor/core/middleware.py 80.00% <ø> (-1.71%) ⬇️
saleor/graphql/payment/mutations.py 97.18% <ø> (+1.23%) ⬆️
saleor/graphql/shop/types.py 95.60% <ø> (-0.30%) ⬇️
saleor/product/utils/availability.py 96.73% <ø> (-0.11%) ⬇️
saleor/tests/settings.py 89.65% <ø> (-0.35%) ⬇️
saleor/graphql/product/types/products.py 92.92% <86.66%> (-0.29%) ⬇️
saleor/graphql/checkout/mutations.py 95.80% <100.00%> (+0.61%) ⬆️
saleor/graphql/product/types/channels.py 100.00% <100.00%> (ø)
saleor/graphql/utils/__init__.py 92.00% <100.00%> (+1.23%) ⬆️
saleor/graphql/warehouse/dataloaders.py 100.00% <100.00%> (ø)
... and 2 more

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 8a33bfb...dc77bec. Read the comment docs.

@lgtm-com
Copy link

lgtm-com bot commented Jan 26, 2021

This pull request introduces 2 alerts and fixes 1 when merging c22bf69 into 50eff94 - view on LGTM.com

new alerts:

  • 1 for Unused import
  • 1 for Variable defined multiple times

fixed alerts:

  • 1 for Unused local variable

@lgtm-com
Copy link

lgtm-com bot commented Jan 26, 2021

This pull request fixes 1 alert when merging c4fea16 into 50eff94 - view on LGTM.com

fixed alerts:

  • 1 for Unused local variable

@maarcingebala maarcingebala marked this pull request as ready for review January 27, 2021 08:49
@maarcingebala maarcingebala requested a review from a team January 27, 2021 08:49
saleor/graphql/utils/__init__.py Outdated Show resolved Hide resolved
saleor/graphql/utils/__init__.py Outdated Show resolved Hide resolved
saleor/graphql/utils/__init__.py Outdated Show resolved Hide resolved
@lgtm-com
Copy link

lgtm-com bot commented Jan 27, 2021

This pull request fixes 1 alert when merging bb4efe1 into 50eff94 - view on LGTM.com

fixed alerts:

  • 1 for Unused local variable

@maarcingebala
Copy link
Member Author

PR is currently blocked by storefront/SDK which currently uses the billingAddress field that this PR removes from API.

@lgtm-com
Copy link

lgtm-com bot commented Jan 28, 2021

This pull request fixes 1 alert when merging 18cbcae into fbfc66e - view on LGTM.com

fixed alerts:

  • 1 for Unused local variable

@lgtm-com
Copy link

lgtm-com bot commented Feb 1, 2021

This pull request fixes 1 alert when merging a1ce14a into 05efc53 - view on LGTM.com

fixed alerts:

  • 1 for Unused local variable

@lgtm-com
Copy link

lgtm-com bot commented Feb 1, 2021

This pull request fixes 1 alert when merging 2036251 into 97071ce - view on LGTM.com

fixed alerts:

  • 1 for Unused local variable

@maarcingebala maarcingebala added the approved-breaking-change PRs with this label have approved breaking changes in the GraphQL schema label Feb 2, 2021
@lgtm-com
Copy link

lgtm-com bot commented Feb 2, 2021

This pull request fixes 1 alert when merging d69c5c7 into 9b668be - view on LGTM.com

fixed alerts:

  • 1 for Unused local variable

@maarcingebala maarcingebala added approved-breaking-change PRs with this label have approved breaking changes in the GraphQL schema and removed approved-breaking-change PRs with this label have approved breaking changes in the GraphQL schema labels Feb 10, 2021
@lgtm-com
Copy link

lgtm-com bot commented Feb 10, 2021

This pull request fixes 1 alert when merging dc77bec into 8a33bfb - view on LGTM.com

fixed alerts:

  • 1 for Unused local variable

@maarcingebala maarcingebala merged commit dceb1da into master Feb 10, 2021
@maarcingebala maarcingebala deleted the 4315-drop-context-country branch February 10, 2021 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved-breaking-change PRs with this label have approved breaking changes in the GraphQL schema
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow passing country and currency to Product.pricing and ProductVariant.pricing
5 participants