diff --git a/plugins/woocommerce-admin/client/task-list/index.js b/plugins/woocommerce-admin/client/task-list/index.js index 7f17c76d4b9..030c766915c 100644 --- a/plugins/woocommerce-admin/client/task-list/index.js +++ b/plugins/woocommerce-admin/client/task-list/index.js @@ -228,8 +228,27 @@ class TaskDashboard extends Component { } getCurrentTask() { - const { task } = this.props.query; - const currentTask = this.getTasks().find( ( s ) => s.key === task ); + const { + query, + profileItems, + payments, + activePlugins, + installedPlugins, + createNotice, + isJetpackConnected, + } = this.props; + const allTasks = getAllTasks( { + profileItems, + options: payments, + query, + activePlugins, + installedPlugins, + createNotice, + isJetpackConnected, + } ); + const { task } = query; + + const currentTask = allTasks.find( ( s ) => s.key === task ); if ( ! currentTask ) { return null; @@ -488,6 +507,7 @@ export default compose( completedTaskKeys, activePlugins, installedPlugins, + payments, }; } ), withDispatch( ( dispatch ) => { diff --git a/plugins/woocommerce-admin/src/FeaturePlugin.php b/plugins/woocommerce-admin/src/FeaturePlugin.php index 6eb07657953..cf4f9e91133 100644 --- a/plugins/woocommerce-admin/src/FeaturePlugin.php +++ b/plugins/woocommerce-admin/src/FeaturePlugin.php @@ -20,6 +20,7 @@ use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Draw_Attention; use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Coupon_Page_Moved; use \Automattic\WooCommerce\Admin\RemoteInboxNotifications\RemoteInboxNotificationsEngine; use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Home_Screen_Feedback; +use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Set_Up_Additional_Payment_Types; /** * Feature plugin main class. @@ -192,6 +193,7 @@ class FeaturePlugin { new WC_Admin_Notes_Install_JP_And_WCS_Plugins(); new WC_Admin_Notes_Draw_Attention(); new WC_Admin_Notes_Home_Screen_Feedback(); + new WC_Admin_Notes_Set_Up_Additional_Payment_Types(); // Initialize RemoteInboxNotificationsEngine. RemoteInboxNotificationsEngine::init(); diff --git a/plugins/woocommerce-admin/src/Notes/NoteTraits.php b/plugins/woocommerce-admin/src/Notes/NoteTraits.php index a1158ac4812..0b70c2b7bc2 100644 --- a/plugins/woocommerce-admin/src/Notes/NoteTraits.php +++ b/plugins/woocommerce-admin/src/Notes/NoteTraits.php @@ -88,4 +88,20 @@ trait NoteTraits { public static function add_note() { self::possibly_add_note(); } + + /** + * Possibly delete the note, if it exists in the database. Note that this + * is a hard delete, for where it doesn't make sense to soft delete or + * action the note. + */ + public static function possibly_delete_note() { + $data_store = \WC_Data_Store::load( 'admin-note' ); + $note_ids = $data_store->get_notes_with_name( self::NOTE_NAME ); + + foreach ( $note_ids as $note_id ) { + $note = new WC_Admin_Note( $note_id ); + + $data_store->delete( $note ); + } + } } diff --git a/plugins/woocommerce-admin/src/Notes/WC_Admin_Notes_Set_Up_Additional_Payment_Types.php b/plugins/woocommerce-admin/src/Notes/WC_Admin_Notes_Set_Up_Additional_Payment_Types.php new file mode 100644 index 00000000000..4edad5b3ceb --- /dev/null +++ b/plugins/woocommerce-admin/src/Notes/WC_Admin_Notes_Set_Up_Additional_Payment_Types.php @@ -0,0 +1,90 @@ +set_title( __( 'Set up additional payment providers', 'woocommerce-admin' ) ); + $note->set_content( $content ); + $note->set_content_data( (object) array() ); + $note->set_type( WC_Admin_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-admin' ), + wc_admin_url( '&task=payments' ), + 'unactioned', + true + ); + + return $note; + } +}