mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-30 05:00:51 +08:00
Refactor remaining modules to Modularity.
Remove Dhii dependencies.
This commit is contained in:
parent
5837d65b18
commit
429232f60f
45 changed files with 341 additions and 481 deletions
|
@ -8,7 +8,6 @@
|
|||
use WooCommerce\PayPalCommerce\Vendor\Inpsyde\Modularity\Package;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Inpsyde\Modularity\Properties\PluginProperties;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
|
||||
use WooCommerce\PayPalCommerce\DhiiToModularityModule;
|
||||
|
||||
return function (
|
||||
string $root_dir,
|
||||
|
@ -34,21 +33,10 @@ return function (
|
|||
$properties = PluginProperties::new( __FILE__ );
|
||||
$bootstrap = Package::new( $properties );
|
||||
|
||||
foreach ($modules as $key => $module) {
|
||||
if (
|
||||
$module instanceof \WooCommerce\PayPalCommerce\AdminNotices\AdminNotices ||
|
||||
$module instanceof \WooCommerce\PayPalCommerce\ApiClient\ApiModule ||
|
||||
$module instanceof \WooCommerce\PayPalCommerce\Applepay\ApplepayModule ||
|
||||
$module instanceof \WooCommerce\PayPalCommerce\Blocks\BlocksModule ||
|
||||
$module instanceof \WooCommerce\PayPalCommerce\Button\ButtonModule
|
||||
) {
|
||||
$bootstrap->addModule( $module );
|
||||
unset($modules[$key]);
|
||||
}
|
||||
foreach ( $modules as $module ) {
|
||||
$bootstrap->addModule( $module );
|
||||
}
|
||||
|
||||
|
||||
$bootstrap->addModule( new DhiiToModularityModule( $modules ) );
|
||||
$bootstrap->boot();
|
||||
|
||||
return $bootstrap->container();
|
||||
|
|
|
@ -9,8 +9,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace WooCommerce\PayPalCommerce\CardFields;
|
||||
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface;
|
||||
|
||||
return static function (): ModuleInterface {
|
||||
return static function (): CardFieldsModule {
|
||||
return new CardFieldsModule();
|
||||
};
|
||||
|
|
|
@ -9,9 +9,10 @@ declare(strict_types=1);
|
|||
|
||||
namespace WooCommerce\PayPalCommerce\CardFields;
|
||||
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\ServiceProvider;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Interop\Container\ServiceProviderInterface;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Inpsyde\Modularity\Module\ExecutableModule;
|
||||
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\WcGateway\Gateway\CreditCardGateway;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
|
||||
|
@ -19,24 +20,29 @@ use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
|
|||
/**
|
||||
* Class CardFieldsModule
|
||||
*/
|
||||
class CardFieldsModule implements ModuleInterface {
|
||||
class CardFieldsModule implements ServiceModule, ExtendingModule, ExecutableModule {
|
||||
use ModuleClassNameIdTrait;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function setup(): ServiceProviderInterface {
|
||||
return new ServiceProvider(
|
||||
require __DIR__ . '/../services.php',
|
||||
require __DIR__ . '/../extensions.php'
|
||||
);
|
||||
public function services(): array {
|
||||
return require __DIR__ . '/../services.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function run( ContainerInterface $c ): void {
|
||||
public function extensions(): array {
|
||||
return require __DIR__ . '/../extensions.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function run( ContainerInterface $c ): bool {
|
||||
if ( ! $c->get( 'card-fields.eligible' ) ) {
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -117,5 +123,7 @@ class CardFieldsModule implements ModuleInterface {
|
|||
return $data;
|
||||
}
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,8 +9,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace WooCommerce\PayPalCommerce\Compat;
|
||||
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface;
|
||||
|
||||
return static function (): ModuleInterface {
|
||||
return static function (): CompatModule {
|
||||
return new CompatModule();
|
||||
};
|
||||
|
|
|
@ -9,9 +9,10 @@ declare(strict_types=1);
|
|||
|
||||
namespace WooCommerce\PayPalCommerce\Compat;
|
||||
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\ServiceProvider;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Interop\Container\ServiceProviderInterface;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Inpsyde\Modularity\Module\ExecutableModule;
|
||||
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\Compat\Assets\CompatAssets;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Exception\NotFoundException;
|
||||
|
@ -20,17 +21,21 @@ use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
|
|||
/**
|
||||
* Class CompatModule
|
||||
*/
|
||||
class CompatModule implements ModuleInterface {
|
||||
class CompatModule implements ServiceModule, ExtendingModule, ExecutableModule {
|
||||
use ModuleClassNameIdTrait;
|
||||
|
||||
/**
|
||||
* Setup the compatibility module.
|
||||
*
|
||||
* @return ServiceProviderInterface
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function setup(): ServiceProviderInterface {
|
||||
return new ServiceProvider(
|
||||
require __DIR__ . '/../services.php',
|
||||
require __DIR__ . '/../extensions.php'
|
||||
);
|
||||
public function services(): array {
|
||||
return require __DIR__ . '/../services.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function extensions(): array {
|
||||
return require __DIR__ . '/../extensions.php';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -38,7 +43,7 @@ class CompatModule implements ModuleInterface {
|
|||
*
|
||||
* @throws NotFoundException
|
||||
*/
|
||||
public function run( ContainerInterface $c ): void {
|
||||
public function run( ContainerInterface $c ): bool {
|
||||
|
||||
$this->initialize_ppec_compat_layer( $c );
|
||||
$this->fix_site_ground_optimizer_compatibility( $c );
|
||||
|
@ -54,14 +59,8 @@ class CompatModule implements ModuleInterface {
|
|||
$this->migrate_smart_button_settings( $c );
|
||||
|
||||
$this->fix_page_builders();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the key for the module.
|
||||
*
|
||||
* @return string|void
|
||||
*/
|
||||
public function getKey() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -18,7 +18,7 @@ use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
|
|||
|
||||
return array(
|
||||
|
||||
'wcgateway.settings.fields' => function ( ContainerInterface $container, array $fields ): array {
|
||||
'wcgateway.settings.fields' => function ( array $fields, ContainerInterface $container ): array {
|
||||
|
||||
// Eligibility check.
|
||||
if ( ! $container->has( 'googlepay.eligible' ) || ! $container->get( 'googlepay.eligible' ) ) {
|
||||
|
|
|
@ -9,8 +9,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace WooCommerce\PayPalCommerce\Googlepay;
|
||||
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface;
|
||||
|
||||
return static function (): ModuleInterface {
|
||||
return static function (): GooglepayModule {
|
||||
return new GooglepayModule();
|
||||
};
|
||||
|
|
|
@ -15,30 +15,37 @@ use WooCommerce\PayPalCommerce\Button\Assets\SmartButtonInterface;
|
|||
use WooCommerce\PayPalCommerce\Googlepay\Endpoint\UpdatePaymentDataEndpoint;
|
||||
use WooCommerce\PayPalCommerce\Googlepay\Helper\ApmProductStatus;
|
||||
use WooCommerce\PayPalCommerce\Googlepay\Helper\AvailabilityNotice;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\ServiceProvider;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Interop\Container\ServiceProviderInterface;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Inpsyde\Modularity\Module\ExecutableModule;
|
||||
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\WcGateway\Settings\Settings;
|
||||
|
||||
/**
|
||||
* Class GooglepayModule
|
||||
*/
|
||||
class GooglepayModule implements ModuleInterface {
|
||||
class GooglepayModule implements ServiceModule, ExtendingModule, ExecutableModule {
|
||||
use ModuleClassNameIdTrait;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function setup(): ServiceProviderInterface {
|
||||
return new ServiceProvider(
|
||||
require __DIR__ . '/../services.php',
|
||||
require __DIR__ . '/../extensions.php'
|
||||
);
|
||||
public function services(): array {
|
||||
return require __DIR__ . '/../services.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function run( ContainerInterface $c ): void {
|
||||
public function extensions(): array {
|
||||
return require __DIR__ . '/../extensions.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function run( ContainerInterface $c ): bool {
|
||||
|
||||
// Clears product status when appropriate.
|
||||
add_action(
|
||||
|
@ -159,13 +166,7 @@ class GooglepayModule implements ModuleInterface {
|
|||
},
|
||||
1
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the key for the module.
|
||||
*
|
||||
* @return string|void
|
||||
*/
|
||||
public function getKey() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,8 +9,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace WooCommerce\PayPalCommerce\Onboarding;
|
||||
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface;
|
||||
|
||||
return static function (): ModuleInterface {
|
||||
return static function (): OnboardingModule {
|
||||
return new OnboardingModule();
|
||||
};
|
||||
|
|
|
@ -10,33 +10,39 @@ declare(strict_types=1);
|
|||
namespace WooCommerce\PayPalCommerce\Onboarding;
|
||||
|
||||
use WooCommerce\PayPalCommerce\Onboarding\Endpoint\UpdateSignupLinksEndpoint;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\ServiceProvider;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface;
|
||||
use WooCommerce\PayPalCommerce\Onboarding\Assets\OnboardingAssets;
|
||||
use WooCommerce\PayPalCommerce\Onboarding\Endpoint\LoginSellerEndpoint;
|
||||
use WooCommerce\PayPalCommerce\Onboarding\Render\OnboardingRenderer;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Interop\Container\ServiceProviderInterface;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Inpsyde\Modularity\Module\ExecutableModule;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Class OnboardingModule
|
||||
*/
|
||||
class OnboardingModule implements ModuleInterface {
|
||||
class OnboardingModule implements ServiceModule, ExtendingModule, ExecutableModule {
|
||||
use ModuleClassNameIdTrait;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function setup(): ServiceProviderInterface {
|
||||
return new ServiceProvider(
|
||||
require __DIR__ . '/../services.php',
|
||||
require __DIR__ . '/../extensions.php'
|
||||
);
|
||||
public function services(): array {
|
||||
return require __DIR__ . '/../services.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function run( ContainerInterface $c ): void {
|
||||
public function extensions(): array {
|
||||
return require __DIR__ . '/../extensions.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function run( ContainerInterface $c ): bool {
|
||||
|
||||
$asset_loader = $c->get( 'onboarding.assets' );
|
||||
/**
|
||||
|
@ -107,13 +113,7 @@ class OnboardingModule implements ModuleInterface {
|
|||
// Initialize REST routes at the appropriate time.
|
||||
$rest_controller = $c->get( 'onboarding.rest' );
|
||||
add_action( 'rest_api_init', array( $rest_controller, 'register_routes' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the key for the module.
|
||||
*
|
||||
* @return string|void
|
||||
*/
|
||||
public function getKey() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,8 +9,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace WooCommerce\PayPalCommerce\OrderTracking;
|
||||
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface;
|
||||
|
||||
return static function (): ModuleInterface {
|
||||
return static function (): OrderTrackingModule {
|
||||
return new OrderTrackingModule();
|
||||
};
|
||||
|
|
|
@ -10,9 +10,10 @@ declare(strict_types=1);
|
|||
namespace WooCommerce\PayPalCommerce\OrderTracking;
|
||||
|
||||
use Automattic\WooCommerce\Internal\DataStores\Orders\CustomOrdersTableController;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\ServiceProvider;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Interop\Container\ServiceProviderInterface;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Inpsyde\Modularity\Module\ExecutableModule;
|
||||
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 Psr\Log\LoggerInterface;
|
||||
use WooCommerce\PayPalCommerce\OrderTracking\Assets\OrderEditPageAssets;
|
||||
|
@ -22,8 +23,8 @@ use WooCommerce\PayPalCommerce\WcGateway\Exception\NotFoundException;
|
|||
/**
|
||||
* Class OrderTrackingModule
|
||||
*/
|
||||
class OrderTrackingModule implements ModuleInterface {
|
||||
|
||||
class OrderTrackingModule implements ServiceModule, ExtendingModule, ExecutableModule {
|
||||
use ModuleClassNameIdTrait;
|
||||
use TrackingAvailabilityTrait;
|
||||
|
||||
public const PPCP_TRACKING_INFO_META_NAME = '_ppcp_paypal_tracking_info_meta_name';
|
||||
|
@ -31,11 +32,15 @@ class OrderTrackingModule implements ModuleInterface {
|
|||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function setup(): ServiceProviderInterface {
|
||||
return new ServiceProvider(
|
||||
require __DIR__ . '/../services.php',
|
||||
require __DIR__ . '/../extensions.php'
|
||||
);
|
||||
public function services(): array {
|
||||
return require __DIR__ . '/../services.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function extensions(): array {
|
||||
return require __DIR__ . '/../extensions.php';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -44,7 +49,7 @@ class OrderTrackingModule implements ModuleInterface {
|
|||
* @param ContainerInterface $c A services container instance.
|
||||
* @throws NotFoundException
|
||||
*/
|
||||
public function run( ContainerInterface $c ): void {
|
||||
public function run( ContainerInterface $c ): bool {
|
||||
$endpoint = $c->get( 'order-tracking.endpoint.controller' );
|
||||
assert( $endpoint instanceof OrderTrackingEndpoint );
|
||||
|
||||
|
@ -109,5 +114,7 @@ class OrderTrackingModule implements ModuleInterface {
|
|||
10,
|
||||
2
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,4 @@ declare(strict_types=1);
|
|||
|
||||
namespace WooCommerce\PayPalCommerce\PayPalSubscriptions;
|
||||
|
||||
use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
|
||||
|
||||
return array();
|
||||
|
|
|
@ -9,8 +9,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace WooCommerce\PayPalCommerce\PayPalSubscriptions;
|
||||
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface;
|
||||
|
||||
return static function (): ModuleInterface {
|
||||
return static function (): PayPalSubscriptionsModule {
|
||||
return new PayPalSubscriptionsModule();
|
||||
};
|
||||
|
|
|
@ -22,9 +22,10 @@ use WooCommerce\PayPalCommerce\ApiClient\Endpoint\BillingSubscriptions;
|
|||
use WooCommerce\PayPalCommerce\ApiClient\Exception\PayPalApiException;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException;
|
||||
use WooCommerce\PayPalCommerce\Onboarding\Environment;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\ServiceProvider;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Interop\Container\ServiceProviderInterface;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Inpsyde\Modularity\Module\ExecutableModule;
|
||||
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\WcGateway\Exception\NotFoundException;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
|
||||
|
@ -34,22 +35,27 @@ use WP_Post;
|
|||
/**
|
||||
* Class SavedPaymentCheckerModule
|
||||
*/
|
||||
class PayPalSubscriptionsModule implements ModuleInterface {
|
||||
class PayPalSubscriptionsModule implements ServiceModule, ExtendingModule, ExecutableModule {
|
||||
use ModuleClassNameIdTrait;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function setup(): ServiceProviderInterface {
|
||||
return new ServiceProvider(
|
||||
require __DIR__ . '/../services.php',
|
||||
require __DIR__ . '/../extensions.php'
|
||||
);
|
||||
public function services(): array {
|
||||
return require __DIR__ . '/../services.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function run( ContainerInterface $c ): void {
|
||||
public function extensions(): array {
|
||||
return require __DIR__ . '/../extensions.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function run( ContainerInterface $c ): bool {
|
||||
add_action(
|
||||
'save_post',
|
||||
/**
|
||||
|
@ -641,6 +647,8 @@ class PayPalSubscriptionsModule implements ModuleInterface {
|
|||
}
|
||||
}
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,6 +9,4 @@ declare(strict_types=1);
|
|||
|
||||
namespace WooCommerce\PayPalCommerce\SavePaymentMethods;
|
||||
|
||||
use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
|
||||
|
||||
return array();
|
||||
|
|
|
@ -9,8 +9,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace WooCommerce\PayPalCommerce\SavePaymentMethods;
|
||||
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface;
|
||||
|
||||
return static function (): ModuleInterface {
|
||||
return static function (): SavePaymentMethodsModule {
|
||||
return new SavePaymentMethodsModule();
|
||||
};
|
||||
|
|
|
@ -22,9 +22,10 @@ use WooCommerce\PayPalCommerce\Button\Helper\ContextTrait;
|
|||
use WooCommerce\PayPalCommerce\SavePaymentMethods\Endpoint\CaptureCardPayment;
|
||||
use WooCommerce\PayPalCommerce\SavePaymentMethods\Endpoint\CreatePaymentToken;
|
||||
use WooCommerce\PayPalCommerce\SavePaymentMethods\Endpoint\CreateSetupToken;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\ServiceProvider;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Interop\Container\ServiceProviderInterface;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Inpsyde\Modularity\Module\ExecutableModule;
|
||||
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\WcGateway\Gateway\CreditCardGateway;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
|
||||
|
@ -33,26 +34,30 @@ use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
|
|||
/**
|
||||
* Class SavePaymentMethodsModule
|
||||
*/
|
||||
class SavePaymentMethodsModule implements ModuleInterface {
|
||||
|
||||
class SavePaymentMethodsModule implements ServiceModule, ExtendingModule, ExecutableModule {
|
||||
use ModuleClassNameIdTrait;
|
||||
use ContextTrait;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function setup(): ServiceProviderInterface {
|
||||
return new ServiceProvider(
|
||||
require __DIR__ . '/../services.php',
|
||||
require __DIR__ . '/../extensions.php'
|
||||
);
|
||||
public function services(): array {
|
||||
return require __DIR__ . '/../services.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function run( ContainerInterface $c ): void {
|
||||
public function extensions(): array {
|
||||
return require __DIR__ . '/../extensions.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function run( ContainerInterface $c ): bool {
|
||||
if ( ! $c->get( 'save-payment-methods.eligible' ) ) {
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
add_filter(
|
||||
|
@ -335,6 +340,8 @@ class SavePaymentMethodsModule implements ModuleInterface {
|
|||
$endpoint->handle_request();
|
||||
}
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -14,7 +14,7 @@ use WooCommerce\PayPalCommerce\WcSubscriptions\Helper\SubscriptionHelper;
|
|||
use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
|
||||
|
||||
return array(
|
||||
'wcgateway.settings.fields' => function ( ContainerInterface $container, array $fields ): array {
|
||||
'wcgateway.settings.fields' => function ( array $fields, ContainerInterface $container ): array {
|
||||
$subscription_helper = $container->get( 'wc-subscriptions.helper' );
|
||||
assert( $subscription_helper instanceof SubscriptionHelper );
|
||||
|
||||
|
|
|
@ -9,8 +9,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace WooCommerce\PayPalCommerce\SavedPaymentChecker;
|
||||
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface;
|
||||
|
||||
return static function (): ModuleInterface {
|
||||
return static function (): SavedPaymentCheckerModule {
|
||||
return new SavedPaymentCheckerModule();
|
||||
};
|
||||
|
|
|
@ -11,31 +11,37 @@ namespace WooCommerce\PayPalCommerce\SavedPaymentChecker;
|
|||
|
||||
use Psr\Log\LoggerInterface;
|
||||
use WC_Order;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Inpsyde\Modularity\Module\ExecutableModule;
|
||||
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\WcSubscriptions\Helper\SubscriptionHelper;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\ServiceProvider;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Interop\Container\ServiceProviderInterface;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
|
||||
|
||||
/**
|
||||
* Class SavedPaymentCheckerModule
|
||||
*/
|
||||
class SavedPaymentCheckerModule implements ModuleInterface {
|
||||
class SavedPaymentCheckerModule implements ServiceModule, ExtendingModule, ExecutableModule {
|
||||
use ModuleClassNameIdTrait;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function setup(): ServiceProviderInterface {
|
||||
return new ServiceProvider(
|
||||
require __DIR__ . '/../services.php',
|
||||
require __DIR__ . '/../extensions.php'
|
||||
);
|
||||
public function services(): array {
|
||||
return require __DIR__ . '/../services.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function run( ContainerInterface $c ): void {
|
||||
public function extensions(): array {
|
||||
return require __DIR__ . '/../extensions.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function run( ContainerInterface $c ): bool {
|
||||
|
||||
/**
|
||||
* Set authorize intent for vaulted subscriptions, so we can void if payment not saved.
|
||||
|
@ -138,5 +144,7 @@ class SavedPaymentCheckerModule implements ModuleInterface {
|
|||
}
|
||||
}
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,8 +9,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace WooCommerce\PayPalCommerce\Session;
|
||||
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface;
|
||||
|
||||
return function (): ModuleInterface {
|
||||
return function (): SessionModule {
|
||||
return new SessionModule();
|
||||
};
|
||||
|
|
|
@ -14,16 +14,19 @@ use Throwable;
|
|||
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\OrderEndpoint;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Entity\Order;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Entity\OrderStatus;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\ServiceProvider;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface;
|
||||
use WooCommerce\PayPalCommerce\Session\Cancellation\CancelController;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Interop\Container\ServiceProviderInterface;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Inpsyde\Modularity\Module\ExecutableModule;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Class SessionModule
|
||||
*/
|
||||
class SessionModule implements ModuleInterface {
|
||||
class SessionModule implements ServiceModule, ExtendingModule, ExecutableModule {
|
||||
use ModuleClassNameIdTrait;
|
||||
|
||||
/**
|
||||
* A flag to avoid multiple requests to reload order.
|
||||
*
|
||||
|
@ -34,17 +37,21 @@ class SessionModule implements ModuleInterface {
|
|||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function setup(): ServiceProviderInterface {
|
||||
return new ServiceProvider(
|
||||
require __DIR__ . '/../services.php',
|
||||
require __DIR__ . '/../extensions.php'
|
||||
);
|
||||
public function services(): array {
|
||||
return require __DIR__ . '/../services.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function run( ContainerInterface $c ): void {
|
||||
public function extensions(): array {
|
||||
return require __DIR__ . '/../extensions.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function run( ContainerInterface $c ): bool {
|
||||
add_action(
|
||||
'woocommerce_init',
|
||||
function () use ( $c ) {
|
||||
|
@ -96,13 +103,7 @@ class SessionModule implements ModuleInterface {
|
|||
10,
|
||||
2
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the key for the module.
|
||||
*
|
||||
* @return string|void
|
||||
*/
|
||||
public function getKey() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,8 +9,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace WooCommerce\PayPalCommerce\StatusReport;
|
||||
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface;
|
||||
|
||||
return static function (): ModuleInterface {
|
||||
return static function (): StatusReportModule {
|
||||
return new StatusReportModule();
|
||||
};
|
||||
|
|
|
@ -9,10 +9,11 @@ declare(strict_types=1);
|
|||
|
||||
namespace WooCommerce\PayPalCommerce\StatusReport;
|
||||
|
||||
use WooCommerce\PayPalCommerce\Vendor\Inpsyde\Modularity\Module\ExecutableModule;
|
||||
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\WcSubscriptions\Helper\SubscriptionHelper;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\ServiceProvider;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Interop\Container\ServiceProviderInterface;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Authentication\Bearer;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\BillingAgreementsEndpoint;
|
||||
|
@ -26,16 +27,21 @@ use WooCommerce\PayPalCommerce\Webhooks\WebhookEventStorage;
|
|||
/**
|
||||
* Class StatusReportModule
|
||||
*/
|
||||
class StatusReportModule implements ModuleInterface {
|
||||
class StatusReportModule implements ServiceModule, ExtendingModule, ExecutableModule {
|
||||
use ModuleClassNameIdTrait;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function setup(): ServiceProviderInterface {
|
||||
return new ServiceProvider(
|
||||
require __DIR__ . '/../services.php',
|
||||
require __DIR__ . '/../extensions.php'
|
||||
);
|
||||
public function services(): array {
|
||||
return require __DIR__ . '/../services.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function extensions(): array {
|
||||
return require __DIR__ . '/../extensions.php';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -43,7 +49,7 @@ class StatusReportModule implements ModuleInterface {
|
|||
*
|
||||
* @param ContainerInterface $c A services container instance.
|
||||
*/
|
||||
public function run( ContainerInterface $c ): void {
|
||||
public function run( ContainerInterface $c ): bool {
|
||||
add_action(
|
||||
'woocommerce_system_status_report',
|
||||
function () use ( $c ) {
|
||||
|
@ -183,12 +189,9 @@ class StatusReportModule implements ModuleInterface {
|
|||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getKey() { }
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* It returns the current onboarding status.
|
||||
|
|
|
@ -14,7 +14,7 @@ use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
|
|||
use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
|
||||
|
||||
return array(
|
||||
'wcgateway.settings.fields' => static function ( ContainerInterface $container, array $fields ): array {
|
||||
'wcgateway.settings.fields' => static function ( array $fields, ContainerInterface $container ): array {
|
||||
$uninstall_fields = array(
|
||||
'uninstall_heading' => array(
|
||||
'heading' => __( 'Uninstall/Clear Database', 'woocommerce-paypal-payments' ),
|
||||
|
|
|
@ -9,8 +9,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace WooCommerce\PayPalCommerce\Uninstall;
|
||||
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface;
|
||||
|
||||
return function (): ModuleInterface {
|
||||
return function (): UninstallModule {
|
||||
return new UninstallModule();
|
||||
};
|
||||
|
|
|
@ -12,31 +12,37 @@ namespace WooCommerce\PayPalCommerce\Uninstall;
|
|||
use Exception;
|
||||
use WooCommerce\PayPalCommerce\Button\Endpoint\RequestData;
|
||||
use WooCommerce\PayPalCommerce\Uninstall\Assets\ClearDatabaseAssets;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\ServiceProvider;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Interop\Container\ServiceProviderInterface;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Inpsyde\Modularity\Module\ExecutableModule;
|
||||
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\WcGateway\Settings\Settings;
|
||||
|
||||
/**
|
||||
* Class UninstallModule
|
||||
*/
|
||||
class UninstallModule implements ModuleInterface {
|
||||
class UninstallModule implements ServiceModule, ExtendingModule, ExecutableModule {
|
||||
use ModuleClassNameIdTrait;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function setup(): ServiceProviderInterface {
|
||||
return new ServiceProvider(
|
||||
require __DIR__ . '/../services.php',
|
||||
require __DIR__ . '/../extensions.php'
|
||||
);
|
||||
public function services(): array {
|
||||
return require __DIR__ . '/../services.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function run( ContainerInterface $container ): void {
|
||||
public function extensions(): array {
|
||||
return require __DIR__ . '/../extensions.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function run( ContainerInterface $container ): bool {
|
||||
$page_id = $container->get( 'wcgateway.current-ppcp-settings-page-id' );
|
||||
if ( Settings::CONNECTION_TAB_ID === $page_id ) {
|
||||
$this->registerClearDatabaseAssets( $container->get( 'uninstall.clear-db-assets' ) );
|
||||
|
@ -50,6 +56,8 @@ class UninstallModule implements ModuleInterface {
|
|||
$action_names = $container->get( 'uninstall.ppcp-all-action-names' );
|
||||
|
||||
$this->handleClearDbAjaxRequest( $request_data, $clear_db, $clear_db_endpoint, $option_names, $scheduled_action_names, $action_names );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,8 +9,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace WooCommerce\PayPalCommerce\Vaulting;
|
||||
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface;
|
||||
|
||||
return static function (): ModuleInterface {
|
||||
return static function (): VaultingModule {
|
||||
return new VaultingModule();
|
||||
};
|
||||
|
|
|
@ -13,9 +13,10 @@ use Psr\Log\LoggerInterface;
|
|||
use RuntimeException;
|
||||
use WC_Payment_Token;
|
||||
use WC_Payment_Tokens;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\ServiceProvider;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Interop\Container\ServiceProviderInterface;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Inpsyde\Modularity\Module\ExecutableModule;
|
||||
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\WcGateway\Exception\NotFoundException;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\CreditCardGateway;
|
||||
|
@ -26,17 +27,21 @@ use WP_User_Query;
|
|||
/**
|
||||
* Class StatusReportModule
|
||||
*/
|
||||
class VaultingModule implements ModuleInterface {
|
||||
|
||||
class VaultingModule implements ServiceModule, ExtendingModule, ExecutableModule {
|
||||
use ModuleClassNameIdTrait;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function setup(): ServiceProviderInterface {
|
||||
return new ServiceProvider(
|
||||
require __DIR__ . '/../services.php',
|
||||
require __DIR__ . '/../extensions.php'
|
||||
);
|
||||
public function services(): array {
|
||||
return require __DIR__ . '/../services.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function extensions(): array {
|
||||
return require __DIR__ . '/../extensions.php';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -45,7 +50,7 @@ class VaultingModule implements ModuleInterface {
|
|||
* @param ContainerInterface $container A services container instance.
|
||||
* @throws NotFoundException When service could not be found.
|
||||
*/
|
||||
public function run( ContainerInterface $container ): void {
|
||||
public function run( ContainerInterface $container ): bool {
|
||||
$listener = $container->get( 'vaulting.customer-approval-listener' );
|
||||
assert( $listener instanceof CustomerApprovalListener );
|
||||
|
||||
|
@ -203,6 +208,8 @@ class VaultingModule implements ModuleInterface {
|
|||
return $methods;
|
||||
}
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -260,9 +267,4 @@ class VaultingModule implements ModuleInterface {
|
|||
$timestamp += $interval_in_seconds;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getKey() { }
|
||||
}
|
||||
|
|
|
@ -17,15 +17,15 @@ use Psr\Log\LoggerInterface;
|
|||
|
||||
return array(
|
||||
|
||||
'api.merchant_email' => static function ( ContainerInterface $container ): string {
|
||||
'api.merchant_email' => static function ( string $previous, ContainerInterface $container ): string {
|
||||
$settings = $container->get( 'wcgateway.settings' );
|
||||
return $settings->has( 'merchant_email' ) ? (string) $settings->get( 'merchant_email' ) : '';
|
||||
},
|
||||
'api.merchant_id' => static function ( ContainerInterface $container ): string {
|
||||
'api.merchant_id' => static function ( string $previous, ContainerInterface $container ): string {
|
||||
$settings = $container->get( 'wcgateway.settings' );
|
||||
return $settings->has( 'merchant_id' ) ? (string) $settings->get( 'merchant_id' ) : '';
|
||||
},
|
||||
'api.partner_merchant_id' => static function ( ContainerInterface $container ): string {
|
||||
'api.partner_merchant_id' => static function ( string $previous, ContainerInterface $container ): string {
|
||||
$environment = $container->get( 'onboarding.environment' );
|
||||
|
||||
/**
|
||||
|
@ -36,20 +36,20 @@ return array(
|
|||
return $environment->current_environment_is( Environment::SANDBOX ) ?
|
||||
(string) $container->get( 'api.partner_merchant_id-sandbox' ) : (string) $container->get( 'api.partner_merchant_id-production' );
|
||||
},
|
||||
'api.key' => static function ( ContainerInterface $container ): string {
|
||||
'api.key' => static function ( string $previous, ContainerInterface $container ): string {
|
||||
$settings = $container->get( 'wcgateway.settings' );
|
||||
$key = $settings->has( 'client_id' ) ? (string) $settings->get( 'client_id' ) : '';
|
||||
return $key;
|
||||
},
|
||||
'api.secret' => static function ( ContainerInterface $container ): string {
|
||||
'api.secret' => static function ( string $previous, ContainerInterface $container ): string {
|
||||
$settings = $container->get( 'wcgateway.settings' );
|
||||
return $settings->has( 'client_secret' ) ? (string) $settings->get( 'client_secret' ) : '';
|
||||
},
|
||||
'api.prefix' => static function ( ContainerInterface $container ): string {
|
||||
'api.prefix' => static function ( string $previous, ContainerInterface $container ): string {
|
||||
$settings = $container->get( 'wcgateway.settings' );
|
||||
return $settings->has( 'prefix' ) ? (string) $settings->get( 'prefix' ) : 'WC-';
|
||||
},
|
||||
'woocommerce.logger.woocommerce' => function ( ContainerInterface $container ): LoggerInterface {
|
||||
'woocommerce.logger.woocommerce' => function ( LoggerInterface $previous, ContainerInterface $container ): LoggerInterface {
|
||||
if ( ! function_exists( 'wc_get_logger' ) || ! $container->get( 'wcgateway.logging.is-enabled' ) ) {
|
||||
return new NullLogger();
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ return array(
|
|||
$source
|
||||
);
|
||||
},
|
||||
'wcgateway.settings.fields' => function ( ContainerInterface $container, array $fields ): array {
|
||||
'wcgateway.settings.fields' => function ( array $fields, ContainerInterface $container ): array {
|
||||
$files = array(
|
||||
'paypal-smart-button-fields.php',
|
||||
'connection-tab-fields.php',
|
||||
|
|
|
@ -9,8 +9,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace WooCommerce\PayPalCommerce\WcGateway;
|
||||
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface;
|
||||
|
||||
return static function (): ModuleInterface {
|
||||
return static function (): WCGatewayModule {
|
||||
return new WCGatewayModule();
|
||||
};
|
||||
|
|
|
@ -13,10 +13,11 @@ use Psr\Log\LoggerInterface;
|
|||
use Throwable;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Helper\Cache;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Inpsyde\Modularity\Module\ExecutableModule;
|
||||
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\WcGateway\Endpoint\RefreshFeatureStatusEndpoint;
|
||||
use WooCommerce\PayPalCommerce\WcSubscriptions\Helper\SubscriptionHelper;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\ServiceProvider;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface;
|
||||
use WC_Order;
|
||||
use WooCommerce\PayPalCommerce\AdminNotices\Repository\Repository;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Entity\Capture;
|
||||
|
@ -54,22 +55,27 @@ use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
|
|||
/**
|
||||
* Class WcGatewayModule
|
||||
*/
|
||||
class WCGatewayModule implements ModuleInterface {
|
||||
class WCGatewayModule implements ServiceModule, ExtendingModule, ExecutableModule {
|
||||
use ModuleClassNameIdTrait;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function setup(): ServiceProviderInterface {
|
||||
return new ServiceProvider(
|
||||
require __DIR__ . '/../services.php',
|
||||
require __DIR__ . '/../extensions.php'
|
||||
);
|
||||
public function services(): array {
|
||||
return require __DIR__ . '/../services.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function run( ContainerInterface $c ): void {
|
||||
public function extensions(): array {
|
||||
return require __DIR__ . '/../extensions.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function run( ContainerInterface $c ): bool {
|
||||
$this->register_payment_gateways( $c );
|
||||
$this->register_order_functionality( $c );
|
||||
$this->register_columns( $c );
|
||||
|
@ -430,6 +436,8 @@ class WCGatewayModule implements ModuleInterface {
|
|||
$c->get( 'wcgateway.cli.settings.command' )
|
||||
);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -698,13 +706,4 @@ class WCGatewayModule implements ModuleInterface {
|
|||
2
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the key for the module.
|
||||
*
|
||||
* @return string|void
|
||||
*/
|
||||
public function getKey() {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,8 +9,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace WooCommerce\PayPalCommerce\WcSubscriptions;
|
||||
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface;
|
||||
|
||||
return static function (): ModuleInterface {
|
||||
return static function (): WcSubscriptionsModule {
|
||||
return new WcSubscriptionsModule();
|
||||
};
|
||||
|
|
|
@ -11,12 +11,12 @@ namespace WooCommerce\PayPalCommerce\WcSubscriptions;
|
|||
|
||||
use Psr\Log\LoggerInterface;
|
||||
use WC_Order;
|
||||
use WC_Subscription;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException;
|
||||
use WooCommerce\PayPalCommerce\Vaulting\PaymentTokenRepository;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\ServiceProvider;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Interop\Container\ServiceProviderInterface;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Inpsyde\Modularity\Module\ExecutableModule;
|
||||
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\WcGateway\Exception\NotFoundException;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\CreditCardGateway;
|
||||
|
@ -28,24 +28,28 @@ use WooCommerce\PayPalCommerce\WcSubscriptions\Helper\SubscriptionHelper;
|
|||
/**
|
||||
* Class SubscriptionModule
|
||||
*/
|
||||
class WcSubscriptionsModule implements ModuleInterface {
|
||||
|
||||
class WcSubscriptionsModule implements ServiceModule, ExtendingModule, ExecutableModule {
|
||||
use ModuleClassNameIdTrait;
|
||||
use TransactionIdHandlingTrait;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function setup(): ServiceProviderInterface {
|
||||
return new ServiceProvider(
|
||||
require __DIR__ . '/../services.php',
|
||||
require __DIR__ . '/../extensions.php'
|
||||
);
|
||||
public function services(): array {
|
||||
return require __DIR__ . '/../services.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function run( ContainerInterface $c ): void {
|
||||
public function extensions(): array {
|
||||
return require __DIR__ . '/../extensions.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function run( ContainerInterface $c ): bool {
|
||||
add_action(
|
||||
'woocommerce_scheduled_subscription_payment_' . PayPalGateway::ID,
|
||||
/**
|
||||
|
@ -142,14 +146,8 @@ class WcSubscriptionsModule implements ModuleInterface {
|
|||
20,
|
||||
2
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the key for the module.
|
||||
*
|
||||
* @return string|void
|
||||
*/
|
||||
public function getKey() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -10,10 +10,11 @@ declare(strict_types=1);
|
|||
namespace WooCommerce\PayPalCommerce\Webhooks;
|
||||
|
||||
use WooCommerce\PayPalCommerce\Onboarding\State;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
|
||||
|
||||
return array(
|
||||
'wcgateway.settings.fields' => static function ( $container, array $fields ): array {
|
||||
'wcgateway.settings.fields' => static function ( array $fields, ContainerInterface $container ): array {
|
||||
$status_page_fields = array(
|
||||
'webhook_status_heading' => array(
|
||||
'heading' => __( 'Webhook Status', 'woocommerce-paypal-payments' ),
|
||||
|
|
|
@ -9,8 +9,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace WooCommerce\PayPalCommerce\Webhooks;
|
||||
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface;
|
||||
|
||||
return static function (): ModuleInterface {
|
||||
return static function (): WebhookModule {
|
||||
return new WebhookModule();
|
||||
};
|
||||
|
|
|
@ -10,10 +10,11 @@ declare(strict_types=1);
|
|||
namespace WooCommerce\PayPalCommerce\Webhooks;
|
||||
|
||||
use WooCommerce\PayPalCommerce\Onboarding\State;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\ServiceProvider;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface;
|
||||
use Exception;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Interop\Container\ServiceProviderInterface;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Inpsyde\Modularity\Module\ExecutableModule;
|
||||
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 Psr\Log\LoggerInterface;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
|
||||
|
@ -25,22 +26,27 @@ use WooCommerce\PayPalCommerce\Webhooks\Status\Assets\WebhooksStatusPageAssets;
|
|||
/**
|
||||
* Class WebhookModule
|
||||
*/
|
||||
class WebhookModule implements ModuleInterface {
|
||||
class WebhookModule implements ServiceModule, ExtendingModule, ExecutableModule {
|
||||
use ModuleClassNameIdTrait;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function setup(): ServiceProviderInterface {
|
||||
return new ServiceProvider(
|
||||
require __DIR__ . '/../services.php',
|
||||
require __DIR__ . '/../extensions.php'
|
||||
);
|
||||
public function services(): array {
|
||||
return require __DIR__ . '/../services.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function run( ContainerInterface $container ): void {
|
||||
public function extensions(): array {
|
||||
return require __DIR__ . '/../extensions.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function run( ContainerInterface $container ): bool {
|
||||
$logger = $container->get( 'woocommerce.logger.woocommerce' );
|
||||
assert( $logger instanceof LoggerInterface );
|
||||
|
||||
|
@ -158,13 +164,7 @@ class WebhookModule implements ModuleInterface {
|
|||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the key for the module.
|
||||
*
|
||||
* @return string|void
|
||||
*/
|
||||
public function getKey() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,8 +9,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace WooCommerce\WooCommerce\Logging;
|
||||
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface;
|
||||
|
||||
return function (): ModuleInterface {
|
||||
return function (): WooCommerceLoggingModule {
|
||||
return new WooCommerceLoggingModule();
|
||||
};
|
||||
|
|
|
@ -9,38 +9,36 @@ declare(strict_types=1);
|
|||
|
||||
namespace WooCommerce\WooCommerce\Logging;
|
||||
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\ServiceProvider;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Interop\Container\ServiceProviderInterface;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Inpsyde\Modularity\Module\ExecutableModule;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Class WooCommerceLoggingModule
|
||||
*/
|
||||
class WooCommerceLoggingModule implements ModuleInterface {
|
||||
class WooCommerceLoggingModule implements ServiceModule, ExtendingModule, ExecutableModule {
|
||||
use ModuleClassNameIdTrait;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function setup(): ServiceProviderInterface {
|
||||
return new ServiceProvider(
|
||||
require __DIR__ . '/../services.php',
|
||||
require __DIR__ . '/../extensions.php'
|
||||
);
|
||||
public function services(): array {
|
||||
return require __DIR__ . '/../services.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function run( ContainerInterface $c ): void {
|
||||
public function extensions(): array {
|
||||
return require __DIR__ . '/../extensions.php';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the key for the module.
|
||||
*
|
||||
* @return string|void
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getKey() {
|
||||
public function run( ContainerInterface $c ): bool {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,142 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This adapter module maps Dhii Modules to an aggregator Modularity Module.
|
||||
*
|
||||
* @package WooCommerce\PayPalCommerce
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace WooCommerce\PayPalCommerce;
|
||||
|
||||
use WooCommerce\PayPalCommerce\Vendor\Inpsyde\Modularity\Module\ExecutableModule;
|
||||
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\Dhii\Modular\Module\ModuleInterface;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
|
||||
|
||||
/**
|
||||
* Class DhiiToModularityModule
|
||||
*/
|
||||
class DhiiToModularityModule implements ServiceModule, ExtendingModule, ExecutableModule {
|
||||
use ModuleClassNameIdTrait;
|
||||
|
||||
/**
|
||||
* The Dhii Modules.
|
||||
*
|
||||
* @var array|ModuleInterface[]
|
||||
*/
|
||||
private $modules;
|
||||
|
||||
/**
|
||||
* The services.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $services = array();
|
||||
|
||||
/**
|
||||
* The extensions.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $extensions = array();
|
||||
|
||||
/**
|
||||
* The services
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $is_initialized = false;
|
||||
|
||||
/**
|
||||
* DhiiToModularityModule constructor.
|
||||
*
|
||||
* @param array|ModuleInterface[] $modules The Dhii modules.
|
||||
*/
|
||||
public function __construct( array $modules ) {
|
||||
$this->modules = $modules;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs module-specific setup and initializes this object based on module service providers.
|
||||
*
|
||||
* @return void
|
||||
* @throws Vendor\Dhii\Modular\Module\Exception\ModuleExceptionInterface Throws in case of module setup failure.
|
||||
*/
|
||||
private function setup(): void {
|
||||
if ( $this->is_initialized ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->services = array();
|
||||
$this->extensions = array();
|
||||
|
||||
foreach ( $this->modules as $module ) {
|
||||
$service_provider = $module->setup();
|
||||
|
||||
$this->services = array_merge(
|
||||
$this->services,
|
||||
$service_provider->getFactories()
|
||||
);
|
||||
|
||||
foreach ( $service_provider->getExtensions() as $key => $extension ) {
|
||||
if ( ! isset( $this->extensions[ $key ] ) ) {
|
||||
$this->extensions[ $key ] = array();
|
||||
}
|
||||
$this->extensions[ $key ][] = $extension;
|
||||
}
|
||||
}
|
||||
|
||||
$this->is_initialized = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function services(): array {
|
||||
$this->setup();
|
||||
return $this->services;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function extensions(): array {
|
||||
$this->setup();
|
||||
|
||||
return array_map(
|
||||
function ( $extension_group ) {
|
||||
/**
|
||||
* Maps Dhii extensions to modularity.
|
||||
*
|
||||
* @param mixed $previous The previous value.
|
||||
* @return ContainerInterface $container The container instance.
|
||||
*
|
||||
* @psalm-suppress MissingClosureParamType
|
||||
* @psalm-suppress MissingClosureReturnType
|
||||
*/
|
||||
return function ( $previous, ContainerInterface $container ) use ( $extension_group ) {
|
||||
$value = $previous;
|
||||
foreach ( $extension_group as $extension ) {
|
||||
$value = $extension( $container, $value );
|
||||
}
|
||||
return $value;
|
||||
};
|
||||
},
|
||||
$this->extensions
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function run( ContainerInterface $container ): bool {
|
||||
foreach ( $this->modules as $module ) {
|
||||
$module->run( $container );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -9,37 +9,36 @@ declare(strict_types=1);
|
|||
|
||||
namespace WooCommerce\PayPalCommerce;
|
||||
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\ServiceProvider;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Interop\Container\ServiceProviderInterface;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Inpsyde\Modularity\Module\ExecutableModule;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Class PluginModule
|
||||
*/
|
||||
class PluginModule implements ModuleInterface {
|
||||
class PluginModule implements ServiceModule, ExtendingModule, ExecutableModule {
|
||||
use ModuleClassNameIdTrait;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function setup(): ServiceProviderInterface {
|
||||
return new ServiceProvider(
|
||||
require __DIR__ . '/services.php',
|
||||
require __DIR__ . '/extensions.php'
|
||||
);
|
||||
public function services(): array {
|
||||
return require __DIR__ . '/services.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function run( ContainerInterface $c ): void {
|
||||
public function extensions(): array {
|
||||
return require __DIR__ . '/extensions.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the key for the module.
|
||||
*
|
||||
* @return string|void
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getKey() {
|
||||
public function run( ContainerInterface $c ): bool {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,10 +4,10 @@ declare(strict_types=1);
|
|||
namespace WooCommerce\PayPalCommerce;
|
||||
|
||||
use WooCommerce\PayPalCommerce\Helper\RedirectorStub;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\ServiceProvider;
|
||||
use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Interop\Container\ServiceProviderInterface;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Inpsyde\Modularity\Module\ExecutableModule;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Inpsyde\Modularity\Module\ModuleClassNameIdTrait;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Inpsyde\Modularity\Module\ServiceModule;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
|
||||
use function Brain\Monkey\Functions\when;
|
||||
|
||||
|
@ -68,16 +68,19 @@ class ModularTestCase extends TestCase
|
|||
}
|
||||
], $overriddenServices);
|
||||
|
||||
$module = new class ($overriddenServices) implements ModuleInterface {
|
||||
$module = new class ($overriddenServices) implements ServiceModule, ExecutableModule {
|
||||
use ModuleClassNameIdTrait;
|
||||
|
||||
public function __construct(array $services) {
|
||||
$this->services = $services;
|
||||
}
|
||||
|
||||
public function setup(): ServiceProviderInterface{
|
||||
return new ServiceProvider($this->services, []);
|
||||
public function services(): array {
|
||||
return $this->services;
|
||||
}
|
||||
|
||||
public function run(ContainerInterface $c): void {
|
||||
public function run(ContainerInterface $c): bool {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ use Exception;
|
|||
use WooCommerce\PayPalCommerce\ApiClient\Factory\PayerFactory;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Factory\PurchaseUnitFactory;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Factory\ShippingPreferenceFactory;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\Dictionary;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\OrderEndpoint;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Entity\Authorization;
|
||||
|
@ -23,6 +22,7 @@ use WooCommerce\PayPalCommerce\ApiClient\Helper\OrderHelper;
|
|||
use WooCommerce\PayPalCommerce\Button\Helper\ThreeDSecure;
|
||||
use WooCommerce\PayPalCommerce\Onboarding\Environment;
|
||||
use WooCommerce\PayPalCommerce\Session\SessionHandler;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Inpsyde\Modularity\Container\ReadOnlyContainer;
|
||||
use WooCommerce\PayPalCommerce\WcSubscriptions\Helper\SubscriptionHelper;
|
||||
use WooCommerce\PayPalCommerce\TestCase;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
|
||||
|
@ -37,7 +37,7 @@ class OrderProcessorTest extends TestCase
|
|||
public function setUp(): void {
|
||||
parent::setUp();
|
||||
|
||||
$this->environment = new Environment(new Dictionary([]));
|
||||
$this->environment = new Environment(new ReadOnlyContainer([], [], [], []));
|
||||
}
|
||||
|
||||
public function testAuthorize() {
|
||||
|
|
|
@ -3,7 +3,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace WooCommerce\PayPalCommerce\WcSubscriptions;
|
||||
|
||||
use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\Dictionary;
|
||||
use Exception;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\OrderEndpoint;
|
||||
|
@ -22,6 +21,7 @@ use WooCommerce\PayPalCommerce\TestCase;
|
|||
use Mockery;
|
||||
use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration;
|
||||
use WooCommerce\PayPalCommerce\Vaulting\PaymentTokenRepository;
|
||||
use WooCommerce\PayPalCommerce\Vendor\Inpsyde\Modularity\Container\ReadOnlyContainer;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Processor\AuthorizedPaymentsProcessor;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
|
||||
|
@ -50,7 +50,7 @@ class RenewalHandlerTest extends TestCase
|
|||
$this->purchaseUnitFactory = Mockery::mock(PurchaseUnitFactory::class);
|
||||
$this->shippingPreferenceFactory = Mockery::mock(ShippingPreferenceFactory::class);
|
||||
$this->payerFactory = Mockery::mock(PayerFactory::class);
|
||||
$this->environment = new Environment(new Dictionary([]));
|
||||
$this->environment = new Environment(new ReadOnlyContainer([], [], [], []));
|
||||
$authorizedPaymentProcessor = Mockery::mock(AuthorizedPaymentsProcessor::class);
|
||||
$settings = Mockery::mock(Settings::class);
|
||||
$settings
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue