-
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
Extract payment plugins #4669
Extract payment plugins #4669
Conversation
Here is the report for 24fa2cc (mirumee/saleor @ extract-payment-plugins) **Found 2 differences!** (click me)
# api.benchmark checkout
test name left count right count duplicate count
------------------------------------ ----------- ----------- ---------------
- add billing address to checkout 34 38 20
add shipping to checkout 7 7 0
checkout payment charge 14 14 0
complete checkout 6 6 0
- create checkout 48 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
# api.benchmark variant
test name left count right count duplicate count
------------------------------------ ----------- ----------- ---------------
retrieve variant list 18 18 8 |
6ddcb3a
to
f3687a4
Compare
Codecov Report
@@ Coverage Diff @@
## master #4669 +/- ##
==========================================
- Coverage 91.43% 90.99% -0.44%
==========================================
Files 307 311 +4
Lines 18419 18655 +236
Branches 1842 1853 +11
==========================================
+ Hits 16841 16976 +135
- Misses 1060 1157 +97
- Partials 518 522 +4
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #4669 +/- ##
==========================================
- Coverage 91.96% 91.18% -0.79%
==========================================
Files 324 330 +6
Lines 19491 19831 +340
Branches 1863 1874 +11
==========================================
+ Hits 17925 18082 +157
- Misses 1047 1230 +183
Partials 519 519
Continue to review full report at Codecov.
|
a2cb1bb
to
7f27bea
Compare
09ec56c
to
87f99e5
Compare
@salwator FYI |
334be21
to
dd40002
Compare
dd40002
to
6a187bd
Compare
Creates new plugin module in Braintree payment gateway that overrides all necessary methods and uses existing implementation. - Use BasePlugin - Create Braintree config structure - Call existing implementation from all plugin methods
* Remove get_payment_gateway * Align all saleor to work temporarily with new gateway implementation
f9fbd66
to
609b065
Compare
This PRs purpose is to use the recently introduced plugin system to saleor payment gateways. All payment implementations will be turned into saleor plugins and configured through API instead of the environment.
Current Payment uses lazy imports and checks for implementation when processing payment. This kind of dispatch and parametrization is no longer useful since we can use PluginManager interface and plugin mechanism for dispatching and establishing contract for payment flow process. This is why I introduce new simpler way of calling payment methods and pre/post transaction processing.
Business logic for payments will be encapsulated in payment.gateway module, which will execute actions on payment gateways using plugins. All payment related plugin hooks will be grouped into PaymentInterface so it easy to test against and divide PluginManager in the future.
We should make payment methods interface more verbose and probably since we're no longer forced to reuse same data structure as an argument for different actions, creating action-specific parameters and structure types makes more sense.
This PR provides both storefronts (old and new) with dynamic gateway list during checkout process, gateways can be enabled/disabled and entirely configured in saleor dashboard or directly through GraphQL plugin mutation.
NOTE: GraphQL schema is static, for now it is necessary to add new payment gateway plugin directly in settings and extend gateway list there to generate proper enum type in schema. Will be changed soon in next PR.
Roadmap:
Pull Request Checklist