/var/www/html_us/wp-content/plugins/woocommerce/src/Internal/Admin/Notes/PaymentsRemindMeLater.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
/**
 * WooCommerce Admin Payment Reminder Me later
 */

namespace Automattic\WooCommerce\Internal\Admin\Notes;

use 
Automattic\WooCommerce\Admin\Notes\Note;
use 
Automattic\WooCommerce\Admin\Notes\NoteTraits;
use 
Automattic\WooCommerce\Internal\Admin\WcPayWelcomePage;

defined'ABSPATH' ) || exit;

/**
 * PaymentsRemindMeLater
 */
class PaymentsRemindMeLater {
    
/**
     * Note traits.
     */
    
use NoteTraits;

    
/**
     * Name of the note for use in the database.
     */
    
const NOTE_NAME 'wc-admin-payments-remind-me-later';

    
/**
     * Should this note exist?
     */
    
public static function is_applicable() {
        return 
self::should_display_note();
    }

    
/**
     * Returns true if we should display the note.
     *
     * @return bool
     */
    
public static function should_display_note() {
        
// A WooPayments incentive must be visible.
        
if ( ! WcPayWelcomePage::instance()->has_incentive() ) {
            return 
false;
        }

        
// Less than 3 days since viewing welcome page.
        
$view_timestamp get_option'wcpay_welcome_page_viewed_timestamp'false );
        if ( ! 
$view_timestamp ||
            ( 
time() - $view_timestamp DAY_IN_SECONDS )
        ) {
            return 
false;
        }
        return 
true;
    }


    
/**
     * Get the note.
     *
     * @return Note
     */
    
public static function get_note() {
        if ( ! 
self::should_display_note() ) {
            return;
        }
        
$content __'Save up to $800 in fees by managing transactions with WooPayments. With WooPayments, you can securely accept major cards, Apple Pay, and payments in over 100 currencies.''woocommerce' );

        
$note = new Note();
        
$note->set_title__'Save big with WooPayments''woocommerce' ) );
        
$note->set_content$content );
        
$note->set_content_data( (object) array() );
        
$note->set_typeNote::E_WC_ADMIN_NOTE_INFORMATIONAL );
        
$note->set_nameself::NOTE_NAME );
        
$note->set_source'woocommerce-admin' );
        
$note->add_action'learn-more'__'Learn more''woocommerce' ), admin_url'admin.php?page=wc-admin&path=/wc-pay-welcome-page' ) );
        return 
$note;
    }
}