woocommerce-paypal-payments/modules.local/ppcp-wc-gateway/services.php

39 lines
1.7 KiB
PHP
Raw Normal View History

2020-04-02 08:38:00 +03:00
<?php
declare(strict_types=1);
namespace Inpsyde\PayPalCommerce\WcGateway;
use Dhii\Data\Container\ContainerInterface;
use Inpsyde\PayPalCommerce\WcGateway\Checkout\DisableGateways;
use Inpsyde\PayPalCommerce\WcGateway\Gateway\WcGateway;
use Inpsyde\PayPalCommerce\WcGateway\Notice\ConnectNotice;
2020-04-09 14:02:35 +03:00
use Inpsyde\PayPalCommerce\WcGateway\Settings\Settings;
use Inpsyde\PayPalCommerce\WcGateway\Settings\SettingsFields;
2020-04-02 08:38:00 +03:00
return [
2020-04-06 11:16:18 +03:00
'wcgateway.gateway' => function (ContainerInterface $container) : WcGateway {
2020-04-02 08:38:00 +03:00
$sessionHandler = $container->get('session.handler');
2020-04-06 10:51:56 +03:00
$cartRepository = $container->get('api.cart-repository');
2020-04-02 08:38:00 +03:00
$endpoint = $container->get('api.endpoint.order');
2020-04-06 10:51:56 +03:00
$orderFactory = $container->get('api.factory.order');
2020-04-09 14:02:35 +03:00
$settingsFields = $container->get('wcgateway.settings.fields');
return new WcGateway($sessionHandler, $cartRepository, $endpoint, $orderFactory, $settingsFields);
2020-04-02 08:38:00 +03:00
},
2020-04-06 11:16:18 +03:00
'wcgateway.disabler' => function (ContainerInterface $container) : DisableGateways {
2020-04-02 08:38:00 +03:00
$sessionHandler = $container->get('session.handler');
return new DisableGateways($sessionHandler);
2020-04-06 11:16:18 +03:00
},
2020-04-09 14:02:35 +03:00
'wcgateway.settings' => function (ContainerInterface $container) : Settings {
$gateway = $container->get('wcgateway.gateway');
$settingsField = $container->get('wcgateway.settings.fields');
return new Settings($gateway, $settingsField);
},
'wcgateway.notice.connect' => function (ContainerInterface $container) : ConnectNotice {
$settings = $container->get('wcgateway.settings');
return new ConnectNotice($settings);
},
2020-04-09 14:02:35 +03:00
'wcgateway.settings.fields' => function (ContainerInterface $container) : SettingsFields {
return new SettingsFields();
2020-04-09 14:36:52 +03:00
},
2020-04-02 08:38:00 +03:00
];