-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmondu-buy-now-pay-later.php
More file actions
73 lines (65 loc) · 2.29 KB
/
Copy pathmondu-buy-now-pay-later.php
File metadata and controls
73 lines (65 loc) · 2.29 KB
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
72
73
<?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.1.0
* 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 2025 Mondu
*/
use Automattic\WooCommerce\Utilities\FeaturesUtil;
if ( !defined( 'ABSPATH' ) ) {
die( 'Direct access not allowed' );
}
define( 'MONDU_PLUGIN_VERSION', '3.1.0' );
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() {
if ( class_exists( '\Mondu\Plugin' ) ) {
\Mondu\Plugin::set_mondu_gateway_title_defaults();
}
}
register_activation_hook( MONDU_PLUGIN_FILE, 'mondu_activate' );
function mondu_deactivate() {
delete_option( '_mondu_credentials_validated' );
delete_option( '_mondu_webhooks_registered' );
foreach ( \Mondu\Config\PaymentMethodsConfig::get_gateway_ids() as $gateway_id ) {
delete_option( 'woocommerce_' . $gateway_id . '_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__ );
}
});