woocommerce-paypal-payments/woocommerce-paypal-commerce-gateway.php

75 lines
2.3 KiB
PHP
Raw Normal View History

2020-03-19 16:47:08 +01:00
<?php # -*- coding: utf-8 -*-
declare( strict_types = 1 );
/**
2020-09-03 07:05:50 +03:00
* Plugin Name: PayPal for WooCommerce
2020-03-19 16:47:08 +01:00
* Plugin URI: TODO
2020-09-02 09:22:11 +03:00
* Description: PayPal's latest complete payments processing solution. Accept PayPal. PayPal Credit, credit/debit cards, alternative digital wallets local payment types and bank accounts. Turn on only PayPal options or process a full suite of payment methods. Enable global transaction with extensive currency and country coverage.
2020-03-19 16:47:08 +01:00
* Version: dev-master
* Author: Inpsyde GmbH
* Author URI: https://inpsyde.com/
* License: GPL-2.0
2020-09-03 07:19:24 +03:00
* Text Domain: paypal-for-woocommerce
2020-03-19 16:47:08 +01:00
*/
2020-06-15 11:48:37 +03:00
2020-03-19 16:47:08 +01:00
namespace Inpsyde\PayPalCommerce;
2020-04-02 08:38:00 +03:00
use Dhii\Container\CachingContainer;
use Dhii\Container\CompositeCachingServiceProvider;
use Dhii\Container\DelegatingContainer;
use Dhii\Container\ProxyContainer;
use Dhii\Modular\Module\ModuleInterface;
2020-04-06 10:51:56 +03:00
use Inpsyde\PayPalCommerce\ApiClient\Factory\PurchaseUnitFactory;
2020-04-02 08:38:00 +03:00
(function () {
2020-09-01 15:27:18 +03:00
include __DIR__ . '/vendor/autoload.php';
2020-04-02 08:38:00 +03:00
function init()
{
static $initialized;
if (!$initialized) {
2020-04-28 15:03:39 +03:00
$modules = [new PluginModule()];
2020-04-02 08:38:00 +03:00
foreach (glob(plugin_dir_path(__FILE__).'modules/*/module.php') as $moduleFile) {
$modules[] = (@require $moduleFile)();
}
$providers = [];
foreach ($modules as $module) {
/* @var $module ModuleInterface */
$providers[] = $module->setup();
}
$proxy = new ProxyContainer();
$provider = new CompositeCachingServiceProvider($providers);
$container = new CachingContainer(new DelegatingContainer($provider));
$proxy->setInnerContainer($container);
foreach ($modules as $module) {
/* @var $module ModuleInterface */
$module->run($container);
}
$initialized = true;
2020-04-06 10:51:56 +03:00
2020-04-02 08:38:00 +03:00
}
}
add_action(
'plugins_loaded',
function () {
init();
}
);
register_activation_hook(
__FILE__,
function () {
init();
do_action('woocommerce-paypal-commerce-gateway.activate');
}
);
register_deactivation_hook(
__FILE__,
function () {
init();
do_action('woocommerce-paypal-commerce-gateway.deactivate');
}
);
2020-04-06 10:51:56 +03:00
2020-04-02 08:38:00 +03:00
})();