mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-31 04:58:28 +08:00
Refactor LocalAlternativePaymentMethodsModule
This commit is contained in:
parent
5c6c3a0005
commit
ac1e97e4e6
2 changed files with 21 additions and 14 deletions
|
@ -9,8 +9,6 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace WooCommerce\PayPalCommerce\LocalAlternativePaymentMethods;
|
namespace WooCommerce\PayPalCommerce\LocalAlternativePaymentMethods;
|
||||||
|
|
||||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface;
|
return static function (): LocalAlternativePaymentMethodsModule {
|
||||||
|
|
||||||
return static function (): ModuleInterface {
|
|
||||||
return new LocalAlternativePaymentMethodsModule();
|
return new LocalAlternativePaymentMethodsModule();
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,32 +9,39 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace WooCommerce\PayPalCommerce\LocalAlternativePaymentMethods;
|
namespace WooCommerce\PayPalCommerce\LocalAlternativePaymentMethods;
|
||||||
|
|
||||||
use Automattic\WooCommerce\Blocks\Payments\PaymentMethodRegistry;
|
|
||||||
use WC_Order;
|
use WC_Order;
|
||||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\ServiceProvider;
|
use Automattic\WooCommerce\Blocks\Payments\PaymentMethodRegistry;
|
||||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface;
|
use WooCommerce\PayPalCommerce\Vendor\Inpsyde\Modularity\Module\ExecutableModule;
|
||||||
use WooCommerce\PayPalCommerce\Vendor\Interop\Container\ServiceProviderInterface;
|
use WooCommerce\PayPalCommerce\Vendor\Inpsyde\Modularity\Module\ExtendingModule;
|
||||||
|
use WooCommerce\PayPalCommerce\Vendor\Inpsyde\Modularity\Module\ModuleClassNameIdTrait;
|
||||||
|
use WooCommerce\PayPalCommerce\Vendor\Inpsyde\Modularity\Module\ServiceModule;
|
||||||
use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
|
use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class LocalAlternativePaymentMethodsModule
|
* Class LocalAlternativePaymentMethodsModule
|
||||||
*/
|
*/
|
||||||
class LocalAlternativePaymentMethodsModule implements ModuleInterface {
|
class LocalAlternativePaymentMethodsModule implements ServiceModule, ExtendingModule, ExecutableModule {
|
||||||
|
use ModuleClassNameIdTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
public function setup(): ServiceProviderInterface {
|
public function services() : array {
|
||||||
return new ServiceProvider(
|
return require __DIR__ . '/../services.php';
|
||||||
require __DIR__ . '/../services.php',
|
|
||||||
require __DIR__ . '/../extensions.php'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
public function run( ContainerInterface $c ): void {
|
public function extensions() : array {
|
||||||
|
return require __DIR__ . '/../extensions.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function run( ContainerInterface $c ) : bool {
|
||||||
add_filter(
|
add_filter(
|
||||||
'woocommerce_payment_gateways',
|
'woocommerce_payment_gateways',
|
||||||
/**
|
/**
|
||||||
|
@ -150,6 +157,8 @@ class LocalAlternativePaymentMethodsModule implements ModuleInterface {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue