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

Remove all static payment settings #4756

Merged
merged 8 commits into from
Sep 26, 2019
Merged

Conversation

salwator
Copy link
Contributor

@salwator salwator commented Sep 24, 2019

This PR purpose is to remove all remaining static configuration for the payment process and rely entirely on payment plugins configuration. This forces us to abandon payment gateway enum from graphql schema and fetch template_path information from plugin configuration.

Fixes #4748

Roadmap:

  • Move template_path to the plugin configuration
    • Dummy
    • Braintree
    • Razorpay
  • Use plugin template_path in payment django view
  • Remove template_path from settings.py
  • Remove PaymentGatewayEnum, change to String
  • Remove PAYMENT_GATEWAYS from settings
  • Remove Gateway enum from payment interface

Pull Request Checklist

  1. Privileged views and APIs are guarded by proper permission checks.
  2. All visible strings are translated with proper context.
  3. All data-formatting is locale-aware (dates, numbers, and so on).
  4. Database queries are optimized and the number of queries is constant.
  5. Database migration files are up to date.
  6. The changes are tested.
  7. GraphQL schema and type definitions are up to date.
  8. Changes are mentioned in the changelog.

@salwator salwator self-assigned this Sep 24, 2019
@salwator salwator added graphql Issues related to the GraphQL API in progress payments Issues related to payments implementation plugins technical debt labels Sep 24, 2019
Copy link

django-queries commented Sep 24, 2019

Here is the report for 078f3d1 (mirumee/saleor @ remove-all-static-payment-settings)
Base comparison is 7478b7c.

No differences were found. (click me)

# api.benchmark checkout
  test name                                  	left count 	right count	duplicate count
  -------------------------------------------	-----------	-----------	---------------
  add billing address to checkout            	         38	         38	             20
  add shipping to checkout                   	          7	          7	              0
  checkout payment charge                    	         14	         14	              0
  complete checkout                          	          6	          6	              0
  create checkout                            	         52	         52	             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                	         13	         13	              2

# api.benchmark variant
  test name                                  	left count 	right count	duplicate count
  -------------------------------------------	-----------	-----------	---------------
  retrieve variant list                      	         18	         18	              8

# api product sorting attributes
  test name                                  	left count 	right count	duplicate count
  -------------------------------------------	-----------	-----------	---------------
  sort product not having attribute data     	         21	         21	              0

@codecov
Copy link

codecov bot commented Sep 24, 2019

Codecov Report

Merging #4756 into master will decrease coverage by 0.04%.
The diff coverage is 56.52%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4756      +/-   ##
==========================================
- Coverage   91.15%   91.11%   -0.05%     
==========================================
  Files         343      343              
  Lines       20371    20366       -5     
  Branches     1930     1930              
==========================================
- Hits        18569    18556      -13     
- Misses       1264     1272       +8     
  Partials      538      538
Impacted Files Coverage Δ
saleor/graphql/account/resolvers.py 100% <ø> (ø) ⬆️
saleor/graphql/checkout/types.py 94.11% <ø> (-0.07%) ⬇️
saleor/graphql/payment/mutations.py 96.39% <ø> (-0.04%) ⬇️
saleor/graphql/payment/schema.py 95.45% <ø> (-0.2%) ⬇️
saleor/payment/gateways/stripe/plugin.py 0% <0%> (ø) ⬆️
saleor/payment/gateways/razorpay/plugin.py 0% <0%> (ø) ⬆️
saleor/payment/gateways/braintree/plugin.py 0% <0%> (ø) ⬆️
saleor/graphql/payment/enums.py 89.47% <100%> (-0.53%) ⬇️
saleor/payment/gateways/dummy/plugin.py 91.93% <100%> (+0.41%) ⬆️
saleor/payment/gateway.py 95.52% <100%> (+0.96%) ⬆️
... and 4 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 7478b7c...078f3d1. Read the comment docs.

@salwator salwator force-pushed the remove-all-static-payment-settings branch from 8e8f002 to cdb3570 Compare September 25, 2019 09:41
@salwator salwator marked this pull request as ready for review September 25, 2019 11:47
@salwator salwator force-pushed the remove-all-static-payment-settings branch from 028f43f to 49ed2e6 Compare September 25, 2019 11:50
Gateway enum was used to pass gateway type in payment interface,
right now it is pointless, due to gateways being dynamic plugins.

  - Remove Gateway enum

  - Rename payment gateway plugins so naming is consistent in plugins

  - Align tests
@salwator salwator force-pushed the remove-all-static-payment-settings branch from 49ed2e6 to 1b24413 Compare September 25, 2019 13:15
CHANGELOG.md Outdated Show resolved Hide resolved
@korycins
Copy link
Member

@salwator What about storefront PWA. Are they ready for this change?

@korycins korycins merged commit 73c1b26 into master Sep 26, 2019
@korycins korycins deleted the remove-all-static-payment-settings branch September 26, 2019 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
graphql Issues related to the GraphQL API payments Issues related to payments implementation plugins technical debt
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove PaymentGatewayEnum
3 participants