-
Notifications
You must be signed in to change notification settings - Fork 69
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
Decouple miscellaneous dependencies from multi-currency module #9302
Conversation
Test the buildOption 1. Jetpack Beta
Option 2. Jurassic Ninja - available for logged-in A12s🚀 Launch a JN site with this branch 🚀 ℹ️ Install this Tampermonkey script to get more options. Build info:
Note: the build is updated when a new commit is pushed to this PR. |
Size Change: 0 B Total Size: 1.33 MB ℹ️ View Unchanged
|
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.
Leaving the code review so it doesn't block the progress of the PR, I'll go over the testing instructions tomorrow.
For now I've left a few suggestions, but code looks good overall, nice work!
…feature flag check in gateway context
…store_api_request()"
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.
Code looks good and test well! Thanks for working out the improvements 🚀
- Multi-currency: Merchant ✅
- Multi-currency: Shopper ✅
- Test instructions in feat: add Store API multi-currency support #8816 ✅
Changes proposed in this Pull Request
API_Exception
: The instances where we were handling this error didn't require any specific logic, so a regularException
can be used. The only difference is that it will catch any exception, but that's ok.Base_Exception
: The main difference between WCPay exceptions and the defaultException
is that it specifies a string error code. That error code was not a requirement so I opted for using the500
server error code.Logger
: The WCPay logger has a few caveats in that it won't log unless in sandbox mode or WCPay logging setting is enabled, and as discussed in MCCY round table, we opted for making a separate logger class and log file for multi-currency as this also sets up the module for further separation from the gateway.WC_Payments_Features
: Replaced or put into the gateway context when initializing multi-currency.WC_Payments::register_script_with_dependencies
: This required reimplementation. We're also passing the gateway context to the multi-currency constructor to determine where the assets should be loaded from and the cache version.WC_Payments_Explicit_Price_Formatter
: Reimplemented the logic from the one function that was used.Database_Cache
: Now implements aMultiCurrencyCacheInterface
.Country_Code
andCurrency_Code
: The constants used from these classes were replaced by its values. Basically a revert from Add ENUM class for country codes #7925. I considered duplicating the classes into the multi-currency module and also passing them as a reference, but none of these approaches seemed right to me considering v2.WC_Payments_Utils::get_supported_countries
: IMO this should belong to the account service since these are the countries supported by Stripe.WC_Payments_Utils::zero_decimal_currencies()
: Replaced by the module'sBackendCurrency
'sis_zero_decimal_currency
.WC_Payments_Utils::is_store_api_request()
: This also made more sense to be duplicated into the module'sUtils
.tests/unit/multi-currency
.Testing instructions
This PR impacts a lot of files, but since we're merging into a feature branch and will do thorough testing before merging into
develop
, we should prioritize code review and focus on testing the critical flows for now.I’ve also tested the decoupled components, like logs, ordermeta helper, and subscriptions, but once other pieces are also merged into
multi-currency-v2
, we can perform more extensive testing across all scenarios.These critical flows should pass:
Code review
multi-currency/
files and ensure you don't see any dependencies from v1 gateway code besides:wc-payments-multi-currency.php
: This file should be moved out of the module and refactored later.PaymentMethodsCompatibility.php
: There's a separate issue for this – Add Tracks tracking #74.npm run changelog
to add a changelog file, choosepatch
to leave it empty if the change is not significant. You can add multiple changelog files in one PR by running this command a few times.Post merge