woocommerce-paypal-payments/modules/ppcp-subscription/services.php

40 lines
1.4 KiB
PHP
Raw Normal View History

2020-07-28 12:27:42 +03:00
<?php
/**
* The services
*
2020-09-11 14:11:10 +03:00
* @package WooCommerce\PayPalCommerce\Subscription
*/
2020-07-28 12:27:42 +03:00
declare(strict_types=1);
2020-09-11 14:11:10 +03:00
namespace WooCommerce\PayPalCommerce\Subscription;
2020-07-28 12:27:42 +03:00
2020-09-11 14:11:10 +03:00
use WooCommerce\PayPalCommerce\Subscription\Helper\SubscriptionHelper;
2021-09-30 16:30:52 +02:00
use Psr\Container\ContainerInterface;
use WooCommerce\PayPalCommerce\Vaulting\PaymentTokenRepository;
2020-07-28 12:27:42 +03:00
return array(
2021-10-01 10:50:24 +02:00
'subscription.helper' => static function ( ContainerInterface $container ): SubscriptionHelper {
return new SubscriptionHelper();
},
2021-10-01 10:50:24 +02:00
'subscription.renewal-handler' => static function ( ContainerInterface $container ): RenewalHandler {
$logger = $container->get( 'woocommerce.logger.woocommerce' );
$repository = $container->get( 'vaulting.repository.payment-token' );
$endpoint = $container->get( 'api.endpoint.order' );
$purchase_unit_factory = $container->get( 'api.factory.purchase-unit' );
$payer_factory = $container->get( 'api.factory.payer' );
return new RenewalHandler(
$logger,
$repository,
$endpoint,
$purchase_unit_factory,
$payer_factory
);
},
'subscription.repository.payment-token' => static function ( ContainerInterface $container ): PaymentTokenRepository {
$factory = $container->get( 'api.factory.payment-token' );
$endpoint = $container->get( 'api.endpoint.payment-token' );
return new PaymentTokenRepository( $factory, $endpoint );
},
);