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\OrderDetail;
|
2020-04-23 11:19:09 +03:00
|
|
|
use Inpsyde\PayPalCommerce\WcGateway\Admin\OrderTablePaymentStatusColumn;
|
|
|
|
use Inpsyde\PayPalCommerce\WcGateway\Admin\PaymentStatusOrderDetail;
|
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;
|
2020-04-28 13:32:48 +03:00
|
|
|
use Inpsyde\PayPalCommerce\WcGateway\Processor\OrderProcessor;
|
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-28 12:31:12 +03:00
|
|
|
'wcgateway.gateway.base' => static function (ContainerInterface $container): WcGatewayBase {
|
2020-04-13 14:57:53 +03:00
|
|
|
return new WcGatewayBase();
|
|
|
|
},
|
2020-04-28 12:31:12 +03:00
|
|
|
'wcgateway.gateway' => static function (ContainerInterface $container): WcGateway {
|
2020-04-28 13:32:48 +03:00
|
|
|
$orderProcessor = $container->get('wcgateway.order-processor');
|
2020-04-09 14:02:35 +03:00
|
|
|
$settingsFields = $container->get('wcgateway.settings.fields');
|
2020-04-28 13:32:48 +03:00
|
|
|
$authorizedPayments = $container->get('wcgateway.processor.authorized-payments');
|
2020-04-28 12:31:12 +03:00
|
|
|
$notice = $container->get('wcgateway.notice.authorize-order-action');
|
2020-04-16 15:04:53 +03:00
|
|
|
return new WcGateway(
|
|
|
|
$settingsFields,
|
2020-04-28 13:32:48 +03:00
|
|
|
$orderProcessor,
|
|
|
|
$authorizedPayments,
|
2020-04-28 12:31:12 +03:00
|
|
|
$notice
|
2020-04-16 15:04:53 +03:00
|
|
|
);
|
2020-04-02 08:38:00 +03:00
|
|
|
},
|
2020-04-28 12:31:12 +03:00
|
|
|
'wcgateway.disabler' => static 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-28 12:31:12 +03:00
|
|
|
'wcgateway.settings' => static 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-28 12:31:12 +03:00
|
|
|
'wcgateway.notice.connect' => static 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' =>
|
2020-04-28 12:31:12 +03:00
|
|
|
static function (ContainerInterface $container): AuthorizeOrderActionNotice {
|
2020-04-13 22:30:57 +03:00
|
|
|
return new AuthorizeOrderActionNotice();
|
|
|
|
},
|
2020-04-28 12:31:12 +03:00
|
|
|
'wcgateway.settings.fields' => static 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-28 13:32:48 +03:00
|
|
|
'wcgateway.order-processor' => static function (ContainerInterface $container): OrderProcessor {
|
|
|
|
|
|
|
|
$sessionHandler = $container->get('session.handler');
|
|
|
|
$cartRepository = $container->get('api.repository.cart');
|
|
|
|
$orderEndpoint = $container->get('api.endpoint.order');
|
|
|
|
$paymentsEndpoint = $container->get('api.endpoint.payments');
|
|
|
|
$orderFactory = $container->get('api.factory.order');
|
|
|
|
return new OrderProcessor(
|
|
|
|
$sessionHandler,
|
|
|
|
$cartRepository,
|
|
|
|
$orderEndpoint,
|
|
|
|
$paymentsEndpoint,
|
|
|
|
$orderFactory
|
|
|
|
);
|
2020-04-16 15:04:53 +03:00
|
|
|
},
|
2020-04-28 12:31:12 +03:00
|
|
|
'wcgateway.processor.authorized-payments' => static function (ContainerInterface $container): AuthorizedPaymentsProcessor {
|
2020-04-16 15:04:53 +03:00
|
|
|
$orderEndpoint = $container->get('api.endpoint.order');
|
|
|
|
$paymentsEndpoint = $container->get('api.endpoint.payments');
|
|
|
|
return new AuthorizedPaymentsProcessor($orderEndpoint, $paymentsEndpoint);
|
|
|
|
},
|
2020-04-28 12:31:12 +03:00
|
|
|
'wcgateway.admin.order-payment-status' => static function (ContainerInterface $container): PaymentStatusOrderDetail {
|
2020-04-23 11:19:09 +03:00
|
|
|
return new PaymentStatusOrderDetail();
|
2020-04-22 19:27:07 +03:00
|
|
|
},
|
2020-04-28 12:31:12 +03:00
|
|
|
'wcgateway.admin.orders-payment-status-column' => static function (ContainerInterface $container): OrderTablePaymentStatusColumn {
|
2020-04-22 19:27:07 +03:00
|
|
|
$settings = $container->get('wcgateway.settings');
|
2020-04-23 11:19:09 +03:00
|
|
|
return new OrderTablePaymentStatusColumn($settings);
|
2020-04-28 12:31:12 +03:00
|
|
|
},
|
2020-04-02 08:38:00 +03:00
|
|
|
];
|