2021-09-16 10:21:31 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* The vaulting module services.
|
|
|
|
*
|
|
|
|
* @package WooCommerce\PayPalCommerce\Vaulting
|
|
|
|
*/
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace WooCommerce\PayPalCommerce\Vaulting;
|
|
|
|
|
2022-11-09 10:11:31 +02:00
|
|
|
use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
|
2021-09-22 15:49:24 +02:00
|
|
|
|
2021-09-17 16:54:31 +02:00
|
|
|
return array(
|
2022-04-12 14:59:07 +03:00
|
|
|
'vaulting.module-url' => static function ( ContainerInterface $container ): string {
|
2025-07-04 19:27:13 +04:00
|
|
|
return plugins_url( '/modules/ppcp-vaulting/', $container->get( 'ppcp.path-to-plugin-main-file' ) );
|
2021-09-22 15:49:24 +02:00
|
|
|
},
|
2022-04-12 14:59:07 +03:00
|
|
|
'vaulting.repository.payment-token' => static function ( ContainerInterface $container ): PaymentTokenRepository {
|
2021-09-17 17:11:36 +02:00
|
|
|
$factory = $container->get( 'api.factory.payment-token' );
|
|
|
|
$endpoint = $container->get( 'api.endpoint.payment-token' );
|
|
|
|
return new PaymentTokenRepository( $factory, $endpoint );
|
|
|
|
},
|
2022-04-12 14:59:07 +03:00
|
|
|
'vaulting.customer-approval-listener' => function( ContainerInterface $container ) : CustomerApprovalListener {
|
|
|
|
return new CustomerApprovalListener(
|
|
|
|
$container->get( 'api.endpoint.payment-token' ),
|
|
|
|
$container->get( 'woocommerce.logger.woocommerce' )
|
|
|
|
);
|
|
|
|
},
|
2022-08-12 10:56:25 +02:00
|
|
|
'vaulting.credit-card-handler' => function( ContainerInterface $container ): VaultedCreditCardHandler {
|
2022-08-11 14:22:12 +02:00
|
|
|
return new VaultedCreditCardHandler(
|
2023-10-18 17:03:15 +02:00
|
|
|
$container->get( 'wc-subscriptions.helper' ),
|
2022-08-12 10:56:25 +02:00
|
|
|
$container->get( 'vaulting.repository.payment-token' ),
|
2022-08-11 14:22:12 +02:00
|
|
|
$container->get( 'api.factory.purchase-unit' ),
|
|
|
|
$container->get( 'api.factory.payer' ),
|
|
|
|
$container->get( 'api.factory.shipping-preference' ),
|
|
|
|
$container->get( 'api.endpoint.order' ),
|
2025-02-17 18:48:38 +01:00
|
|
|
$container->get( 'settings.environment' ),
|
2022-08-11 14:22:12 +02:00
|
|
|
$container->get( 'wcgateway.processor.authorized-payments' ),
|
|
|
|
$container->get( 'wcgateway.settings' )
|
|
|
|
);
|
|
|
|
},
|
2023-01-02 14:28:24 +01:00
|
|
|
'vaulting.payment-token-factory' => function( ContainerInterface $container ): PaymentTokenFactory {
|
2023-01-02 12:50:13 +01:00
|
|
|
return new PaymentTokenFactory();
|
2022-12-21 15:10:33 +01:00
|
|
|
},
|
2023-09-04 16:33:04 +02:00
|
|
|
'vaulting.payment-token-helper' => function( ContainerInterface $container ): PaymentTokenHelper {
|
|
|
|
return new PaymentTokenHelper();
|
|
|
|
},
|
2022-12-05 17:20:11 +01:00
|
|
|
'vaulting.payment-tokens-migration' => function( ContainerInterface $container ): PaymentTokensMigration {
|
|
|
|
return new PaymentTokensMigration(
|
2023-01-02 12:50:13 +01:00
|
|
|
$container->get( 'vaulting.payment-token-factory' ),
|
2023-01-25 12:19:53 +01:00
|
|
|
$container->get( 'vaulting.repository.payment-token' ),
|
2023-09-04 16:33:04 +02:00
|
|
|
$container->get( 'vaulting.payment-token-helper' ),
|
2022-12-15 17:01:56 +01:00
|
|
|
$container->get( 'woocommerce.logger.woocommerce' )
|
2022-12-05 17:20:11 +01:00
|
|
|
);
|
|
|
|
},
|
2024-03-22 11:55:44 +01:00
|
|
|
'vaulting.wc-payment-tokens' => static function( ContainerInterface $container ): WooCommercePaymentTokens {
|
|
|
|
return new WooCommercePaymentTokens(
|
|
|
|
$container->get( 'vaulting.payment-token-helper' ),
|
|
|
|
$container->get( 'vaulting.payment-token-factory' ),
|
2024-03-22 12:32:36 +01:00
|
|
|
$container->get( 'api.endpoint.payment-tokens' ),
|
2024-03-22 11:55:44 +01:00
|
|
|
$container->get( 'woocommerce.logger.woocommerce' )
|
|
|
|
);
|
|
|
|
},
|
2024-04-03 09:59:40 +02:00
|
|
|
'vaulting.vault-v3-enabled' => static function( ContainerInterface $container ): bool {
|
|
|
|
return $container->has( 'save-payment-methods.eligible' ) && $container->get( 'save-payment-methods.eligible' );
|
|
|
|
},
|
2021-09-17 16:54:31 +02:00
|
|
|
);
|