mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-30 05:00:51 +08:00
Refactor the code to use the new service
This commit is contained in:
parent
30b7a592c5
commit
0caa74c021
21 changed files with 22 additions and 166 deletions
|
@ -18,14 +18,7 @@ use WooCommerce\PayPalCommerce\AdminNotices\Endpoint\MuteMessageEndpoint;
|
|||
|
||||
return array(
|
||||
'admin-notices.url' => static function ( ContainerInterface $container ): string {
|
||||
$path = realpath( __FILE__ );
|
||||
if ( false === $path ) {
|
||||
return '';
|
||||
}
|
||||
return plugins_url(
|
||||
'/modules/ppcp-admin-notices/',
|
||||
dirname( $path, 3 ) . '/woocommerce-paypal-payments.php'
|
||||
);
|
||||
return plugins_url( '/modules/ppcp-admin-notices/', $container->get( 'ppcp.plugin-path' ) );
|
||||
},
|
||||
'admin-notices.renderer' => static function ( ContainerInterface $container ): RendererInterface {
|
||||
return new Renderer(
|
||||
|
|
|
@ -136,14 +136,7 @@ return array(
|
|||
return false;
|
||||
},
|
||||
'applepay.url' => static function ( ContainerInterface $container ): string {
|
||||
$path = realpath( __FILE__ );
|
||||
if ( false === $path ) {
|
||||
return '';
|
||||
}
|
||||
return plugins_url(
|
||||
'/modules/ppcp-applepay/',
|
||||
dirname( $path, 3 ) . '/woocommerce-paypal-payments.php'
|
||||
);
|
||||
return plugins_url( '/modules/ppcp-applepay/', $container->get( 'ppcp.plugin-path' ) );
|
||||
},
|
||||
'applepay.sdk_script_url' => static function ( ContainerInterface $container ): string {
|
||||
return 'https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js';
|
||||
|
|
|
@ -18,15 +18,7 @@ return array(
|
|||
return true;
|
||||
},
|
||||
'axoblock.url' => static function ( ContainerInterface $container ) : string {
|
||||
/**
|
||||
* The path cannot be false.
|
||||
*
|
||||
* @psalm-suppress PossiblyFalseArgument
|
||||
*/
|
||||
return plugins_url(
|
||||
'/modules/ppcp-axo-block/',
|
||||
dirname( realpath( __FILE__ ), 3 ) . '/woocommerce-paypal-payments.php'
|
||||
);
|
||||
return plugins_url( '/modules/ppcp-axo-block/', $container->get( 'ppcp.plugin-path' ) );
|
||||
},
|
||||
'axoblock.method' => static function ( ContainerInterface $container ) : AxoBlockPaymentMethod {
|
||||
return new AxoBlockPaymentMethod(
|
||||
|
|
|
@ -59,14 +59,7 @@ return array(
|
|||
},
|
||||
|
||||
'axo.url' => static function ( ContainerInterface $container ): string {
|
||||
$path = realpath( __FILE__ );
|
||||
if ( false === $path ) {
|
||||
return '';
|
||||
}
|
||||
return plugins_url(
|
||||
'/modules/ppcp-axo/',
|
||||
dirname( $path, 3 ) . '/woocommerce-paypal-payments.php'
|
||||
);
|
||||
return plugins_url( '/modules/ppcp-axo/', $container->get( 'ppcp.plugin-path' ) );
|
||||
},
|
||||
|
||||
'axo.manager' => static function ( ContainerInterface $container ): AxoManager {
|
||||
|
|
|
@ -17,15 +17,7 @@ use WC_Cart;
|
|||
|
||||
return array(
|
||||
'blocks.url' => static function ( ContainerInterface $container ): string {
|
||||
/**
|
||||
* The path cannot be false.
|
||||
*
|
||||
* @psalm-suppress PossiblyFalseArgument
|
||||
*/
|
||||
return plugins_url(
|
||||
'/modules/ppcp-blocks/',
|
||||
dirname( realpath( __FILE__ ), 3 ) . '/woocommerce-paypal-payments.php'
|
||||
);
|
||||
return plugins_url( '/modules/ppcp-blocks/', $container->get( 'ppcp.plugin-path' ) );
|
||||
},
|
||||
'blocks.method' => static function ( ContainerInterface $container ): PayPalPaymentMethod {
|
||||
return new PayPalPaymentMethod(
|
||||
|
|
|
@ -174,10 +174,7 @@ return array(
|
|||
);
|
||||
},
|
||||
'button.url' => static function ( ContainerInterface $container ): string {
|
||||
return plugins_url(
|
||||
'/modules/ppcp-button/',
|
||||
dirname( realpath( __FILE__ ), 3 ) . '/woocommerce-paypal-payments.php'
|
||||
);
|
||||
return plugins_url( '/modules/ppcp-button/', $container->get( 'ppcp.plugin-path' ) );
|
||||
},
|
||||
'button.pay-now-contexts' => static function ( ContainerInterface $container ): array {
|
||||
$defaults = array( 'checkout', 'pay-now' );
|
||||
|
|
|
@ -101,15 +101,7 @@ return array(
|
|||
},
|
||||
|
||||
'compat.module.url' => static function ( ContainerInterface $container ): string {
|
||||
/**
|
||||
* The path cannot be false.
|
||||
*
|
||||
* @psalm-suppress PossiblyFalseArgument
|
||||
*/
|
||||
return plugins_url(
|
||||
'/modules/ppcp-compat/',
|
||||
dirname( realpath( __FILE__ ), 3 ) . '/woocommerce-paypal-payments.php'
|
||||
);
|
||||
return plugins_url( '/modules/ppcp-compat/', $container->get( 'ppcp.plugin-path' ) );
|
||||
},
|
||||
|
||||
'compat.assets' => function( ContainerInterface $container ) : CompatAssets {
|
||||
|
|
|
@ -205,14 +205,7 @@ return array(
|
|||
},
|
||||
|
||||
'googlepay.url' => static function ( ContainerInterface $container ): string {
|
||||
$path = realpath( __FILE__ );
|
||||
if ( false === $path ) {
|
||||
return '';
|
||||
}
|
||||
return plugins_url(
|
||||
'/modules/ppcp-googlepay/',
|
||||
dirname( $path, 3 ) . '/woocommerce-paypal-payments.php'
|
||||
);
|
||||
return plugins_url( '/modules/ppcp-googlepay/', $container->get( 'ppcp.plugin-path' ) );
|
||||
},
|
||||
|
||||
'googlepay.sdk_url' => static function ( ContainerInterface $container ): string {
|
||||
|
|
|
@ -14,15 +14,7 @@ use WooCommerce\PayPalCommerce\LocalAlternativePaymentMethods\LocalApmProductSta
|
|||
|
||||
return array(
|
||||
'ppcp-local-apms.url' => static function ( ContainerInterface $container ): string {
|
||||
/**
|
||||
* The path cannot be false.
|
||||
*
|
||||
* @psalm-suppress PossiblyFalseArgument
|
||||
*/
|
||||
return plugins_url(
|
||||
'/modules/ppcp-local-alternative-payment-methods/',
|
||||
dirname( realpath( __FILE__ ), 3 ) . '/woocommerce-paypal-payments.php'
|
||||
);
|
||||
return plugins_url( '/modules/ppcp-local-alternative-payment-methods/', $container->get( 'ppcp.plugin-path' ) );
|
||||
},
|
||||
'ppcp-local-apms.payment-methods' => static function( ContainerInterface $container ): array {
|
||||
return array(
|
||||
|
|
|
@ -123,10 +123,7 @@ return array(
|
|||
},
|
||||
|
||||
'onboarding.url' => static function ( ContainerInterface $container ): string {
|
||||
return plugins_url(
|
||||
'/modules/ppcp-onboarding/',
|
||||
dirname( realpath( __FILE__ ), 3 ) . '/woocommerce-paypal-payments.php'
|
||||
);
|
||||
return plugins_url( '/modules/ppcp-onboarding/', $container->get( 'ppcp.plugin-path' ) );
|
||||
},
|
||||
|
||||
'onboarding.endpoint.login-seller' => static function ( ContainerInterface $container ) : LoginSellerEndpoint {
|
||||
|
|
|
@ -43,15 +43,7 @@ return array(
|
|||
);
|
||||
},
|
||||
'order-tracking.module.url' => static function ( ContainerInterface $container ): string {
|
||||
/**
|
||||
* The path cannot be false.
|
||||
*
|
||||
* @psalm-suppress PossiblyFalseArgument
|
||||
*/
|
||||
return plugins_url(
|
||||
'/modules/ppcp-order-tracking/',
|
||||
dirname( realpath( __FILE__ ), 3 ) . '/woocommerce-paypal-payments.php'
|
||||
);
|
||||
return plugins_url( '/modules/ppcp-order-tracking/', $container->get( 'ppcp.plugin-path' ) );
|
||||
},
|
||||
'order-tracking.meta-box.renderer' => static function ( ContainerInterface $container ): MetaBoxRenderer {
|
||||
return new MetaBoxRenderer(
|
||||
|
|
|
@ -14,15 +14,7 @@ use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
|
|||
|
||||
return array(
|
||||
'paylater-block.url' => static function ( ContainerInterface $container ): string {
|
||||
/**
|
||||
* Cannot return false for this path.
|
||||
*
|
||||
* @psalm-suppress PossiblyFalseArgument
|
||||
*/
|
||||
return plugins_url(
|
||||
'/modules/ppcp-paylater-block/',
|
||||
dirname( realpath( __FILE__ ), 3 ) . '/woocommerce-paypal-payments.php'
|
||||
);
|
||||
return plugins_url( '/modules/ppcp-paylater-block/', $container->get( 'ppcp.plugin-path' ) );
|
||||
},
|
||||
'paylater-block.renderer' => static function (): PayLaterBlockRenderer {
|
||||
return new PayLaterBlockRenderer();
|
||||
|
|
|
@ -19,17 +19,7 @@ use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
|
|||
|
||||
return array(
|
||||
'paylater-configurator.url' => static function ( ContainerInterface $container ): string {
|
||||
/**
|
||||
* The return value must not contain a trailing slash.
|
||||
*
|
||||
* Cannot return false for this path.
|
||||
*
|
||||
* @psalm-suppress PossiblyFalseArgument
|
||||
*/
|
||||
return plugins_url(
|
||||
'/modules/ppcp-paylater-configurator',
|
||||
dirname( realpath( __FILE__ ), 3 ) . '/woocommerce-paypal-payments.php'
|
||||
);
|
||||
return plugins_url( '/modules/ppcp-paylater-configurator', $container->get( 'ppcp.plugin-path' ) );
|
||||
},
|
||||
'paylater-configurator.factory.config' => static function ( ContainerInterface $container ): ConfigFactory {
|
||||
return new ConfigFactory();
|
||||
|
|
|
@ -13,15 +13,7 @@ use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
|
|||
|
||||
return array(
|
||||
'paylater-wc-blocks.url' => static function ( ContainerInterface $container ): string {
|
||||
/**
|
||||
* Cannot return false for this path.
|
||||
*
|
||||
* @psalm-suppress PossiblyFalseArgument
|
||||
*/
|
||||
return plugins_url(
|
||||
'/modules/ppcp-paylater-wc-blocks/',
|
||||
dirname( realpath( __FILE__ ), 3 ) . '/woocommerce-paypal-payments.php'
|
||||
);
|
||||
return plugins_url( '/modules/ppcp-paylater-wc-blocks/', $container->get( 'ppcp.plugin-path' ) );
|
||||
},
|
||||
|
||||
'paylater-wc-blocks.cart-renderer' => static function ( ContainerInterface $container ): PayLaterWCBlocksRenderer {
|
||||
|
|
|
@ -30,15 +30,7 @@ return array(
|
|||
);
|
||||
},
|
||||
'paypal-subscriptions.module.url' => static function ( ContainerInterface $container ): string {
|
||||
/**
|
||||
* The path cannot be false.
|
||||
*
|
||||
* @psalm-suppress PossiblyFalseArgument
|
||||
*/
|
||||
return plugins_url(
|
||||
'/modules/ppcp-paypal-subscriptions/',
|
||||
dirname( realpath( __FILE__ ), 3 ) . '/woocommerce-paypal-payments.php'
|
||||
);
|
||||
return plugins_url( '/modules/ppcp-paypal-subscriptions/', $container->get( 'ppcp.plugin-path' ) );
|
||||
},
|
||||
'paypal-subscriptions.renewal-handler' => static function ( ContainerInterface $container ): RenewalHandler {
|
||||
return new RenewalHandler( $container->get( 'woocommerce.logger.woocommerce' ) );
|
||||
|
|
|
@ -87,15 +87,7 @@ return array(
|
|||
);
|
||||
},
|
||||
'save-payment-methods.module.url' => static function ( ContainerInterface $container ): string {
|
||||
/**
|
||||
* The path cannot be false.
|
||||
*
|
||||
* @psalm-suppress PossiblyFalseArgument
|
||||
*/
|
||||
return plugins_url(
|
||||
'/modules/ppcp-save-payment-methods/',
|
||||
dirname( realpath( __FILE__ ), 3 ) . '/woocommerce-paypal-payments.php'
|
||||
);
|
||||
return plugins_url( '/modules/ppcp-save-payment-methods/', $container->get( 'ppcp.plugin-path' ) );
|
||||
},
|
||||
'save-payment-methods.endpoint.create-setup-token' => static function ( ContainerInterface $container ): CreateSetupToken {
|
||||
return new CreateSetupToken(
|
||||
|
|
|
@ -75,15 +75,7 @@ use WooCommerce\PayPalCommerce\WcGateway\Helper\MerchantDetails;
|
|||
|
||||
return array(
|
||||
'settings.url' => static function ( ContainerInterface $container ) : string {
|
||||
/**
|
||||
* The path cannot be false.
|
||||
*
|
||||
* @psalm-suppress PossiblyFalseArgument
|
||||
*/
|
||||
return plugins_url(
|
||||
'/modules/ppcp-settings/',
|
||||
dirname( realpath( __FILE__ ), 3 ) . '/woocommerce-paypal-payments.php'
|
||||
);
|
||||
return plugins_url( '/modules/ppcp-settings/', $container->get( 'ppcp.plugin-path' ) );
|
||||
},
|
||||
'settings.data.onboarding' => static function ( ContainerInterface $container ) : OnboardingProfile {
|
||||
$can_use_casual_selling = $container->get( 'settings.casual-selling.eligible' );
|
||||
|
|
|
@ -79,15 +79,7 @@ return array(
|
|||
},
|
||||
|
||||
'uninstall.module-url' => static function ( ContainerInterface $container ): string {
|
||||
/**
|
||||
* The path cannot be false.
|
||||
*
|
||||
* @psalm-suppress PossiblyFalseArgument
|
||||
*/
|
||||
return plugins_url(
|
||||
'/modules/ppcp-uninstall/',
|
||||
dirname( realpath( __FILE__ ), 3 ) . '/woocommerce-paypal-payments.php'
|
||||
);
|
||||
return plugins_url( '/modules/ppcp-uninstall/', $container->get( 'ppcp.plugin-path' ) );
|
||||
},
|
||||
|
||||
'uninstall.clear-db-assets' => function( ContainerInterface $container ) : ClearDatabaseAssets {
|
||||
|
|
|
@ -13,10 +13,7 @@ use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
|
|||
|
||||
return array(
|
||||
'vaulting.module-url' => static function ( ContainerInterface $container ): string {
|
||||
return plugins_url(
|
||||
'/modules/ppcp-vaulting/',
|
||||
dirname( realpath( __FILE__ ), 3 ) . '/woocommerce-paypal-payments.php'
|
||||
);
|
||||
return plugins_url( '/modules/ppcp-vaulting/', $container->get( 'ppcp.plugin-path' ) );
|
||||
},
|
||||
'vaulting.repository.payment-token' => static function ( ContainerInterface $container ): PaymentTokenRepository {
|
||||
$factory = $container->get( 'api.factory.payment-token' );
|
||||
|
|
|
@ -1351,19 +1351,13 @@ return array(
|
|||
);
|
||||
},
|
||||
'wcgateway.url' => static function ( ContainerInterface $container ): string {
|
||||
return plugins_url(
|
||||
$container->get( 'wcgateway.relative-path' ),
|
||||
dirname( realpath( __FILE__ ), 3 ) . '/woocommerce-paypal-payments.php'
|
||||
);
|
||||
return plugins_url( $container->get( 'wcgateway.relative-path' ), $container->get( 'ppcp.plugin-path' ) );
|
||||
},
|
||||
'wcgateway.relative-path' => static function( ContainerInterface $container ): string {
|
||||
return 'modules/ppcp-wc-gateway/';
|
||||
},
|
||||
'wcgateway.absolute-path' => static function( ContainerInterface $container ): string {
|
||||
return plugin_dir_path(
|
||||
dirname( realpath( __FILE__ ), 3 ) . '/woocommerce-paypal-payments.php'
|
||||
) .
|
||||
$container->get( 'wcgateway.relative-path' );
|
||||
return plugin_dir_path( $container->get( 'ppcp.plugin-path' ) ) . $container->get( 'wcgateway.relative-path' );
|
||||
},
|
||||
'wcgateway.endpoint.return-url' => static function ( ContainerInterface $container ) : ReturnUrlEndpoint {
|
||||
$gateway = $container->get( 'wcgateway.paypal-gateway' );
|
||||
|
|
|
@ -220,9 +220,6 @@ return array(
|
|||
},
|
||||
|
||||
'webhook.module-url' => static function ( ContainerInterface $container ): string {
|
||||
return plugins_url(
|
||||
'/modules/ppcp-webhooks/',
|
||||
dirname( realpath( __FILE__ ), 3 ) . '/woocommerce-paypal-payments.php'
|
||||
);
|
||||
return plugins_url( '/modules/ppcp-webhooks/', $container->get( 'ppcp.plugin-path' ) );
|
||||
},
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue