2020-07-28 12:27:42 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace Inpsyde\PayPalCommerce\Subscription;
|
|
|
|
|
|
|
|
use Inpsyde\PayPalCommerce\Subscription\Helper\SubscriptionHelper;
|
|
|
|
use Inpsyde\PayPalCommerce\Subscription\Repository\PaymentTokenRepository;
|
|
|
|
use Psr\Container\ContainerInterface;
|
|
|
|
|
|
|
|
return [
|
2020-07-28 07:15:04 +03:00
|
|
|
'subscription.helper' => static function (ContainerInterface $container): SubscriptionHelper {
|
2020-07-28 12:27:42 +03:00
|
|
|
return new SubscriptionHelper();
|
|
|
|
},
|
2020-07-28 07:15:04 +03:00
|
|
|
'subscription.renewal-handler' => static function (ContainerInterface $container): RenewalHandler {
|
2020-07-28 12:27:42 +03:00
|
|
|
$logger = $container->get('woocommerce.logger.woocommerce');
|
|
|
|
$repository = $container->get('subscription.repository.payment-token');
|
|
|
|
$endpoint = $container->get('api.endpoint.order');
|
|
|
|
$purchaseFactory = $container->get('api.factory.purchase-unit');
|
|
|
|
$payerFactory = $container->get('api.factory.payer');
|
|
|
|
return new RenewalHandler(
|
|
|
|
$logger,
|
|
|
|
$repository,
|
|
|
|
$endpoint,
|
|
|
|
$purchaseFactory,
|
|
|
|
$payerFactory
|
|
|
|
);
|
|
|
|
},
|
2020-07-28 07:15:04 +03:00
|
|
|
'subscription.repository.payment-token' => static function (ContainerInterface $container): PaymentTokenRepository {
|
2020-07-28 12:27:42 +03:00
|
|
|
$factory = $container->get('api.factory.payment-token');
|
|
|
|
$endpoint = $container->get('api.endpoint.payment-token');
|
|
|
|
return new PaymentTokenRepository($factory, $endpoint);
|
2020-07-28 07:15:04 +03:00
|
|
|
},
|
2020-07-28 12:27:42 +03:00
|
|
|
];
|