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;
|
|
|
|
|
2021-10-13 15:02:10 +03:00
|
|
|
use Psr\Container\ContainerInterface;
|
2021-09-22 15:49:24 +02:00
|
|
|
use WooCommerce\PayPalCommerce\Vaulting\Assets\MyAccountPaymentsAssets;
|
2021-09-23 15:19:44 +02:00
|
|
|
use WooCommerce\PayPalCommerce\Vaulting\Endpoint\DeletePaymentTokenEndpoint;
|
2021-09-22 15:49:24 +02:00
|
|
|
|
2021-09-17 16:54:31 +02:00
|
|
|
return array(
|
2021-10-13 15:02:10 +03:00
|
|
|
'vaulting.module-url' => static function ( ContainerInterface $container ): string {
|
2021-09-22 15:49:24 +02:00
|
|
|
return plugins_url(
|
|
|
|
'/modules/ppcp-vaulting/',
|
2022-01-14 16:35:13 +02:00
|
|
|
dirname( realpath( __FILE__ ), 3 ) . '/woocommerce-paypal-payments.php'
|
2021-09-22 15:49:24 +02:00
|
|
|
);
|
|
|
|
},
|
2021-10-13 15:02:10 +03:00
|
|
|
'vaulting.assets.myaccount-payments' => function( ContainerInterface $container ) : MyAccountPaymentsAssets {
|
2021-09-22 15:49:24 +02:00
|
|
|
return new MyAccountPaymentsAssets(
|
2022-02-17 18:51:24 +02:00
|
|
|
$container->get( 'vaulting.module-url' ),
|
|
|
|
$container->get( 'ppcp.asset-version' )
|
2021-09-22 15:49:24 +02:00
|
|
|
);
|
|
|
|
},
|
2021-09-24 12:36:56 +02:00
|
|
|
'vaulting.payment-tokens-renderer' => static function (): PaymentTokensRenderer {
|
|
|
|
return new PaymentTokensRenderer();
|
2021-09-17 16:54:31 +02:00
|
|
|
},
|
2021-10-13 15:02:10 +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 );
|
|
|
|
},
|
2021-10-13 15:02:10 +03:00
|
|
|
'vaulting.endpoint.delete' => function( ContainerInterface $container ) : DeletePaymentTokenEndpoint {
|
2021-09-23 15:19:44 +02:00
|
|
|
return new DeletePaymentTokenEndpoint(
|
|
|
|
$container->get( 'vaulting.repository.payment-token' ),
|
2021-09-23 17:12:17 +02:00
|
|
|
$container->get( 'button.request-data' ),
|
|
|
|
$container->get( 'woocommerce.logger.woocommerce' )
|
2021-09-23 15:19:44 +02:00
|
|
|
);
|
|
|
|
},
|
2021-09-17 16:54:31 +02:00
|
|
|
);
|