<?php
/**
 * Plugin Name: Northmill Checkout
 * Plugin URI: https://northmill.com/se/foretag/betallosningar/checkout/
 * Description: Payment gateways for WooCommerce. Credit card payment via Northmill. Support for invoice, Swish and partial payment via Resurs Bank.
 * Author: Northmill
 * Author URI: https://northmill.com/se/foretag/
 * Version: 2.1.12
 * WC tested up to:  9.0.2
 * License: GNU General Public License v3.0
 * License URI: http://www.gnu.org/licenses/gpl-3.0.html
 * Requires PHP: 8.2
 *
 * @package flo-checkout
 */

use Automattic\WooCommerce\Utilities\FeaturesUtil;
use Flo_Checkout\Gateways\BNPL\BNPL_Cron;
use Flo_Checkout\Shared;

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}
define( 'FLO_CHECKOUT_ABS_FILE_PATH', __FILE__ );

require_once plugin_dir_path( __FILE__ ) . '/vendor/autoload.php';

define( 'WC_FAILED_STATUS', 'wc-failed' );
define( 'WC_COMPLETED_STATUS', 'wc-completed' );
define( 'WC_PENDING_STATUS', 'wc-pending' );
define( 'WC_CANCELLED_STATUS', 'wc-cancelled' );

// Set up the plugin.
Shared::instance();

// Plugin deactivation.
register_deactivation_hook(
	__FILE__,
	function () {
		BNPL_Cron::clear_cron();
	}
);

add_action(
	'before_woocommerce_init',
	function () {
		if ( class_exists( FeaturesUtil::class ) ) {
			FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, false );
		}
	}
);

add_action(
	'before_woocommerce_init',
	function () {
		if ( class_exists( '\Automattic\WooCommerce\Utilities\FeaturesUtil' ) ) {
			FeaturesUtil::declare_compatibility( 'cart_checkout_blocks', __FILE__ );
		}
	}
);
