# easy-invoice/2.4.1/includes/Services/ProCompatibilityNotice.php

Easy Invoice – Invoice Generator, PDF Quotes &amp; Payments, version 2.4.1. 98 lines.

- Page: https://pluginprobe.com/plugins/easy-invoice/2.4.1/code/includes/Services/ProCompatibilityNotice.php
- Raw: https://pluginprobe.com/plugins/easy-invoice/2.4.1/raw/includes/Services/ProCompatibilityNotice.php
- Modified: 2026-09-15T12:31:20+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/easy-invoice/2.4.1/code/includes/Services/ProCompatibilityNotice.php#L10-L20`.

```php
<?php
/**
 * Admin notice for an Easy Invoice Pro build older than this plugin expects.
 *
 * @package Easy_Invoice
 * @subpackage Services
 */

namespace EasyInvoice\Services;

if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

/**
 * Warns the site owner while client payments are being accepted through the
 * older, weaker authorisation path.
 *
 * Why this exists
 * ---------------
 * From 2.4.0 the payment endpoint authorises on a per-invoice access token. Easy
 * Invoice Pro only began forwarding that token in 2.3.0. Because the free plugin
 * updates from WordPress.org and Pro arrives from the licence server, a site can
 * legitimately run a newer free against an older Pro.
 *
 * PaymentController::legacyProPaymentFallbackAllowed() keeps those payments working
 * rather than taking a customer's money without recording it. That fallback is
 * deliberately no weaker than the behaviour already shipped in 2.3.8, but it is still
 * weaker than the current one, so the owner should know it is in use and that updating
 * Pro closes it.
 *
 * The notice is entirely self-clearing: it appears only while an old Pro is actually
 * installed AND the fallback has actually been exercised by a real payment, and it
 * stops appearing the moment Pro is updated. There is deliberately no dismiss button —
 * dismissing would hide a live security-relevant state that the owner can fix in one
 * click, and the condition ends on its own.
 */
class ProCompatibilityNotice {

    /** Option recording the Pro version last seen using the fallback. */
    const OPTION = 'easy_invoice_legacy_pro_payment_seen';

    /**
     * Wire up the notice.
     *
     * @return void
     */
    public static function init() {
        add_action( 'admin_notices', [ __CLASS__, 'render' ] );
    }

    /**
     * Output the notice when an outdated Pro is both present and in use.
     *
     * @return void
     */
    public static function render() {
        if ( ! current_user_can( 'manage_options' ) ) {
            return;
        }

        $seen = (string) get_option( self::OPTION, '' );
        if ( $seen === '' ) {
            return;
        }

        // Pro updated (or was removed) since the fallback last ran — condition over.
        if ( ! function_exists( 'easy_invoice_has_pro' ) || ! easy_invoice_has_pro() ) {
            delete_option( self::OPTION );
            return;
        }

        $current = defined( 'EASY_INVOICE_PRO_VERSION' ) ? (string) EASY_INVOICE_PRO_VERSION : '0';
        if ( version_compare( $current, \EasyInvoice\Controllers\PaymentController::PRO_TOKEN_FORWARDING_VERSION, '>=' ) ) {
            delete_option( self::OPTION );
            return;
        }

        ?>
        <div class="notice notice-warning">
            <p>
                <strong><?php esc_html_e( 'Easy Invoice: please update Easy Invoice Pro.', 'easy-invoice' ); ?></strong>
            </p>
            <p>
                <?php
                printf(
                    /* translators: 1: installed Pro version, 2: required Pro version. */
                    esc_html__( 'Easy Invoice Pro %1$s is older than this version of Easy Invoice. Its payment scripts cannot send the per-invoice access key that this plugin now checks, so client card payments are being accepted using the older authorisation instead. Updating Easy Invoice Pro to %2$s or later restores the stronger check. Payments are working in the meantime — nothing is being lost.', 'easy-invoice' ),
                    esc_html( $current ),
                    esc_html( \EasyInvoice\Controllers\PaymentController::PRO_TOKEN_FORWARDING_VERSION )
                );
                ?>
            </p>
        </div>
        <?php
    }
}

```
