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

69 lines
2.7 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;
use WooCommerce\PayPalCommerce\Vendor\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( $container->get( 'wcgateway.settings' ) );
},
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' );
$environment = $container->get( 'onboarding.environment' );
$settings = $container->get( 'wcgateway.settings' );
$authorized_payments_processor = $container->get( 'wcgateway.processor.authorized-payments' );
return new RenewalHandler(
$logger,
$repository,
$endpoint,
$purchase_unit_factory,
$container->get( 'api.factory.shipping-preference' ),
$payer_factory,
$environment,
$settings,
$authorized_payments_processor
);
},
'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 );
},
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-05-03 16:43:37 +02:00
$container->get( 'api.shop.currency' ),
2023-03-17 16:06:26 +01:00
$container->get( 'woocommerce.logger.woocommerce' )
);
2023-05-02 12:35:46 +02:00
},
'subscription.module.url' => static function ( ContainerInterface $container ): string {
/**
* The path cannot be false.
*
* @psalm-suppress PossiblyFalseArgument
*/
return plugins_url(
'/modules/ppcp-subscription/',
dirname( realpath( __FILE__ ), 3 ) . '/woocommerce-paypal-payments.php'
);
},
);