<?php
/**
 * Plugin Name: Pay4All for myPOS
 * Description: Adds myPOS Virtual as a payment gateway for WooCommerce and Pay4All Shop. Paste your myPOS Configuration Pack (or use the shared demo pack for testing), pick the payment methods and go. Free, no license, no subscription. myPOS is a trademark of myPOS World Ltd; this plugin is an independent integration and is not affiliated with myPOS.
 * Version:     1.1.1
 * Author:      Pay4All
 * Author URI:  https://pay4all.net/
 * Text Domain: pay4all-for-mypos
 * Domain Path: /languages
 * Requires at least: 5.9
 * Requires PHP: 7.4
 * Tested up to: 7.1
 * License: GPL-2.0-or-later
 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
 */

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

// Duplicate-install guard : if the merchant has both `pay4all-for-mypos/`
// AND an older clone side-by-side in wp-content/plugins/, the second
// activation would try to redeclare Pay4AllForMypos\Bootstrap and fatal
// the whole site. Bail out silently on the second boot ; the merchant
// sees the first plugin working and can clean up the extra folder from
// Plugins → Deactivate/Delete.
if ( class_exists( 'Pay4AllForMypos\\Bootstrap', false ) ) {
    return;
}

use Pay4AllForMypos\Bootstrap;

// WooCommerce compatibility flags — declared before WC boots so the
// merchant doesn't see the "incompatible" badge on the WooCommerce
// features screen.
add_action( 'before_woocommerce_init', static function () {
    if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) {
        \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility(
            'custom_order_tables',
            __FILE__,
            true
        );
        \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility(
            'cart_checkout_blocks',
            __FILE__,
            true
        );
    }
} );

require_once __DIR__ . '/src/Bootstrap.php';

new Bootstrap();
