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;
|
2022-11-09 10:11:31 +02:00
|
|
|
use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
|
2021-10-01 11:23:55 +02:00
|
|
|
use WooCommerce\PayPalCommerce\Vaulting\PaymentTokenRepository;
|
2020-07-28 12:27:42 +03:00
|
|
|
|
2020-08-27 11:50:10 +03:00
|
|
|
return array(
|
2021-10-01 10:50:24 +02:00
|
|
|
'subscription.helper' => static function ( ContainerInterface $container ): SubscriptionHelper {
|
2020-08-27 11:50:10 +03:00
|
|
|
return new SubscriptionHelper();
|
|
|
|
},
|
2021-10-01 10:50:24 +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' );
|
2022-01-05 15:25:22 +02:00
|
|
|
$environment = $container->get( 'onboarding.environment' );
|
2022-06-29 16:52:19 +04:00
|
|
|
$settings = $container->get( 'wcgateway.settings' );
|
|
|
|
$authorized_payments_processor = $container->get( 'wcgateway.processor.authorized-payments' );
|
2020-08-27 11:50:10 +03:00
|
|
|
return new RenewalHandler(
|
|
|
|
$logger,
|
|
|
|
$repository,
|
|
|
|
$endpoint,
|
|
|
|
$purchase_unit_factory,
|
2022-07-05 14:25:55 +03:00
|
|
|
$container->get( 'api.factory.shipping-preference' ),
|
2022-01-05 15:25:22 +02:00
|
|
|
$payer_factory,
|
2022-06-29 16:52:19 +04:00
|
|
|
$environment,
|
|
|
|
$settings,
|
|
|
|
$authorized_payments_processor
|
2020-08-27 11:50:10 +03:00
|
|
|
);
|
|
|
|
},
|
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 );
|
|
|
|
},
|
2023-05-02 12:35:46 +02:00
|
|
|
'subscription.api-handler' => static function( ContainerInterface $container ): SubscriptionsApiHandler {
|
2023-03-17 16:06:26 +01:00
|
|
|
return new SubscriptionsApiHandler(
|
2023-05-02 12:35:46 +02:00
|
|
|
$container->get( 'api.endpoint.catalog-products' ),
|
|
|
|
$container->get( 'api.factory.product' ),
|
|
|
|
$container->get( 'api.endpoint.billing-plans' ),
|
|
|
|
$container->get( 'api.factory.billing-cycle' ),
|
|
|
|
$container->get( 'api.factory.payment-preferences' ),
|
2023-03-17 16:06:26 +01:00
|
|
|
$container->get( 'woocommerce.logger.woocommerce' )
|
|
|
|
);
|
2023-05-02 12:35:46 +02:00
|
|
|
},
|
2020-08-27 11:50:10 +03:00
|
|
|
);
|