PluginProbe
WooCommerce / 11.0.1
WooCommerce v11.0.1
11.1.0 11.1.0-rc.2 11.1.0-rc.1 11.1.0-beta.2 11.1.0-beta.1 11.0.1 11.0.0 11.0.0-rc.3 11.0.0-rc.2 11.0.0-rc.1 11.0.0-beta.2 11.0.0-beta.1 10.9.4 10.9.3 10.9.2 10.9.1 10.9.0 10.9.0-rc.1 10.9.0-beta.2 10.9.0-beta.1 10.8.1 10.8.0 10.8.0-rc.1 10.8.0-beta.2 10.8.0-beta.1 All 648 releases
woocommerce / src / Internal / Admin / Notes / PaymentsMoreInfoNeeded.php
PaymentsMoreInfoNeeded.php
81 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * WooCommerce Admin Payments More Info Needed Inbox Note Provider
4 */
5
6 namespace Automattic\WooCommerce\Internal\Admin\Notes;
7
8 use Automattic\WooCommerce\Admin\Notes\Note;
9 use Automattic\WooCommerce\Admin\Notes\NoteTraits;
10 use Automattic\WooCommerce\Internal\Admin\WcPayWelcomePage;
11
12 defined( 'ABSPATH' ) || exit;
13
14 /**
15 * PaymentsMoreInfoNeeded
16 */
17 class PaymentsMoreInfoNeeded {
18 /**
19 * Note traits.
20 */
21 use NoteTraits;
22
23 /**
24 * Name of the note for use in the database.
25 */
26 const NOTE_NAME = 'wc-admin-payments-more-info-needed';
27
28 /**
29 * Should this note exist?
30 */
31 public static function is_applicable() {
32 return self::should_display_note();
33 }
34
35 /**
36 * Returns true if we should display the note.
37 *
38 * @return bool
39 */
40 public static function should_display_note() {
41 // A WooPayments incentive must not be visible.
42 if ( WcPayWelcomePage::instance()->has_incentive() ) {
43 return false;
44 }
45
46 // More than 30 days since viewing the welcome page.
47 $exit_survey_timestamp = get_option( 'wcpay_welcome_page_exit_survey_more_info_needed_timestamp', false );
48 if ( ! $exit_survey_timestamp ||
49 ( time() - $exit_survey_timestamp < 30 * DAY_IN_SECONDS )
50 ) {
51 return false;
52 }
53
54 return true;
55 }
56
57 /**
58 * Get the note.
59 *
60 * @return Note
61 */
62 public static function get_note() {
63 if ( ! self::should_display_note() ) {
64 return;
65 }
66 /* translators: %s: Payment provider name. */
67 $content = sprintf( __( 'We recently asked you if you wanted more information about %s. Run your business and manage your payments in one place with the solution built and supported by WooCommerce.', 'woocommerce' ), 'WooPayments' );
68
69 $note = new Note();
70 /* translators: %s: Payment provider name. */
71 $note->set_title( sprintf( __( 'Payments made simple with %s', 'woocommerce' ), 'WooPayments' ) );
72 $note->set_content( $content );
73 $note->set_content_data( (object) array() );
74 $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
75 $note->set_name( self::NOTE_NAME );
76 $note->set_source( 'woocommerce-admin' );
77 $note->add_action( 'learn-more', __( 'Learn more here', 'woocommerce' ), 'https://woocommerce.com/payments/' );
78 return $note;
79 }
80 }
81