mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-01 07:02:48 +08:00
services to check if supported 3rd party is active.
This commit is contained in:
parent
8c8cbc6153
commit
4bfde190ec
2 changed files with 25 additions and 9 deletions
|
@ -14,7 +14,7 @@ use WooCommerce\PayPalCommerce\Compat\Assets\CompatAssets;
|
|||
|
||||
return array(
|
||||
|
||||
'compat.ppec.mock-gateway' => static function( $container ) {
|
||||
'compat.ppec.mock-gateway' => static function( $container ) {
|
||||
$settings = $container->get( 'wcgateway.settings' );
|
||||
$title = $settings->has( 'title' ) ? $settings->get( 'title' ) : __( 'PayPal', 'woocommerce-paypal-payments' );
|
||||
$title = sprintf(
|
||||
|
@ -26,20 +26,20 @@ return array(
|
|||
return new PPEC\MockGateway( $title );
|
||||
},
|
||||
|
||||
'compat.ppec.subscriptions-handler' => static function ( ContainerInterface $container ) {
|
||||
'compat.ppec.subscriptions-handler' => static function ( ContainerInterface $container ) {
|
||||
$ppcp_renewal_handler = $container->get( 'subscription.renewal-handler' );
|
||||
$gateway = $container->get( 'compat.ppec.mock-gateway' );
|
||||
|
||||
return new PPEC\SubscriptionsHandler( $ppcp_renewal_handler, $gateway );
|
||||
},
|
||||
|
||||
'compat.ppec.settings_importer' => static function( ContainerInterface $container ) : PPEC\SettingsImporter {
|
||||
'compat.ppec.settings_importer' => static function( ContainerInterface $container ) : PPEC\SettingsImporter {
|
||||
$settings = $container->get( 'wcgateway.settings' );
|
||||
|
||||
return new PPEC\SettingsImporter( $settings );
|
||||
},
|
||||
|
||||
'compat.plugin-script-names' => static function( ContainerInterface $container ) : array {
|
||||
'compat.plugin-script-names' => static function( ContainerInterface $container ) : array {
|
||||
return array(
|
||||
'ppcp-smart-button',
|
||||
'ppcp-oxxo',
|
||||
|
@ -54,7 +54,19 @@ return array(
|
|||
);
|
||||
},
|
||||
|
||||
'compat.module.url' => static function ( ContainerInterface $container ): string {
|
||||
'compat.gzd.is_supported_plugin_version_active' => function (): bool {
|
||||
return function_exists( 'wc_gzd_get_shipments_by_order' ); // 3.0+
|
||||
},
|
||||
|
||||
'compat.wc_shipment_tracking.is_supported_plugin_version_active' => function (): bool {
|
||||
return class_exists( 'WC_Shipment_Tracking' );
|
||||
},
|
||||
|
||||
'compat.ywot.is_supported_plugin_version_active' => function (): bool {
|
||||
return function_exists( 'yith_ywot_init' );
|
||||
},
|
||||
|
||||
'compat.module.url' => static function ( ContainerInterface $container ): string {
|
||||
/**
|
||||
* The path cannot be false.
|
||||
*
|
||||
|
@ -66,7 +78,7 @@ return array(
|
|||
);
|
||||
},
|
||||
|
||||
'compat.assets' => function( ContainerInterface $container ) : CompatAssets {
|
||||
'compat.assets' => function( ContainerInterface $container ) : CompatAssets {
|
||||
return new CompatAssets(
|
||||
$container->get( 'compat.module.url' ),
|
||||
$container->get( 'ppcp.asset-version' ),
|
||||
|
|
|
@ -96,17 +96,21 @@ return array(
|
|||
$logger = $container->get( 'woocommerce.logger.woocommerce' );
|
||||
$endpoint = $container->get( 'order-tracking.endpoint.controller' );
|
||||
|
||||
$is_gzd_active = $container->get( 'compat.gzd.is_supported_plugin_version_active' );
|
||||
$is_wc_shipment_active = $container->get( 'compat.wc_shipment_tracking.is_supported_plugin_version_active' );
|
||||
$is_yith_ywot_active = $container->get( 'compat.ywot.is_supported_plugin_version_active' );
|
||||
|
||||
$integrations = array();
|
||||
|
||||
if ( function_exists( 'wc_gzd_get_shipments_by_order' ) ) {
|
||||
if ( $is_gzd_active ) {
|
||||
$integrations[] = new GermanizedShipmentIntegration( $shipment_factory, $logger, $endpoint );
|
||||
}
|
||||
|
||||
if ( class_exists( 'WC_Shipment_Tracking' ) ) {
|
||||
if ( $is_wc_shipment_active ) {
|
||||
$integrations[] = new ShipmentTrackingIntegration( $shipment_factory, $logger, $endpoint );
|
||||
}
|
||||
|
||||
if ( function_exists( 'yith_ywot_init' ) ) {
|
||||
if ( $is_yith_ywot_active ) {
|
||||
$integrations[] = new YithShipmentIntegration( $shipment_factory, $logger, $endpoint );
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue