-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmondu-buy-now-pay-later.php
71 lines (63 loc) · 2.29 KB
/
mondu-buy-now-pay-later.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
63
64
65
66
67
68
69
70
71
<?php
/**
* Plugin Name: Mondu Buy Now Pay Later
* Plugin URI: https://github.com/mondu-ai/bnpl-checkout-woocommerce/releases
* Description: Mondu provides B2B E-commerce and B2B marketplaces with an online payment solution to buy now and pay later.
* Version: 3.0.3
* Author: Mondu
* Author URI: https://mondu.ai
*
* Text Domain: mondu
* Domain Path: /languages/
*
* Requires at least: 5.9.0
* Requires PHP: 7.4
* WC requires at least: 6.5
* WC tested up to: 8.7
*
* License: GPLv3
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
*
* Copyright 2024 Mondu
*/
use Automattic\WooCommerce\Utilities\FeaturesUtil;
if ( !defined( 'ABSPATH' ) ) {
die( 'Direct access not allowed' );
}
define( 'MONDU_PLUGIN_VERSION', '3.0.3' );
define( 'MONDU_PLUGIN_FILE', __FILE__ );
define( 'MONDU_PLUGIN_PATH', __DIR__ );
define( 'MONDU_PLUGIN_BASENAME', plugin_basename(MONDU_PLUGIN_FILE) );
define( 'MONDU_PUBLIC_PATH', plugin_dir_url(MONDU_PLUGIN_FILE) );
define( 'MONDU_VIEW_PATH', MONDU_PLUGIN_PATH . '/views' );
function mondu_env( $name, $default_value ) {
if ( getenv( $name ) !== false ) {
define( $name, getenv($name) );
} else {
define( $name, $default_value );
}
}
mondu_env( 'MONDU_SANDBOX_URL', 'https://api.demo.mondu.ai/api/v1' );
mondu_env( 'MONDU_PRODUCTION_URL', 'https://api.mondu.ai/api/v1' );
mondu_env( 'MONDU_WEBHOOKS_URL', get_home_url() );
require_once 'src/autoload.php';
add_action( 'plugins_loaded', [ new \Mondu\Plugin(), 'init' ] );
function mondu_activate() {
}
register_activation_hook( MONDU_PLUGIN_FILE, 'mondu_activate' );
function mondu_deactivate() {
delete_option( '_mondu_credentials_validated' );
delete_option( '_mondu_webhooks_registered' );
delete_option( 'woocommerce_mondu_invoice_settings' );
delete_option( 'woocommerce_mondu_direct_debit_settings' );
delete_option( 'woocommerce_mondu_installment_settings' );
delete_option( 'woocommerce_mondu_installment_by_invoice_settings' );
}
register_deactivation_hook( MONDU_PLUGIN_FILE, 'mondu_deactivate' );
// Here because this needs to happen before plugins_loaded hook
add_action('before_woocommerce_init', function () {
if ( class_exists( FeaturesUtil::class ) ) {
FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__ );
FeaturesUtil::declare_compatibility( 'cart_checkout_blocks', __FILE__ );
}
});