Gateway_Card::class, 'syntopia_wallet' => Gateway_Wallet::class, 'syntopia_easypay' => Gateway_Easypay::class, ]; /** * @return list */ public static function gateway_ids(): array { return array_keys( self::GATEWAYS ); } public static function register(): void { add_action( 'woocommerce_loaded', [ self::class, 'load_woocommerce_classes' ] ); add_action( 'init', [ self::class, 'maybe_upgrade' ] ); add_action( 'woocommerce_blocks_payment_method_type_registration', [ self::class, 'register_block_payment_methods' ] ); if ( is_admin() ) { Guide_Page::register(); Order_List_Column::register(); } } public static function register_block_payment_methods( \Automattic\WooCommerce\Blocks\Payments\PaymentMethodRegistry $registry ): void { require_once SYNTOPIA_PAY_DIR . '/includes/blocks/class-payment-method.php'; foreach ( self::gateway_ids() as $id ) { $registry->register( new Blocks\Payment_Method( $id ) ); } } public static function activate(): void { Sweep::schedule(); self::maybe_upgrade(); } public static function deactivate(): void { wp_clear_scheduled_hook( Sweep::HOOK ); } public static function maybe_upgrade(): void { if ( SYNTOPIA_PAY_VERSION === get_option( 'syntopia_pay_version' ) ) { return; } delete_option( 'syntopia_pay_probe' ); update_option( 'syntopia_pay_version', SYNTOPIA_PAY_VERSION ); } public static function load_woocommerce_classes(): void { require_once SYNTOPIA_PAY_DIR . '/includes/class-gateway-base.php'; require_once SYNTOPIA_PAY_DIR . '/includes/class-gateway-card.php'; require_once SYNTOPIA_PAY_DIR . '/includes/class-gateway-wallet.php'; require_once SYNTOPIA_PAY_DIR . '/includes/class-gateway-easypay.php'; foreach ( self::GATEWAYS as $id => $class ) { if ( defined( $class . '::PAGE' ) ) { Receipt_Page::register( $id ); } } Easypay_Display::register(); Return_Flow::register(); add_filter( 'woocommerce_payment_gateways', static fn( array $gateways ): array => array_merge( $gateways, array_values( self::GATEWAYS ) ) ); } }