-
Notifications
You must be signed in to change notification settings - Fork 211
Reduce PMC API calls #4240
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
Reduce PMC API calls #4240
Conversation
📈 PHP Unit Code Coverage Report
|
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.
Thanks for working on this @Mayisha.
I left two comments, one is just renaming the transient to mention PMC instead of UPE... and the other is moving the transient to get_primary_configuration
to also cover the migration flow.
if ( ! $force_refresh && ! empty( get_transient( self::UPE_ENABLED_PAYMENT_METHOD_IDS_TRANSIENT_KEY ) ) ) { | ||
return get_transient( self::UPE_ENABLED_PAYMENT_METHOD_IDS_TRANSIENT_KEY ); | ||
} | ||
|
||
$enabled_payment_method_ids = []; | ||
$merchant_payment_method_configuration = self::get_primary_configuration(); |
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 we should move the transient check inside this self::get_primary_configuration()
which is the one making the actual API call... as it's also called from self::maybe_migrate_payment_methods_from_db_to_pmc()
* | ||
* @var string | ||
*/ | ||
const UPE_ENABLED_PAYMENT_METHOD_IDS_TRANSIENT_KEY = 'wc_stripe_upe_enabled_payment_method_ids'; |
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 we can rename this tol PMC_CONFIGURATION_TRANSIENT_KEY
to indicate it's the PMC configuration better differentiate it from the upe_checkout_experience_accepted_payments
option
Closing in favor of #4241 |
Changes proposed in this Pull Request:
force_fetch: true
only on the plugin settings page. Whenever the settings page is refreshed, PMC will be retrieved.Testing instructions