2020-07-28 12:27:42 +03:00
|
|
|
<?php
|
2020-08-27 11:50:10 +03:00
|
|
|
/**
|
|
|
|
* The services
|
|
|
|
*
|
2023-10-17 16:29:56 +02:00
|
|
|
* @package WooCommerce\PayPalCommerce\WcSubscriptions
|
2020-08-27 11:50:10 +03:00
|
|
|
*/
|
2020-07-28 12:27:42 +03:00
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
2023-10-17 16:29:56 +02:00
|
|
|
namespace WooCommerce\PayPalCommerce\WcSubscriptions;
|
2020-07-28 12:27:42 +03:00
|
|
|
|
2021-10-01 11:23:55 +02:00
|
|
|
use WooCommerce\PayPalCommerce\Vaulting\PaymentTokenRepository;
|
2023-10-18 17:03:15 +02:00
|
|
|
use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
|
2024-01-08 17:47:52 +01:00
|
|
|
use WooCommerce\PayPalCommerce\WcSubscriptions\Endpoint\SubscriptionChangePaymentMethod;
|
2024-02-16 16:28:13 +01:00
|
|
|
use WooCommerce\PayPalCommerce\WcSubscriptions\Helper\RealTimeAccountUpdaterHelper;
|
2023-10-18 17:03:15 +02:00
|
|
|
use WooCommerce\PayPalCommerce\WcSubscriptions\Helper\SubscriptionHelper;
|
2020-07-28 12:27:42 +03:00
|
|
|
|
2020-08-27 11:50:10 +03:00
|
|
|
return array(
|
2024-02-16 16:28:13 +01:00
|
|
|
'wc-subscriptions.helper' => static function ( ContainerInterface $container ): SubscriptionHelper {
|
2024-02-15 12:16:44 +01:00
|
|
|
return new SubscriptionHelper();
|
2020-08-27 11:50:10 +03:00
|
|
|
},
|
2024-02-16 16:28:13 +01:00
|
|
|
'wc-subscriptions.helpers.real-time-account-updater' => static function ( ContainerInterface $container ) : RealTimeAccountUpdaterHelper {
|
|
|
|
return new RealTimeAccountUpdaterHelper();
|
|
|
|
},
|
|
|
|
'wc-subscriptions.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' );
|
2024-02-05 16:30:19 +00:00
|
|
|
$funding_source_renderer = $container->get( 'wcgateway.funding-source.renderer' );
|
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,
|
2024-02-05 16:30:19 +00:00
|
|
|
$authorized_payments_processor,
|
2024-02-13 14:26:58 +01:00
|
|
|
$funding_source_renderer,
|
2024-02-16 16:28:13 +01:00
|
|
|
$container->get( 'wc-subscriptions.helpers.real-time-account-updater' ),
|
2024-03-15 15:53:29 +01:00
|
|
|
$container->get( 'wc-subscriptions.helper' ),
|
|
|
|
$container->get( 'api.endpoint.payment-tokens' )
|
2020-08-27 11:50:10 +03:00
|
|
|
);
|
|
|
|
},
|
2024-02-16 16:28:13 +01:00
|
|
|
'wc-subscriptions.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 );
|
|
|
|
},
|
2024-01-08 17:47:52 +01:00
|
|
|
'wc-subscriptions.endpoint.subscription-change-payment-method' => static function( ContainerInterface $container ): SubscriptionChangePaymentMethod {
|
|
|
|
return new SubscriptionChangePaymentMethod(
|
|
|
|
$container->get( 'button.request-data' )
|
|
|
|
);
|
|
|
|
},
|
2020-08-27 11:50:10 +03:00
|
|
|
);
|