-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathpayone-woocommerce-3.php
62 lines (53 loc) · 1.75 KB
/
payone-woocommerce-3.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
<?php
use Automattic\WooCommerce\Utilities\FeaturesUtil;
use Automattic\WooCommerce\Blocks\Payments\PaymentMethodRegistry;
use Automattic\WooCommerce\Blocks\Package;
use Payone\Gateway\PayoneBlocksSupport;
/**
* Plugin Name: PAYONE Payment for WooCommerce
* Version: 2.8.0
* Plugin URI: https://www.payone.com/
* Description: Integration of PAYONE payment into your WooCommerce store.
* Author: PAYONE GmbH
* Author URI: https://www.payone.com/
* Requires at least: 5.0
* Tested up to: 9.6.0
*/
defined( 'ABSPATH' ) or die( 'Direct access not allowed' );
define( 'PAYONE_PLUGIN_VERSION', '2.8.0' );
define( 'PAYONE_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
define( 'PAYONE_PLUGIN_PATH', __DIR__ );
define( 'PAYONE_VIEW_PATH', PAYONE_PLUGIN_PATH . '/views' );
require_once 'src/autoload.php';
$payone_plugin = null;
add_action( 'before_woocommerce_init', function () {
if ( class_exists( FeaturesUtil::class ) ) {
FeaturesUtil::declare_compatibility( 'cart_checkout_blocks', __FILE__, true );
}
} );
add_action( 'woocommerce_loaded', function () {
global $payone_plugin;
$payone_plugin = new \Payone\Plugin();
$payone_plugin->init();
} );
add_action( 'woocommerce_blocks_loaded', function () {
if ( class_exists( 'Automattic\WooCommerce\Blocks\Payments\Integrations\AbstractPaymentMethodType' ) ) {
add_action(
'woocommerce_blocks_payment_method_type_registration',
function ( PaymentMethodRegistry $payment_method_registry ) {
$container = Package::container();
// registers as shared instance.
$container->register(
PayoneBlocksSupport::class,
function () {
return new PayoneBlocksSupport();
}
);
$payment_method_registry->register(
$container->get( PayoneBlocksSupport::class )
);
},
5
);
}
} );