2020-04-02 08:38:00 +03:00
|
|
|
<?php
|
2020-04-16 15:04:53 +03:00
|
|
|
|
2020-04-02 08:38:00 +03:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace Inpsyde\PayPalCommerce\WcGateway;
|
|
|
|
|
|
|
|
use Dhii\Data\Container\ContainerInterface;
|
2020-04-22 16:07:02 +03:00
|
|
|
use Inpsyde\PayPalCommerce\WcGateway\Admin\AuthorizedPaymentStatus;
|
2020-04-22 19:27:07 +03:00
|
|
|
use Inpsyde\PayPalCommerce\WcGateway\Admin\AuthorizedPaymentStatusColumn;
|
2020-04-22 16:07:02 +03:00
|
|
|
use Inpsyde\PayPalCommerce\WcGateway\Admin\OrderDetail;
|
2020-04-02 08:38:00 +03:00
|
|
|
use Inpsyde\PayPalCommerce\WcGateway\Checkout\DisableGateways;
|
|
|
|
use Inpsyde\PayPalCommerce\WcGateway\Gateway\WcGateway;
|
2020-04-13 14:57:53 +03:00
|
|
|
use Inpsyde\PayPalCommerce\WcGateway\Gateway\WcGatewayBase;
|
2020-04-13 22:30:57 +03:00
|
|
|
use Inpsyde\PayPalCommerce\WcGateway\Notice\AuthorizeOrderActionNotice;
|
2020-04-10 12:36:42 +03:00
|
|
|
use Inpsyde\PayPalCommerce\WcGateway\Notice\ConnectAdminNotice;
|
2020-04-16 15:04:53 +03:00
|
|
|
use Inpsyde\PayPalCommerce\WcGateway\Processor\AuthorizedPaymentsProcessor;
|
|
|
|
use Inpsyde\PayPalCommerce\WcGateway\Processor\Processor;
|
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-13 14:57:53 +03:00
|
|
|
'wcgateway.gateway.base' => function (ContainerInterface $container) : WcGatewayBase {
|
|
|
|
return new WcGatewayBase();
|
|
|
|
},
|
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-13 09:07:20 +03:00
|
|
|
$cartRepository = $container->get('api.repository.cart');
|
2020-04-16 15:04:53 +03:00
|
|
|
// TODO eventuall get rid of the endpoints as the processor is sufficient
|
2020-04-14 16:08:24 +03:00
|
|
|
$orderEndpoint = $container->get('api.endpoint.order');
|
|
|
|
$paymentsEndpoint = $container->get('api.endpoint.payments');
|
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');
|
2020-04-16 15:04:53 +03:00
|
|
|
$processor = $container->get('wcgateway.processor');
|
|
|
|
return new WcGateway(
|
|
|
|
$sessionHandler,
|
|
|
|
$cartRepository,
|
|
|
|
$orderEndpoint,
|
|
|
|
$paymentsEndpoint,
|
|
|
|
$orderFactory,
|
|
|
|
$settingsFields,
|
|
|
|
$processor
|
|
|
|
);
|
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 {
|
2020-04-13 14:57:53 +03:00
|
|
|
$gateway = $container->get('wcgateway.gateway.base');
|
2020-04-09 14:02:35 +03:00
|
|
|
$settingsField = $container->get('wcgateway.settings.fields');
|
|
|
|
return new Settings($gateway, $settingsField);
|
|
|
|
},
|
2020-04-10 12:36:42 +03:00
|
|
|
'wcgateway.notice.connect' => function (ContainerInterface $container) : ConnectAdminNotice {
|
2020-04-10 12:20:08 +03:00
|
|
|
$settings = $container->get('wcgateway.settings');
|
2020-04-10 12:36:42 +03:00
|
|
|
return new ConnectAdminNotice($settings);
|
2020-04-10 12:20:08 +03:00
|
|
|
},
|
2020-04-13 22:30:57 +03:00
|
|
|
'wcgateway.notice.authorize-order-action' =>
|
|
|
|
function (ContainerInterface $container): AuthorizeOrderActionNotice {
|
|
|
|
return new AuthorizeOrderActionNotice();
|
|
|
|
},
|
|
|
|
'wcgateway.settings.fields' => function (ContainerInterface $container): SettingsFields {
|
2020-04-09 14:02:35 +03:00
|
|
|
return new SettingsFields();
|
2020-04-09 14:36:52 +03:00
|
|
|
},
|
2020-04-16 15:04:53 +03:00
|
|
|
'wcgateway.processor' => function (ContainerInterface $container): Processor {
|
|
|
|
$authorizedPaymentsProcessor = $container->get('wcgateway.processor.authorized-payments');
|
|
|
|
return new Processor($authorizedPaymentsProcessor);
|
|
|
|
},
|
|
|
|
'wcgateway.processor.authorized-payments' => function (ContainerInterface $container): AuthorizedPaymentsProcessor {
|
|
|
|
$orderEndpoint = $container->get('api.endpoint.order');
|
|
|
|
$paymentsEndpoint = $container->get('api.endpoint.payments');
|
|
|
|
return new AuthorizedPaymentsProcessor($orderEndpoint, $paymentsEndpoint);
|
|
|
|
},
|
2020-04-22 16:07:02 +03:00
|
|
|
'wcgateway.admin.authorized-payment-status' => function(ContainerInterface $container): AuthorizedPaymentStatus {
|
|
|
|
return new AuthorizedPaymentStatus();
|
2020-04-22 19:27:07 +03:00
|
|
|
},
|
|
|
|
'wcgateway.admin.authorized-payment-status-column' => function(ContainerInterface $container): AuthorizedPaymentStatusColumn {
|
|
|
|
$settings = $container->get('wcgateway.settings');
|
|
|
|
return new AuthorizedPaymentStatusColumn($settings);
|
2020-04-22 16:07:02 +03:00
|
|
|
}
|
2020-04-02 08:38:00 +03:00
|
|
|
];
|