mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
💡 Document use of “settings->set()” via comments
This commit is contained in:
parent
a13b8c03ff
commit
9f44657400
10 changed files with 25 additions and 1 deletions
|
@ -62,6 +62,7 @@ class SettingsCommand {
|
|||
$value = false;
|
||||
}
|
||||
|
||||
// TODO new-ux: The setting must also be updated in the new settings.
|
||||
$this->settings->set( $key, $value );
|
||||
$this->settings->persist();
|
||||
|
||||
|
|
|
@ -137,6 +137,10 @@ class PayUponInvoice {
|
|||
*/
|
||||
public function init(): void {
|
||||
if ( $this->pui_helper->is_pui_gateway_enabled() ) {
|
||||
/*
|
||||
* TODO new-ux: Check if we still support this setting, or if it's always enabled.
|
||||
* If fraudnet is not configurable in new UI, we can ignore this.
|
||||
*/
|
||||
$this->settings->set( 'fraudnet_enabled', true );
|
||||
$this->settings->persist();
|
||||
}
|
||||
|
|
|
@ -103,6 +103,7 @@ class DCCProductStatus extends ProductStatus {
|
|||
continue;
|
||||
}
|
||||
|
||||
// Settings used as a cache; `settings->set` is compatible with new UI.
|
||||
if ( in_array( 'CUSTOM_CARD_PROCESSING', $product->capabilities(), true ) ) {
|
||||
$this->settings->set( self::SETTINGS_KEY, self::SETTINGS_VALUE_ENABLED );
|
||||
$this->settings->persist();
|
||||
|
|
|
@ -96,6 +96,7 @@ class PayUponInvoiceProductStatus extends ProductStatus {
|
|||
continue;
|
||||
}
|
||||
|
||||
// Settings used as a cache; `settings->set` is compatible with new UI.
|
||||
if ( in_array( 'PAY_UPON_INVOICE', $product->capabilities(), true ) ) {
|
||||
$this->settings->set( self::SETTINGS_KEY, self::SETTINGS_VALUE_ENABLED );
|
||||
$this->settings->persist();
|
||||
|
|
|
@ -263,6 +263,8 @@ class SettingsListener {
|
|||
// phpcs:enable WordPress.Security.NonceVerification.Missing
|
||||
// phpcs:enable WordPress.Security.NonceVerification.Recommended
|
||||
|
||||
// This method is only used for legacy UI, `settings->set` is valid here.
|
||||
|
||||
$this->settings->set( 'merchant_id', $merchant_id );
|
||||
$this->settings->set( 'merchant_email', $merchant_email );
|
||||
|
||||
|
@ -365,6 +367,8 @@ class SettingsListener {
|
|||
return;
|
||||
}
|
||||
|
||||
// This method is only used for legacy UI, `settings->set` is valid here.
|
||||
|
||||
try {
|
||||
$token = $this->bearer->bearer();
|
||||
if ( ! $token->vaulting_available() ) {
|
||||
|
@ -474,6 +478,10 @@ class SettingsListener {
|
|||
&& 1 === absint( $_POST['woocommerce_ppcp-gateway_enabled'] );
|
||||
}
|
||||
|
||||
// This method initializes a feature cache. This initialization is not
|
||||
// required by the new UI; we can ignore the `settings->set` usage.
|
||||
// TODO new-ux: Test, if this method is called or some non-settings parts must be converted.
|
||||
|
||||
// phpcs:enable phpcs:disable WordPress.Security.NonceVerification.Missing
|
||||
// phpcs:enable phpcs:disable WordPress.Security.NonceVerification.Missing
|
||||
if ( $credentials_change_status ) {
|
||||
|
@ -722,6 +730,8 @@ class SettingsListener {
|
|||
/**
|
||||
* Prevent enabling tracking if it is not enabled for merchant account.
|
||||
*
|
||||
* This method is not used anywhere. Not relevant for new-ux.
|
||||
*
|
||||
* @throws RuntimeException When API request fails.
|
||||
*/
|
||||
public function listen_for_tracking_enabled(): void {
|
||||
|
@ -767,6 +777,8 @@ class SettingsListener {
|
|||
return;
|
||||
}
|
||||
|
||||
// This method is only used for legacy UI, `settings->set` is valid here.
|
||||
|
||||
$existing_setting_value = $this->settings->has( $setting_slug ) ? $this->settings->get( $setting_slug ) : null;
|
||||
|
||||
if ( $condition ) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue