Merge pull request #32800 from woocommerce/dev/32719-remove-wc-admin-set-up-additional-payment-types-note

Remove `wc-admin-set-up-additional-payment-types` inbox note
This commit is contained in:
Ilyas Foo 2022-04-28 16:05:04 +08:00 committed by GitHub
commit 60e341ad17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 5 additions and 139 deletions

View File

@ -0,0 +1,4 @@
Significance: minor
Type: update
Remove wc-admin-set-up-additional-payment-types inbox note

View File

@ -764,6 +764,7 @@ class WC_Install {
'wc-admin-getting-started-ecommerce-webinar',
'wc-admin-navigation-feedback',
'wc-admin-navigation-feedback-follow-up',
'wc-admin-set-up-additional-payment-types',
);
$additional_obsolete_notes_names = apply_filters(

View File

@ -517,27 +517,6 @@ class WC_Admin_Notes_Selling_Online_Courses extends DeprecatedClassFacade {
protected static $deprecated_in_version = '1.7.0';
}
/**
* WC_Admin_Notes_Set_Up_Additional_Payment_Types.
*
* @deprecated since 1.7.0, use SetUpAdditionalPaymentTypes
*/
class WC_Admin_Notes_Set_Up_Additional_Payment_Types extends DeprecatedClassFacade {
/**
* The name of the non-deprecated class that this facade covers.
*
* @var string
*/
protected static $facade_over_classname = 'Automattic\WooCommerce\Internal\Admin\Notes\SetUpAdditionalPaymentTypes';
/**
* The version that this class was deprecated in.
*
* @var string
*/
protected static $deprecated_in_version = '1.7.0';
}
/**
* WC_Admin_Notes_Test_Checkout.
*

View File

@ -42,7 +42,6 @@ use \Automattic\WooCommerce\Internal\Admin\Notes\NavigationNudge;
use \Automattic\WooCommerce\Internal\Admin\Schedulers\MailchimpScheduler;
use \Automattic\WooCommerce\Internal\Admin\Notes\CompleteStoreDetails;
use \Automattic\WooCommerce\Internal\Admin\Notes\UpdateStoreDetails;
use \Automattic\WooCommerce\Internal\Admin\Notes\SetUpAdditionalPaymentTypes;
use \Automattic\WooCommerce\Internal\Admin\Notes\PaymentsRemindMeLater;
use \Automattic\WooCommerce\Internal\Admin\Notes\MagentoMigration;
@ -149,7 +148,6 @@ class Events {
*/
protected function possibly_delete_notes() {
NavigationNudge::delete_if_not_applicable();
SetUpAdditionalPaymentTypes::delete_if_not_applicable();
PaymentsRemindMeLater::delete_if_not_applicable();
}

View File

@ -14,7 +14,6 @@ use \Automattic\WooCommerce\Internal\Admin\Notes\WooSubscriptionsNotes;
use \Automattic\WooCommerce\Internal\Admin\Notes\TrackingOptIn;
use \Automattic\WooCommerce\Internal\Admin\Notes\WooCommercePayments;
use \Automattic\WooCommerce\Internal\Admin\Notes\InstallJPAndWCSPlugins;
use \Automattic\WooCommerce\Internal\Admin\Notes\SetUpAdditionalPaymentTypes;
use \Automattic\WooCommerce\Internal\Admin\Notes\TestCheckout;
use \Automattic\WooCommerce\Internal\Admin\Notes\SellingOnlineCourses;
use \Automattic\WooCommerce\Internal\Admin\Notes\MerchantEmailNotifications;
@ -153,7 +152,6 @@ class FeaturePlugin {
new TrackingOptIn();
new WooCommercePayments();
new InstallJPAndWCSPlugins();
new SetUpAdditionalPaymentTypes();
new TestCheckout();
new SellingOnlineCourses();
new WelcomeToWooCommerceForStoreUsers();

View File

@ -1,114 +0,0 @@
<?php
/**
* Add a note to the merchant's inbox prompting them to set up additional
* payment types if they have WooCommerce Payments activated.
*
* @package WooCommerce\Admin
*/
namespace Automattic\WooCommerce\Internal\Admin\Notes;
defined( 'ABSPATH' ) || exit;
use Automattic\WooCommerce\Admin\Features\OnboardingTasks\Tasks\WooCommercePayments;
use Automattic\WooCommerce\Admin\Notes\Note;
use Automattic\WooCommerce\Admin\Notes\NoteTraits;
/**
* Set_Up_Additional_Payment_Types
*/
class SetUpAdditionalPaymentTypes {
/**
* Note traits.
*/
use NoteTraits;
/**
* Name of the note for use in the database.
*/
const NOTE_NAME = 'wc-admin-set-up-additional-payment-types';
/**
* Constructor.
*/
public function __construct() {
add_action(
'activate_woocommerce-payments/woocommerce-payments.php',
array(
$this,
'on_activate_wcpay',
)
);
add_action(
'deactivate_woocommerce-payments/woocommerce-payments.php',
array(
$this,
'on_deactivate_wcpay',
)
);
}
/**
* Executes when the WooCommerce Payments plugin is activated. It does nothing
* if WooCommerce Payments plugin is not included in onboarding business extensions,
* otherwise it possibly adds the note if it isn't already in the database and if
* it matches any criteria (see get_note()).
*/
public static function on_activate_wcpay() {
$onboarding_profile = get_option( 'woocommerce_onboarding_profile', array() );
if ( is_array( $onboarding_profile ) && array_key_exists( 'business_extensions', $onboarding_profile ) ) {
if ( ! is_array( $onboarding_profile['business_extensions'] ) ||
! in_array( 'woocommerce-payments', $onboarding_profile['business_extensions'], true )
) {
return;
}
}
self::possibly_add_note();
}
/**
* Executes when the WooCommerce Payments plugin is deactivated. Possibly
* hard-deletes the note if it is in the database. Hard-delete is used
* instead of soft-delete or actioning the note because we need to
* show the note if the plugin is activated again.
*/
public static function on_deactivate_wcpay() {
self::possibly_delete_note();
}
/**
* Check if this note should exist.
*/
public static function is_applicable() {
$woocommerce_payments = new WooCommercePayments();
return ! $woocommerce_payments->can_view();
}
/**
* Get the note.
*
* @return Note
*/
public static function get_note() {
$content = __( 'Set up additional payment providers, using third-party services or other methods.', 'woocommerce' );
$note = new Note();
$note->set_title( __( 'Set up additional payment providers', 'woocommerce' ) );
$note->set_content( $content );
$note->set_content_data( (object) array() );
$note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
$note->set_name( self::NOTE_NAME );
$note->set_source( 'woocommerce-admin' );
$note->add_action(
'set-up-payments',
__( 'Set up payments', 'woocommerce' ),
wc_admin_url( '&task=payments' ),
Note::E_WC_ADMIN_NOTE_UNACTIONED,
true
);
return $note;
}
}