2020-07-28 12:27:42 +03:00
|
|
|
<?php
|
2020-08-27 11:50:10 +03:00
|
|
|
/**
|
|
|
|
* The services
|
|
|
|
*
|
2020-09-11 14:11:10 +03:00
|
|
|
* @package WooCommerce\PayPalCommerce\Subscription
|
2020-08-27 11:50:10 +03:00
|
|
|
*/
|
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;
|
2020-07-28 12:27:42 +03:00
|
|
|
|
2020-08-27 11:50:10 +03:00
|
|
|
return array(
|
2021-09-30 12:52:15 +02:00
|
|
|
'subscription.helper' => static function ( ContainerInterface $container ): SubscriptionHelper {
|
2020-08-27 11:50:10 +03:00
|
|
|
return new SubscriptionHelper();
|
|
|
|
},
|
2021-09-30 12:52:15 +02:00
|
|
|
'subscription.renewal-handler' => static function ( ContainerInterface $container ): RenewalHandler {
|
2020-08-27 11:50:10 +03:00
|
|
|
$logger = $container->get( 'woocommerce.logger.woocommerce' );
|
2021-09-17 17:11:36 +02:00
|
|
|
$repository = $container->get( 'vaulting.repository.payment-token' );
|
2020-08-27 11:50:10 +03:00
|
|
|
$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
|
|
|
|
);
|
|
|
|
},
|
2021-02-17 14:35:37 +01:00
|
|
|
'subscription.repository.payment-token' => static function ( ContainerInterface $container ): PaymentTokenRepository {
|
2020-08-27 11:50:10 +03:00
|
|
|
$factory = $container->get( 'api.factory.payment-token' );
|
|
|
|
$endpoint = $container->get( 'api.endpoint.payment-token' );
|
|
|
|
return new PaymentTokenRepository( $factory, $endpoint );
|
|
|
|
},
|
|
|
|
);
|