PluginProbe
seQura / 4.2.0
seQura v4.2.0
4.3.4 4.3.3 4.3.2 4.3.1 trunk 2.0.0 2.0.10 2.0.11 2.0.12 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 3.0.0 3.0.2 3.0.5 3.0.6 3.0.7 3.1.0 3.1.1 3.2.0 3.2.1 3.2.2 4.0.0 All 30 releases
sequra / src / class-bootstrap.php

class-bootstrap.php in seQura 4.2.0, at src/class-bootstrap.php

1,162 lines 45.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Implementation for the core bootstrap class.
4 *
5 * @package SeQura/WC
6 */
7
8 namespace SeQura\WC;
9
10 use SeQura\Core\BusinessLogic\BootstrapComponent;
11 use SeQura\Core\BusinessLogic\DataAccess\ConnectionData\Entities\ConnectionData;
12 use SeQura\Core\BusinessLogic\DataAccess\OrderSettings\Entities\OrderStatusSettings;
13 use SeQura\Core\BusinessLogic\DataAccess\PromotionalWidgets\Entities\WidgetSettings;
14 use SeQura\Core\BusinessLogic\DataAccess\SendReport\Entities\SendReport;
15 use SeQura\Core\BusinessLogic\DataAccess\StatisticalData\Entities\StatisticalData;
16 use SeQura\Core\BusinessLogic\DataAccess\TransactionLog\Entities\TransactionLog;
17 use SeQura\Core\BusinessLogic\DataAccess\CountryConfiguration\Entities\CountryConfiguration;
18 use SeQura\Core\BusinessLogic\DataAccess\Credentials\Entities\Credentials;
19 use SeQura\Core\BusinessLogic\DataAccess\Deployments\Entities\Deployment;
20 use SeQura\Core\BusinessLogic\DataAccess\GeneralSettings\Entities\GeneralSettings;
21 use SeQura\Core\BusinessLogic\DataAccess\PaymentMethod\Entities\PaymentMethod;
22 use SeQura\Core\BusinessLogic\Domain\Connection\Services\ConnectionService;
23 use SeQura\Core\BusinessLogic\Domain\Connection\Services\CredentialsService;
24 use SeQura\Core\BusinessLogic\Domain\CountryConfiguration\RepositoryContracts\CountryConfigurationRepositoryInterface;
25 use SeQura\Core\BusinessLogic\Domain\Integration\Category\CategoryServiceInterface;
26 use SeQura\Core\BusinessLogic\Domain\Integration\Disconnect\DisconnectServiceInterface;
27 use SeQura\Core\BusinessLogic\Domain\Integration\Order\MerchantDataProviderInterface;
28 use SeQura\Core\BusinessLogic\Domain\Integration\Order\OrderCreationInterface;
29 use SeQura\Core\BusinessLogic\Domain\Integration\OrderReport\OrderReportServiceInterface;
30 use SeQura\Core\BusinessLogic\Domain\Integration\Product\ProductServiceInterface;
31 use SeQura\Core\BusinessLogic\Domain\Integration\SellingCountries\SellingCountriesServiceInterface;
32 use SeQura\Core\BusinessLogic\Domain\Integration\ShopOrderStatuses\ShopOrderStatusesServiceInterface;
33 use SeQura\Core\BusinessLogic\Domain\Integration\Store\StoreServiceInterface;
34 use SeQura\Core\BusinessLogic\Domain\Integration\Version\VersionServiceInterface;
35 use SeQura\Core\BusinessLogic\Domain\Multistore\StoreContext;
36 use SeQura\Core\BusinessLogic\Domain\Order\Models\SeQuraOrder;
37 use SeQura\Core\BusinessLogic\Domain\Order\RepositoryContracts\SeQuraOrderRepositoryInterface;
38 use SeQura\Core\BusinessLogic\Domain\OrderStatusSettings\RepositoryContracts\OrderStatusSettingsRepositoryInterface;
39 use SeQura\Core\BusinessLogic\Domain\OrderStatusSettings\Services\OrderStatusSettingsService;
40 use SeQura\Core\BusinessLogic\Domain\StatisticalData\RepositoryContracts\StatisticalDataRepositoryInterface;
41 use SeQura\Core\BusinessLogic\Utility\EncryptorInterface;
42 use SeQura\Core\BusinessLogic\Webhook\Services\ShopOrderService;
43 use SeQura\Core\Infrastructure\Configuration\ConfigEntity;
44 use SeQura\Core\Infrastructure\Exceptions\ServiceNotRegisteredException;
45 use SeQura\Core\Infrastructure\Logger\Interfaces\DefaultLoggerAdapter;
46 use SeQura\Core\Infrastructure\Logger\Interfaces\ShopLoggerAdapter;
47 use SeQura\Core\Infrastructure\Logger\LoggerConfiguration;
48 use SeQura\Core\Infrastructure\ORM\RepositoryRegistry;
49 use SeQura\Core\Infrastructure\Serializer\Concrete\JsonSerializer;
50 use SeQura\Core\Infrastructure\Serializer\Serializer;
51 use SeQura\Core\Infrastructure\ServiceRegister as Reg;
52 use SeQura\Core\Infrastructure\TaskExecution\Process;
53 use SeQura\Core\Infrastructure\TaskExecution\QueueItem;
54 use SeQura\Core\Infrastructure\Utility\TimeProvider;
55 use SeQura\WC\Controllers\Hooks\Asset\Assets_Controller;
56 use SeQura\WC\Controllers\Hooks\Asset\Interface_Assets_Controller;
57 use SeQura\WC\Controllers\Hooks\Product\Interface_Product_Controller;
58 use SeQura\WC\Controllers\Hooks\Product\Product_Controller;
59 use SeQura\WC\Controllers\Hooks\I18n\I18n_Controller;
60 use SeQura\WC\Controllers\Hooks\I18n\Interface_I18n_Controller;
61 use SeQura\WC\Controllers\Hooks\Order\Interface_Order_Controller;
62 use SeQura\WC\Controllers\Hooks\Order\Order_Controller;
63 use SeQura\WC\Controllers\Hooks\Payment\Interface_Payment_Controller;
64 use SeQura\WC\Controllers\Hooks\Payment\Payment_Controller;
65 use SeQura\WC\Controllers\Hooks\Process\Async_Process_Controller;
66 use SeQura\WC\Controllers\Hooks\Process\Interface_Async_Process_Controller;
67 use SeQura\WC\Controllers\Hooks\Settings\Interface_Settings_Controller;
68 use SeQura\WC\Controllers\Hooks\Settings\Settings_Controller;
69 use SeQura\WC\Controllers\Rest\General_Settings_REST_Controller;
70 use SeQura\WC\Controllers\Rest\Log_REST_Controller;
71 use SeQura\WC\Controllers\Rest\Onboarding_REST_Controller;
72 use SeQura\WC\Controllers\Rest\Payment_REST_Controller;
73 use SeQura\WC\Core\Extension\BusinessLogic\Domain\Order\Builders\Interface_Create_Order_Request_Builder;
74 use SeQura\WC\Core\Extension\BusinessLogic\Domain\OrderStatusSettings\Services\Order_Status_Settings_Service;
75 use SeQura\WC\Core\Implementation\BusinessLogic\Domain\Integration\Category\Category_Service;
76 use SeQura\WC\Core\Implementation\BusinessLogic\Domain\Integration\Disconnect\Disconnect_Service;
77 use SeQura\WC\Core\Implementation\BusinessLogic\Domain\Integration\ShopOrderStatuses\Shop_Order_Status_Service;
78 use SeQura\WC\Core\Implementation\BusinessLogic\Domain\Order\Builders\Create_Order_Request_Builder;
79 use SeQura\WC\Core\Implementation\BusinessLogic\Utility\Encryptor;
80 use SeQura\WC\Core\Implementation\BusinessLogic\Webhook\Services\Shop_Order_Service;
81 use SeQura\WC\Core\Implementation\Infrastructure\Logger\Interfaces\Default_Logger_Adapter;
82 use SeQura\WC\Core\Implementation\Infrastructure\Logger\Interfaces\Shop_Logger_Adapter;
83 use SeQura\WC\Core\Implementation\BusinessLogic\Domain\Integration\OrderReport\Order_Report_Service;
84 use SeQura\WC\Repositories\Cache_Repository;
85 use SeQura\WC\Repositories\Entity_Repository;
86 use SeQura\WC\Repositories\Interface_Cache_Repository;
87 use SeQura\WC\Repositories\Migrations\Migration_Install_300;
88 use SeQura\WC\Repositories\Migrations\Migration_Install_320;
89 use SeQura\WC\Repositories\Queue_Item_Repository;
90 use SeQura\WC\Repositories\Repository;
91 use SeQura\WC\Repositories\SeQura_Order_Repository;
92 use SeQura\WC\Services\Cart\Cart_Service;
93 use SeQura\WC\Services\Cart\Interface_Cart_Service;
94 use SeQura\WC\Services\Constants\Constants;
95 use SeQura\WC\Services\Core\Selling_Countries_Service;
96 use SeQura\WC\Services\Core\Store_Service;
97 use SeQura\WC\Services\Core\Version_Service;
98 use SeQura\WC\Services\Shopper\Shopper_Service;
99 use SeQura\WC\Services\Shopper\Interface_Shopper_Service;
100 use SeQura\WC\Services\I18n\I18n;
101 use SeQura\WC\Services\I18n\Interface_I18n;
102 use SeQura\WC\Services\Log\Interface_Log_File;
103 use SeQura\WC\Services\Log\Interface_Logger_Service;
104 use SeQura\WC\Services\Log\Log_File;
105 use SeQura\WC\Services\Log\Logger_Service;
106 use SeQura\WC\Services\Migration\Interface_Migration_Manager;
107 use SeQura\WC\Services\Migration\Migration_Manager;
108 use SeQura\WC\Services\Order\Interface_Order_Service;
109 use SeQura\WC\Services\Order\Order_Service;
110 use SeQura\WC\Services\Payment\Interface_Payment_Method_Service;
111 use SeQura\WC\Services\Payment\Payment_Method_Service;
112 use SeQura\WC\Services\Payment\Sequra_Payment_Gateway_Block_Support;
113 use SeQura\WC\Services\Pricing\Interface_Pricing_Service;
114 use SeQura\WC\Services\Pricing\Pricing_Service;
115 use SeQura\WC\Services\Product\Interface_Product_Service;
116 use SeQura\WC\Services\Product\Product_Service;
117 use SeQura\WC\Services\Report\Interface_Report_Service;
118 use SeQura\WC\Services\Report\Report_Service;
119 use SeQura\WC\Services\Constants\Interface_Constants;
120 use SeQura\WC\Services\Time\Interface_Time_Checker_Service;
121 use SeQura\WC\Services\Time\Time_Checker_Service;
122 use SeQura\Core\BusinessLogic\Domain\Integration\PromotionalWidgets\WidgetConfiguratorInterface;
123 use SeQura\Core\BusinessLogic\Domain\Integration\PromotionalWidgets\MiniWidgetMessagesProviderInterface;
124 use SeQura\Core\BusinessLogic\Domain\Order\Builders\MerchantOrderRequestBuilder;
125 use SeQura\Core\BusinessLogic\Domain\Order\Service\OrderService;
126 use SeQura\Core\Infrastructure\Configuration\Configuration;
127 use SeQura\Core\Infrastructure\Utility\RegexProvider;
128 use SeQura\WC\Core\Implementation\BusinessLogic\Domain\Integration\Order\Merchant_Data_Provider;
129 use SeQura\WC\Core\Implementation\BusinessLogic\Domain\Integration\Order\Order_Creation;
130 use SeQura\WC\Core\Implementation\BusinessLogic\Domain\Integration\Product\Product_Service as Core_Product_Service;
131 use SeQura\WC\Core\Implementation\BusinessLogic\Domain\Integration\PromotionalWidgets\Mini_Widget_Messages_Provider;
132 use SeQura\WC\Core\Implementation\BusinessLogic\Domain\Integration\PromotionalWidgets\Widget_Configurator;
133 use SeQura\WC\Repositories\Migrations\Migration_Install_400;
134 use SeQura\WC\Repositories\Migrations\Migration_Install_420;
135 use SeQura\WC\Services\Order\Current_Order_Provider;
136 use SeQura\WC\Services\Order\Interface_Current_Order_Provider;
137 use SeQura\WC\Services\Platform\Interface_Platform_Provider;
138 use SeQura\WC\Services\Platform\Platform_Provider;
139 use SeQura\WC\Services\Widgets\Interface_Widgets_Service;
140 use SeQura\WC\Services\Widgets\Widgets_Service;
141 use SeQura\Core\BusinessLogic\Domain\Integration\Store\StoreIdProvider;
142 use SeQura\Core\BusinessLogic\Domain\Integration\StoreIntegration\StoreIntegrationServiceInterface;
143 use SeQura\Core\Infrastructure\Configuration\ConfigurationManager;
144 use SeQura\WC\Controllers\Rest\Store_Integration_REST_Controller;
145 use SeQura\WC\Core\Extension\BusinessLogic\Domain\Integration\Store\Store_Id_Provider;
146 use SeQura\WC\Core\Implementation\BusinessLogic\Domain\Integration\StoreIntegration\Store_Integration_Service;
147 use SeQura\WC\Services\Order\Builder\Interface_Order_Address_Builder;
148 use SeQura\WC\Services\Order\Builder\Order_Address_Builder;
149 use SeQura\WC\Services\Order\Builder\Interface_Order_Customer_Builder;
150 use SeQura\WC\Services\Order\Builder\Interface_Order_Delivery_Method_Builder;
151 use SeQura\WC\Services\Order\Builder\Order_Customer_Builder;
152 use SeQura\WC\Services\Order\Builder\Order_Delivery_Method_Builder;
153 use SeQura\WC\Services\Service\Interface_Settings_Service;
154 use SeQura\WC\Services\Service\Settings_Service;
155 use SeQura\Core\BusinessLogic\DataAccess\StoreIntegration\Entities\StoreIntegration;
156 use SeQura\Core\BusinessLogic\Domain\Integration\StoreInfo\StoreInfoServiceInterface;
157 use SeQura\WC\Core\Implementation\BusinessLogic\Domain\Integration\StoreInfo\Store_Info_Service;
158 use SeQura\Core\BusinessLogic\DataAccess\AdvancedSettings\Entities\AdvancedSettings;
159 use SeQura\Core\BusinessLogic\Domain\AdvancedSettings\Services\AdvancedSettingsService;
160 use SeQura\Core\BusinessLogic\Domain\Integration\Log\LogServiceInterface;
161 use SeQura\WC\Core\Implementation\BusinessLogic\Domain\Integration\Log\Log_Service;
162
163 /**
164 * Implementation for the core bootstrap class.
165 */
166 class Bootstrap extends BootstrapComponent {
167
168
169 /**
170 * Cache for Service instances.
171 *
172 * @var array<string, mixed>
173 */
174 private static $cache = array();
175
176 /**
177 * Initialize the bootstrap.
178 */
179 public static function init(): void {
180 self::initConstants();
181 parent::init();
182
183 Reg::registerService(
184 Plugin::class,
185 static function () {
186 return new Plugin(
187 Reg::getService( Interface_Constants::class ),
188 Reg::getService( Interface_Migration_Manager::class ),
189 Reg::getService( Interface_I18n_Controller::class ),
190 Reg::getService( Interface_Assets_Controller::class ),
191 Reg::getService( Interface_Settings_Controller::class ),
192 Reg::getService( Interface_Payment_Controller::class ),
193 Reg::getService( General_Settings_REST_Controller::class ),
194 Reg::getService( Onboarding_REST_Controller::class ),
195 Reg::getService( Payment_REST_Controller::class ),
196 Reg::getService( Log_REST_Controller::class ),
197 Reg::getService( Store_Integration_REST_Controller::class ),
198 Reg::getService( Interface_Product_Controller::class ),
199 Reg::getService( Interface_Async_Process_Controller::class ),
200 Reg::getService( Interface_Order_Controller::class )
201 );
202 }
203 );
204 }
205
206 /**
207 * Initializes constants.
208 */
209 public static function initConstants(): void {
210 Reg::registerService(
211 Interface_Constants::class,
212 static function () {
213
214 if ( ! isset( self::$cache[ Interface_Constants::class ] ) ) {
215 $dir_path = \trailingslashit( dirname( __DIR__, 1 ) );
216 $plugin_file_path = $dir_path . 'sequra.php';
217
218 if ( ! function_exists( 'get_plugin_data' ) ) {
219 require_once ABSPATH . 'wp-admin/includes/plugin.php';
220 }
221 $add_wc_headers = function ( $headers ) {
222 $headers['WC requires at least'] = 'WC requires at least';
223 return $headers;
224 };
225 \add_filter( 'extra_plugin_headers', $add_wc_headers );
226 $data = \get_plugin_data( $plugin_file_path, true, false );
227 \remove_filter( 'extra_plugin_headers', $add_wc_headers );
228 $data['RequiresWC'] = $data['WC requires at least'];
229 unset( $data['WC requires at least'] );
230
231 /**
232 * Database instance.
233 *
234 * @var \wpdb $wpdb
235 */
236 $wpdb = Reg::getService( \wpdb::class );
237 global $wp_version;
238
239 $environment_data = array(
240 'php_version' => phpversion(),
241 'php_os' => PHP_OS,
242 'uname' => php_uname(),
243 'db_name' => false === strpos( strtolower( $wpdb->db_server_info() ), 'mariadb' ) ? 'mysql' : 'mariadb',
244 'db_version' => $wpdb->db_version() ?? '',
245 'wp_version' => strval( $wp_version ),
246 );
247
248 $dir_url = \plugin_dir_url( $plugin_file_path );
249
250 self::$cache[ Interface_Constants::class ] = new Constants(
251 $dir_path,
252 $plugin_file_path,
253 $dir_path . 'sequra.{storeId}.log',
254 \plugin_basename( $plugin_file_path ),
255 $dir_url,
256 'sequra/v1',
257 $data,
258 \get_plugin_data( WP_PLUGIN_DIR . '/woocommerce/woocommerce.php', true, false ),
259 $environment_data,
260 $dir_path . 'templates/',
261 $dir_path . 'assets',
262 \untrailingslashit( $dir_url ) . '/assets'
263 );
264 }
265
266 return self::$cache[ Interface_Constants::class ];
267 }
268 );
269 }
270
271 /**
272 * Get the constants instance.
273 *
274 * @return Interface_Constants
275 * @throws ServiceNotRegisteredException
276 */
277 private static function get_constants() {
278 return Reg::getService( Interface_Constants::class );
279 }
280
281 /**
282 * Initializes services and utilities.
283 */
284 protected static function initServices(): void {
285 parent::initServices();
286
287 // Core Default.
288 Reg::registerService(
289 LoggerConfiguration::class,
290 static function () {
291 if ( ! isset( self::$cache[ LoggerConfiguration::class ] ) ) {
292 $loggerConfig = LoggerConfiguration::getInstance();
293 if ( ! $loggerConfig->isDefaultLoggerEnabled() ) {
294 $loggerConfig->setIsDefaultLoggerEnabled( false );
295 }
296 self::$cache[ LoggerConfiguration::class ] = $loggerConfig;
297 }
298 return self::$cache[ LoggerConfiguration::class ];
299 }
300 );
301
302 // Core Extension.
303 Reg::registerService(
304 Order_Status_Settings_Service::class,
305 static function () {
306 if ( ! isset( self::$cache[ Order_Status_Settings_Service::class ] ) ) {
307 self::$cache[ Order_Status_Settings_Service::class ] = new Order_Status_Settings_Service(
308 Reg::getService( OrderStatusSettingsRepositoryInterface::class ),
309 Reg::getService( ShopOrderStatusesServiceInterface::class )
310 );
311 }
312 return self::$cache[ Order_Status_Settings_Service::class ];
313 }
314 );
315 Reg::registerService(
316 OrderStatusSettingsService::class,
317 static function () {
318 return Reg::getService( Order_Status_Settings_Service::class );
319 }
320 );
321 // Extend Configuration.
322 Reg::registerService(
323 Configuration::class,
324 static function () {
325 if ( ! isset( self::$cache[ Configuration::class ] ) ) {
326 self::$cache[ Configuration::class ] = \SeQura\WC\Core\Extension\Infrastructure\Configuration\Configuration::getInstance();
327 }
328 return self::$cache[ Configuration::class ];
329 }
330 );
331
332 /**
333 * Initialize StoreContext with default store ID so any service that depends on StoreContext
334 * will have the correct store ID set from the beginning. This will reduce the StoreContext::doWithStore
335 * calls to the cases where it's really necessary to set a different store ID.
336 */
337 Reg::registerService(
338 StoreIdProvider::class,
339 static function () {
340 if ( ! isset( self::$cache[ StoreIdProvider::class ] ) ) {
341 self::$cache[ StoreIdProvider::class ] = new Store_Id_Provider();
342 }
343 return self::$cache[ StoreIdProvider::class ];
344 }
345 );
346
347 Reg::registerService(
348 Interface_Create_Order_Request_Builder::class,
349 static function () {
350 if ( ! isset( self::$cache[ Interface_Create_Order_Request_Builder::class ] ) ) {
351 self::$cache[ Interface_Create_Order_Request_Builder::class ] = new Create_Order_Request_Builder(
352 Reg::getService( Interface_Cart_Service::class ),
353 Reg::getService( Interface_Platform_Provider::class ),
354 Reg::getService( Interface_Product_Service::class ),
355 Reg::getService( Interface_Order_Service::class ),
356 Reg::getService( Interface_I18n::class ),
357 Reg::getService( Interface_Shopper_Service::class ),
358 Reg::getService( Interface_Logger_Service::class ),
359 Reg::getService( Interface_Current_Order_Provider::class ),
360 Reg::getService( MerchantOrderRequestBuilder::class ),
361 Reg::getService( Interface_Order_Delivery_Method_Builder::class ),
362 Reg::getService( Interface_Order_Address_Builder::class ),
363 Reg::getService( Interface_Order_Customer_Builder::class ),
364 Reg::getService( CredentialsService::class ),
365 Reg::getService( SeQuraOrderRepositoryInterface::class )
366 );
367 }
368 return self::$cache[ Interface_Create_Order_Request_Builder::class ];
369 }
370 );
371
372 // Core Implementation.
373 Reg::registerService(
374 EncryptorInterface::class,
375 static function () {
376 if ( ! isset( self::$cache[ EncryptorInterface::class ] ) ) {
377 self::$cache[ EncryptorInterface::class ] = new Encryptor();
378 }
379 return self::$cache[ EncryptorInterface::class ];
380 }
381 );
382 Reg::registerService(
383 DisconnectServiceInterface::class,
384 static function () {
385 if ( ! isset( self::$cache[ DisconnectServiceInterface::class ] ) ) {
386 self::$cache[ DisconnectServiceInterface::class ] = new Disconnect_Service(
387 array(
388 RepositoryRegistry::getRepository( ConnectionData::class ),
389 RepositoryRegistry::getRepository( StatisticalData::class ),
390 RepositoryRegistry::getRepository( SendReport::class ),
391 RepositoryRegistry::getRepository( QueueItem::class ),
392 )
393 );
394 }
395 return self::$cache[ DisconnectServiceInterface::class ];
396 }
397 );
398 Reg::registerService(
399 OrderReportServiceInterface::class,
400 static function () {
401 if ( ! isset( self::$cache[ OrderReportServiceInterface::class ] ) ) {
402 self::$cache[ OrderReportServiceInterface::class ] = new Order_Report_Service(
403 Reg::getService( Interface_Platform_Provider::class ),
404 Reg::getService( Interface_Pricing_Service::class ),
405 Reg::getService( Interface_Cart_Service::class ),
406 Reg::getService( Interface_Order_Service::class ),
407 Reg::getService( Interface_I18n::class ),
408 Reg::getService( Interface_Order_Delivery_Method_Builder::class ),
409 Reg::getService( Interface_Order_Address_Builder::class ),
410 Reg::getService( Interface_Order_Customer_Builder::class )
411 );
412 }
413 return self::$cache[ OrderReportServiceInterface::class ];
414 }
415 );
416 Reg::registerService(
417 MerchantDataProviderInterface::class,
418 static function () {
419 if ( ! isset( self::$cache[ MerchantDataProviderInterface::class ] ) ) {
420 self::$cache[ MerchantDataProviderInterface::class ] = new Merchant_Data_Provider(
421 Reg::getService( Interface_Current_Order_Provider::class ),
422 Reg::getService( Interface_Constants::class ),
423 Reg::getService( Interface_Product_Service::class ),
424 Reg::getService( Interface_Cart_Service::class ),
425 Reg::getService( Interface_Shopper_Service::class ),
426 Reg::getService( StoreContext::class )
427 );
428 }
429 return self::$cache[ MerchantDataProviderInterface::class ];
430 }
431 );
432 Reg::registerService(
433 OrderCreationInterface::class,
434 static function () {
435 if ( ! isset( self::$cache[ OrderCreationInterface::class ] ) ) {
436 self::$cache[ OrderCreationInterface::class ] = new Order_Creation();
437 }
438 return self::$cache[ OrderCreationInterface::class ];
439 }
440 );
441
442
443 Reg::registerService(
444 Serializer::class,
445 static function () {
446 if ( ! isset( self::$cache[ Serializer::class ] ) ) {
447 self::$cache[ Serializer::class ] = new JsonSerializer();
448 }
449 return self::$cache[ Serializer::class ];
450 }
451 );
452 Reg::registerService(
453 SellingCountriesServiceInterface::class,
454 static function () {
455 if ( ! isset( self::$cache[ SellingCountriesServiceInterface::class ] ) ) {
456 self::$cache[ SellingCountriesServiceInterface::class ] = new Selling_Countries_Service();
457 }
458 return self::$cache[ SellingCountriesServiceInterface::class ];
459 }
460 );
461 Reg::registerService(
462 StoreServiceInterface::class,
463 static function () {
464 if ( ! isset( self::$cache[ StoreServiceInterface::class ] ) ) {
465 self::$cache[ StoreServiceInterface::class ] = new Store_Service();
466 }
467 return self::$cache[ StoreServiceInterface::class ];
468 }
469 );
470 Reg::registerService(
471 VersionServiceInterface::class,
472 static function () {
473 if ( ! isset( self::$cache[ VersionServiceInterface::class ] ) ) {
474 self::$cache[ VersionServiceInterface::class ] = new Version_Service(
475 self::get_constants()->get_plugin_data()['Version']
476 );
477 }
478 return self::$cache[ VersionServiceInterface::class ];
479 }
480 );
481 Reg::registerService(
482 CategoryServiceInterface::class,
483 static function () {
484 if ( ! isset( self::$cache[ CategoryServiceInterface::class ] ) ) {
485 self::$cache[ CategoryServiceInterface::class ] = new Category_Service();
486 }
487 return self::$cache[ CategoryServiceInterface::class ];
488 }
489 );
490 Reg::registerService(
491 ShopOrderStatusesServiceInterface::class,
492 static function () {
493 if ( ! isset( self::$cache[ ShopOrderStatusesServiceInterface::class ] ) ) {
494 self::$cache[ ShopOrderStatusesServiceInterface::class ] = new Shop_Order_Status_Service();
495 }
496 return self::$cache[ ShopOrderStatusesServiceInterface::class ];
497 }
498 );
499 Reg::registerService(
500 ShopLoggerAdapter::CLASS_NAME,
501 static function () {
502 if ( ! isset( self::$cache[ ShopLoggerAdapter::CLASS_NAME ] ) ) {
503 self::$cache[ ShopLoggerAdapter::CLASS_NAME ] = new Shop_Logger_Adapter();
504 }
505 return self::$cache[ ShopLoggerAdapter::CLASS_NAME ];
506 }
507 );
508 Reg::registerService(
509 DefaultLoggerAdapter::CLASS_NAME,
510 static function () {
511 if ( ! isset( self::$cache[ DefaultLoggerAdapter::CLASS_NAME ] ) ) {
512 self::$cache[ DefaultLoggerAdapter::CLASS_NAME ] = new Default_Logger_Adapter(
513 Reg::getService( Interface_Log_File::class ),
514 Reg::getService( TimeProvider::CLASS_NAME )
515 );
516 }
517 return self::$cache[ DefaultLoggerAdapter::CLASS_NAME ];
518 }
519 );
520
521 Reg::registerService(
522 StoreIntegrationServiceInterface::class,
523 static function () {
524 if ( ! isset( self::$cache[ StoreIntegrationServiceInterface::class ] ) ) {
525 self::$cache[ StoreIntegrationServiceInterface::class ] = new Store_Integration_Service();
526 }
527 return self::$cache[ StoreIntegrationServiceInterface::class ];
528 }
529 );
530
531 // Plugin services.
532 Reg::registerService(
533 Interface_Log_File::class,
534 static function () {
535 if ( ! isset( self::$cache[ Interface_Log_File::class ] ) ) {
536 self::$cache[ Interface_Log_File::class ] = new Log_File(
537 self::get_constants()->get_plugin_log_file_path(),
538 Reg::getService( StoreContext::class )
539 );
540 }
541 return self::$cache[ Interface_Log_File::class ];
542 }
543 );
544 Reg::registerService(
545 Interface_Migration_Manager::class,
546 static function () {
547 if ( ! isset( self::$cache[ Interface_Migration_Manager::class ] ) ) {
548 $configuration = Reg::getService( ConfigurationManager::CLASS_NAME );
549 $wpdb = Reg::getService( \wpdb::class );
550 /**
551 * Order repository.
552 *
553 * @var Repository $order_repository
554 */
555 $order_repository = RepositoryRegistry::getRepository( SeQuraOrder::class );
556 /**
557 * Entity repository.
558 *
559 * @var Repository $entity_repository
560 */
561 $entity_repository = RepositoryRegistry::getRepository( ConfigEntity::class );
562
563 /**
564 * Queue item repository.
565 *
566 * @var Repository $queue_item_repository
567 */
568 $queue_item_repository = RepositoryRegistry::getRepository( QueueItem::class );
569 /**
570 * Encryptor service.
571 *
572 * @var EncryptorInterface $encryptor
573 */
574 $encryptor = Reg::getService( EncryptorInterface::class );
575
576 /**
577 * Store context service.
578 *
579 * @var StoreContext $store_context
580 */
581 $store_context = Reg::getService( StoreContext::class );
582
583 /**
584 * Cache repository.
585 *
586 * @var Interface_Cache_Repository $cache_repository
587 */
588 $cache_repository = Reg::getService( Interface_Cache_Repository::class );
589
590 self::$cache[ Interface_Migration_Manager::class ] = new Migration_Manager(
591 self::get_constants()->get_plugin_basename(),
592 $configuration,
593 self::get_constants()->get_plugin_data()['Version'],
594 array(
595 new Migration_Install_300(
596 $wpdb,
597 $cache_repository,
598 $order_repository,
599 $entity_repository,
600 $queue_item_repository,
601 $store_context
602 ),
603 new Migration_Install_320(
604 $wpdb,
605 $cache_repository,
606 self::get_constants()->get_hook_add_order_indexes(),
607 $entity_repository,
608 $queue_item_repository
609 ),
610 new Migration_Install_400(
611 $wpdb,
612 $cache_repository,
613 $encryptor,
614 $store_context
615 ),
616 new Migration_Install_420(
617 $wpdb,
618 $cache_repository,
619 Reg::getService( AdvancedSettingsService::class ),
620 Reg::getService( Order_Status_Settings_Service::class )
621 ),
622 )
623 );
624 }
625 return self::$cache[ Interface_Migration_Manager::class ];
626 }
627 );
628 Reg::registerService(
629 Interface_I18n::class,
630 static function () {
631 if ( ! isset( self::$cache[ Interface_I18n::class ] ) ) {
632 self::$cache[ Interface_I18n::class ] = new I18n();
633 }
634 return self::$cache[ Interface_I18n::class ];
635 }
636 );
637 Reg::registerService(
638 Interface_Report_Service::class,
639 static function () {
640 if ( ! isset( self::$cache[ Interface_Report_Service::class ] ) ) {
641 self::$cache[ Interface_Report_Service::class ] = new Report_Service(
642 Reg::getService( ShopOrderService::class ),
643 Reg::getService( StatisticalDataRepositoryInterface::class ),
644 Reg::getService( CountryConfigurationRepositoryInterface::class ),
645 Reg::getService( Interface_Order_Service::class )
646 );
647 }
648 return self::$cache[ Interface_Report_Service::class ];
649 }
650 );
651 Reg::registerService(
652 Interface_Logger_Service::class,
653 static function () {
654 if ( ! isset( self::$cache[ Interface_Logger_Service::class ] ) ) {
655 self::$cache[ Interface_Logger_Service::class ] = new Logger_Service(
656 Reg::getService( LoggerConfiguration::class ),
657 Reg::getService( Interface_Log_File::class )
658 );
659 }
660 return self::$cache[ Interface_Logger_Service::class ];
661 }
662 );
663
664 Reg::registerService(
665 Sequra_Payment_Gateway_Block_Support::class,
666 static function () {
667 if ( ! isset( self::$cache[ Sequra_Payment_Gateway_Block_Support::class ] ) ) {
668 self::$cache[ Sequra_Payment_Gateway_Block_Support::class ] = new Sequra_Payment_Gateway_Block_Support(
669 self::get_constants()->get_plugin_assets_path(),
670 self::get_constants()->get_plugin_assets_url(),
671 self::get_constants()->get_plugin_data()['Version']
672 );
673 }
674 return self::$cache[ Sequra_Payment_Gateway_Block_Support::class ];
675 }
676 );
677 Reg::registerService(
678 Interface_Pricing_Service::class,
679 static function () {
680 if ( ! isset( self::$cache[ Interface_Pricing_Service::class ] ) ) {
681 self::$cache[ Interface_Pricing_Service::class ] = new Pricing_Service();
682 }
683 return self::$cache[ Interface_Pricing_Service::class ];
684 }
685 );
686 Reg::registerService(
687 Interface_Order_Service::class,
688 static function () {
689 if ( ! isset( self::$cache[ Interface_Order_Service::class ] ) ) {
690 /**
691 * This will return SeQura_Order_Repository that implements Interface_Deletable_Repository and Interface_Table_Migration_Repository.
692 *
693 * @var SeQura_Order_Repository $repository
694 */
695 $repository = RepositoryRegistry::getRepository( SeQuraOrder::class );
696
697 self::$cache[ Interface_Order_Service::class ] = new Order_Service(
698 Reg::getService( SeQuraOrderRepositoryInterface::class ),
699 Reg::getService( Interface_Pricing_Service::class ),
700 Reg::getService( OrderStatusSettingsService::class ),
701 Reg::getService( Interface_Cart_Service::class ),
702 Reg::getService( Interface_Logger_Service::class ),
703 Reg::getService( Interface_Time_Checker_Service::class ),
704 $repository,
705 $repository,
706 self::get_constants()->get_payment_gateway_id(),
707 Reg::getService( ConnectionService::class ),
708 Reg::getService( OrderService::class )
709 );
710 }
711 return self::$cache[ Interface_Order_Service::class ];
712 }
713 );
714 Reg::registerService(
715 Interface_Cart_Service::class,
716 static function () {
717 if ( ! isset( self::$cache[ Interface_Cart_Service::class ] ) ) {
718 self::$cache[ Interface_Cart_Service::class ] = new Cart_Service(
719 Reg::getService( Interface_Product_Service::class ),
720 Reg::getService( Interface_Pricing_Service::class ),
721 Reg::getService( Interface_Logger_Service::class ),
722 Reg::getService( Interface_Shopper_Service::class )
723 );
724 }
725 return self::$cache[ Interface_Cart_Service::class ];
726 }
727 );
728 Reg::registerService(
729 Interface_Product_Service::class,
730 static function () {
731 if ( ! isset( self::$cache[ Interface_Product_Service::class ] ) ) {
732 self::$cache[ Interface_Product_Service::class ] = new Product_Service(
733 Reg::getService( Interface_Pricing_Service::class ),
734 Reg::getService( RegexProvider::class ),
735 Reg::getService( StoreContext::class )
736 );
737 }
738 return self::$cache[ Interface_Product_Service::class ];
739 }
740 );
741 Reg::registerService(
742 Interface_Shopper_Service::class,
743 static function () {
744 if ( ! isset( self::$cache[ Interface_Shopper_Service::class ] ) ) {
745 self::$cache[ Interface_Shopper_Service::class ] = new Shopper_Service(
746 Reg::getService( StoreContext::class )
747 );
748 }
749 return self::$cache[ Interface_Shopper_Service::class ];
750 }
751 );
752 Reg::registerService(
753 ShopOrderService::class,
754 static function () {
755 if ( ! isset( self::$cache[ ShopOrderService::class ] ) ) {
756 self::$cache[ ShopOrderService::class ] = new Shop_Order_Service(
757 Reg::getService( SeQuraOrderRepositoryInterface::class ),
758 Reg::getService( Interface_Logger_Service::class ),
759 Reg::getService( Interface_Create_Order_Request_Builder::class ),
760 Reg::getService( Interface_Current_Order_Provider::class ),
761 Reg::getService( OrderService::class )
762 );
763 }
764 return self::$cache[ ShopOrderService::class ];
765 }
766 );
767 Reg::registerService(
768 Interface_Time_Checker_Service::class,
769 static function () {
770 if ( ! isset( self::$cache[ Interface_Time_Checker_Service::class ] ) ) {
771 self::$cache[ Interface_Time_Checker_Service::class ] = new Time_Checker_Service();
772 }
773 return self::$cache[ Interface_Time_Checker_Service::class ];
774 }
775 );
776
777 Reg::registerService(
778 ProductServiceInterface::class,
779 static function () {
780 if ( ! isset( self::$cache[ ProductServiceInterface::class ] ) ) {
781 self::$cache[ ProductServiceInterface::class ] = new Core_Product_Service( Reg::getService( \wpdb::class ) );
782 }
783 return self::$cache[ ProductServiceInterface::class ];
784 }
785 );
786 Reg::registerService(
787 WidgetConfiguratorInterface::class,
788 static function () {
789 if ( ! isset( self::$cache[ WidgetConfiguratorInterface::class ] ) ) {
790 self::$cache[ WidgetConfiguratorInterface::class ] = new Widget_Configurator(
791 Reg::getService( Interface_I18n::class )
792 );
793 }
794 return self::$cache[ WidgetConfiguratorInterface::class ];
795 }
796 );
797
798 Reg::registerService(
799 MiniWidgetMessagesProviderInterface::class,
800 static function () {
801 if ( ! isset( self::$cache[ MiniWidgetMessagesProviderInterface::class ] ) ) {
802 self::$cache[ MiniWidgetMessagesProviderInterface::class ] = new Mini_Widget_Messages_Provider(
803 Reg::getService( Interface_I18n::class )
804 );
805 }
806 return self::$cache[ MiniWidgetMessagesProviderInterface::class ];
807 }
808 );
809
810 Reg::registerService(
811 Interface_Current_Order_Provider::class,
812 static function () {
813 if ( ! isset( self::$cache[ Interface_Current_Order_Provider::class ] ) ) {
814 self::$cache[ Interface_Current_Order_Provider::class ] = new Current_Order_Provider();
815 }
816 return self::$cache[ Interface_Current_Order_Provider::class ];
817 }
818 );
819
820 Reg::registerService(
821 Interface_Platform_Provider::class,
822 static function () {
823 if ( ! isset( self::$cache[ Interface_Platform_Provider::class ] ) ) {
824 self::$cache[ Interface_Platform_Provider::class ] = new Platform_Provider(
825 Reg::getService( Interface_Constants::class )
826 );
827 }
828 return self::$cache[ Interface_Platform_Provider::class ];
829 }
830 );
831
832 Reg::registerService(
833 Interface_Payment_Method_Service::class,
834 static function () {
835 if ( ! isset( self::$cache[ Interface_Payment_Method_Service::class ] ) ) {
836 self::$cache[ Interface_Payment_Method_Service::class ] = new Payment_Method_Service(
837 Reg::getService( Interface_Create_Order_Request_Builder::class ),
838 Reg::getService( Interface_Order_Service::class ),
839 Reg::getService( Interface_Logger_Service::class ),
840 Reg::getService( Interface_Current_Order_Provider::class ),
841 Reg::getService( StoreContext::class )
842 );
843 }
844 return self::$cache[ Interface_Payment_Method_Service::class ];
845 }
846 );
847
848 Reg::registerService(
849 Interface_Widgets_Service::class,
850 static function () {
851 if ( ! isset( self::$cache[ Interface_Widgets_Service::class ] ) ) {
852 self::$cache[ Interface_Widgets_Service::class ] = new Widgets_Service(
853 Reg::getService( Interface_Logger_Service::class ),
854 Reg::getService( Interface_I18n::class ),
855 Reg::getService( Interface_Shopper_Service::class ),
856 Reg::getService( WidgetConfiguratorInterface::class ),
857 Reg::getService( StoreContext::class )
858 );
859 }
860 return self::$cache[ Interface_Widgets_Service::class ];
861 }
862 );
863 Reg::registerService(
864 Interface_Settings_Service::class,
865 static function () {
866 if ( ! isset( self::$cache[ Interface_Settings_Service::class ] ) ) {
867 self::$cache[ Interface_Settings_Service::class ] = new Settings_Service();
868 }
869 return self::$cache[ Interface_Settings_Service::class ];
870 }
871 );
872 Reg::registerService(
873 Interface_Order_Address_Builder::class,
874 static function () {
875 if ( ! isset( self::$cache[ Interface_Order_Address_Builder::class ] ) ) {
876 self::$cache[ Interface_Order_Address_Builder::class ] = new Order_Address_Builder(
877 Reg::getService( Interface_Shopper_Service::class )
878 );
879 }
880 return self::$cache[ Interface_Order_Address_Builder::class ];
881 }
882 );
883 Reg::registerService(
884 Interface_Order_Customer_Builder::class,
885 static function () {
886 if ( ! isset( self::$cache[ Interface_Order_Customer_Builder::class ] ) ) {
887 self::$cache[ Interface_Order_Customer_Builder::class ] = new Order_Customer_Builder(
888 Reg::getService( Interface_Shopper_Service::class ),
889 Reg::getService( OrderStatusSettingsService::class ),
890 Reg::getService( Interface_Pricing_Service::class )
891 );
892 }
893 return self::$cache[ Interface_Order_Customer_Builder::class ];
894 }
895 );
896 Reg::registerService(
897 Interface_Order_Delivery_Method_Builder::class,
898 static function () {
899 if ( ! isset( self::$cache[ Interface_Order_Delivery_Method_Builder::class ] ) ) {
900 self::$cache[ Interface_Order_Delivery_Method_Builder::class ] = new Order_Delivery_Method_Builder();
901 }
902 return self::$cache[ Interface_Order_Delivery_Method_Builder::class ];
903 }
904 );
905 Reg::registerService(
906 StoreInfoServiceInterface::class,
907 static function () {
908 if ( ! isset( self::$cache[ StoreInfoServiceInterface::class ] ) ) {
909 self::$cache[ StoreInfoServiceInterface::class ] = new Store_Info_Service(
910 Reg::getService( Interface_Platform_Provider::class )
911 );
912 }
913 return self::$cache[ StoreInfoServiceInterface::class ];
914 }
915 );
916 Reg::registerService(
917 LogServiceInterface::class,
918 static function () {
919 if ( ! isset( self::$cache[ LogServiceInterface::class ] ) ) {
920 self::$cache[ LogServiceInterface::class ] = new Log_Service(
921 Reg::getService( Interface_Logger_Service::class ),
922 Reg::getService( StoreContext::class )
923 );
924 }
925 return self::$cache[ LogServiceInterface::class ];
926 }
927 );
928 }
929
930 /**
931 * Initializes repositories.
932 */
933 protected static function initRepositories(): void {
934
935 Reg::registerService(
936 \wpdb::class,
937 static function () {
938 if ( ! isset( self::$cache[ \wpdb::class ] ) ) {
939 global $wpdb;
940 self::$cache[ \wpdb::class ] = $wpdb;
941 }
942 return self::$cache[ \wpdb::class ];
943 }
944 );
945
946 Reg::registerService(
947 Interface_Cache_Repository::class,
948 static function () {
949 if ( ! isset( self::$cache[ Interface_Cache_Repository::class ] ) ) {
950 self::$cache[ Interface_Cache_Repository::class ] = new Cache_Repository();
951 }
952 return self::$cache[ Interface_Cache_Repository::class ];
953 }
954 );
955
956 parent::initRepositories();
957
958 RepositoryRegistry::registerRepository( ConfigEntity::class, Entity_Repository::class );
959 RepositoryRegistry::registerRepository( QueueItem::class, Queue_Item_Repository::class );
960 RepositoryRegistry::registerRepository( Process::class, Entity_Repository::class );
961 RepositoryRegistry::registerRepository( ConnectionData::class, Entity_Repository::class );
962 RepositoryRegistry::registerRepository( OrderStatusSettings::class, Entity_Repository::class );
963 RepositoryRegistry::registerRepository( StatisticalData::class, Entity_Repository::class );
964 RepositoryRegistry::registerRepository( CountryConfiguration::class, Entity_Repository::class );
965 RepositoryRegistry::registerRepository( GeneralSettings::class, Entity_Repository::class );
966 RepositoryRegistry::registerRepository( SeQuraOrder::class, SeQura_Order_Repository::class );
967 RepositoryRegistry::registerRepository( WidgetSettings::class, Entity_Repository::class );
968 RepositoryRegistry::registerRepository( SendReport::class, Entity_Repository::class );
969 RepositoryRegistry::registerRepository( TransactionLog::class, Entity_Repository::class );
970 RepositoryRegistry::registerRepository( PaymentMethod::class, Entity_Repository::class );
971 RepositoryRegistry::registerRepository( Credentials::class, Entity_Repository::class );
972 RepositoryRegistry::registerRepository( Deployment::class, Entity_Repository::class );
973 RepositoryRegistry::registerRepository( StoreIntegration::class, Entity_Repository::class );
974 RepositoryRegistry::registerRepository( AdvancedSettings::class, Entity_Repository::class );
975 }
976
977 /**
978 * Initializes controllers.
979 */
980 protected static function initControllers(): void {
981 parent::initControllers();
982
983 // Plugin controllers.
984 Reg::registerService(
985 Interface_I18n_Controller::class,
986 static function () {
987 if ( ! isset( self::$cache[ Interface_I18n_Controller::class ] ) ) {
988 $data = self::get_constants()->get_plugin_data();
989 $domain = $data['TextDomain'];
990 self::$cache[ Interface_I18n_Controller::class ] = new I18n_Controller(
991 $domain . $data['DomainPath'],
992 $domain,
993 Reg::getService( Interface_Logger_Service::class ),
994 self::get_constants()->get_plugin_templates_path()
995 );
996 }
997 return self::$cache[ Interface_I18n_Controller::class ];
998 }
999 );
1000 Reg::registerService(
1001 Interface_Assets_Controller::class,
1002 static function () {
1003 if ( ! isset( self::$cache[ Interface_Assets_Controller::class ] ) ) {
1004 $env_data = self::get_constants()->get_environment_data();
1005 self::$cache[ Interface_Assets_Controller::class ] = new Assets_Controller(
1006 self::get_constants()->get_plugin_assets_url(),
1007 self::get_constants()->get_plugin_assets_path(),
1008 self::get_constants()->get_plugin_data()['Version'],
1009 $env_data['wp_version'] ?? '',
1010 Reg::getService( Interface_I18n::class ),
1011 Reg::getService( Interface_Logger_Service::class ),
1012 self::get_constants()->get_plugin_templates_path(),
1013 Reg::getService( Interface_Settings_Service::class ),
1014 Reg::getService( Interface_Payment_Method_Service::class ),
1015 Reg::getService( RegexProvider::class ),
1016 Reg::getService( Interface_Widgets_Service::class )
1017 );
1018 }
1019 return self::$cache[ Interface_Assets_Controller::class ];
1020 }
1021 );
1022 Reg::registerService(
1023 Interface_Settings_Controller::class,
1024 static function () {
1025 if ( ! isset( self::$cache[ Interface_Settings_Controller::class ] ) ) {
1026 self::$cache[ Interface_Settings_Controller::class ] = new Settings_Controller(
1027 self::get_constants()->get_plugin_templates_path(),
1028 Reg::getService( Interface_Settings_Service::class ),
1029 Reg::getService( Interface_Logger_Service::class ),
1030 self::get_constants()->get_plugin_basename()
1031 );
1032 }
1033 return self::$cache[ Interface_Settings_Controller::class ];
1034 }
1035 );
1036 Reg::registerService(
1037 Interface_Payment_Controller::class,
1038 static function () {
1039 if ( ! isset( self::$cache[ Interface_Payment_Controller::class ] ) ) {
1040 self::$cache[ Interface_Payment_Controller::class ] = new Payment_Controller(
1041 Reg::getService( Interface_Logger_Service::class ),
1042 self::get_constants()->get_plugin_templates_path(),
1043 Reg::getService( Interface_Order_Service::class )
1044 );
1045 }
1046 return self::$cache[ Interface_Payment_Controller::class ];
1047 }
1048 );
1049 Reg::registerService(
1050 Interface_Product_Controller::class,
1051 static function () {
1052 if ( ! isset( self::$cache[ Interface_Product_Controller::class ] ) ) {
1053 self::$cache[ Interface_Product_Controller::class ] = new Product_Controller(
1054 Reg::getService( Interface_Logger_Service::class ),
1055 self::get_constants()->get_plugin_templates_path(),
1056 Reg::getService( Interface_Product_Service::class ),
1057 Reg::getService( RegexProvider::class ),
1058 Reg::getService( Interface_Widgets_Service::class )
1059 );
1060 }
1061 return self::$cache[ Interface_Product_Controller::class ];
1062 }
1063 );
1064 Reg::registerService(
1065 Interface_Async_Process_Controller::class,
1066 static function () {
1067 if ( ! isset( self::$cache[ Interface_Async_Process_Controller::class ] ) ) {
1068 self::$cache[ Interface_Async_Process_Controller::class ] = new Async_Process_Controller(
1069 Reg::getService( Interface_Logger_Service::class ),
1070 self::get_constants()->get_plugin_templates_path(),
1071 Reg::getService( Interface_Report_Service::class )
1072 );
1073 }
1074 return self::$cache[ Interface_Async_Process_Controller::class ];
1075 }
1076 );
1077 Reg::registerService(
1078 Interface_Order_Controller::class,
1079 static function () {
1080 if ( ! isset( self::$cache[ Interface_Order_Controller::class ] ) ) {
1081 self::$cache[ Interface_Order_Controller::class ] = new Order_Controller(
1082 Reg::getService( Interface_Logger_Service::class ),
1083 self::get_constants()->get_plugin_templates_path(),
1084 Reg::getService( Interface_Order_Service::class ),
1085 Reg::getService( Interface_Cart_Service::class )
1086 );
1087 }
1088 return self::$cache[ Interface_Order_Controller::class ];
1089 }
1090 );
1091 Reg::registerService(
1092 Onboarding_REST_Controller::class,
1093 static function () {
1094 if ( ! isset( self::$cache[ Onboarding_REST_Controller::class ] ) ) {
1095 self::$cache[ Onboarding_REST_Controller::class ] = new Onboarding_REST_Controller(
1096 self::get_constants()->get_plugin_rest_namespace(),
1097 Reg::getService( Interface_Logger_Service::class ),
1098 Reg::getService( RegexProvider::class )
1099 );
1100 }
1101 return self::$cache[ Onboarding_REST_Controller::class ];
1102 }
1103 );
1104 Reg::registerService(
1105 Payment_REST_Controller::class,
1106 static function () {
1107 if ( ! isset( self::$cache[ Payment_REST_Controller::class ] ) ) {
1108 self::$cache[ Payment_REST_Controller::class ] = new Payment_REST_Controller(
1109 self::get_constants()->get_plugin_rest_namespace(),
1110 Reg::getService( Interface_Logger_Service::class ),
1111 Reg::getService( RegexProvider::class )
1112 );
1113 }
1114 return self::$cache[ Payment_REST_Controller::class ];
1115 }
1116 );
1117 Reg::registerService(
1118 General_Settings_REST_Controller::class,
1119 static function () {
1120 if ( ! isset( self::$cache[ General_Settings_REST_Controller::class ] ) ) {
1121 self::$cache[ General_Settings_REST_Controller::class ] = new General_Settings_REST_Controller(
1122 self::get_constants()->get_plugin_rest_namespace(),
1123 Reg::getService( Interface_Logger_Service::class ),
1124 Reg::getService( RegexProvider::class ),
1125 Reg::getService( StoreContext::class )
1126 );
1127 }
1128 return self::$cache[ General_Settings_REST_Controller::class ];
1129 }
1130 );
1131 Reg::registerService(
1132 Log_REST_Controller::class,
1133 static function () {
1134 if ( ! isset( self::$cache[ Log_REST_Controller::class ] ) ) {
1135 self::$cache[ Log_REST_Controller::class ] = new Log_REST_Controller(
1136 self::get_constants()->get_plugin_rest_namespace(),
1137 Reg::getService( Interface_Logger_Service::class ),
1138 Reg::getService( RegexProvider::class ),
1139 Reg::getService( AdvancedSettingsService::class )
1140 );
1141 }
1142 return self::$cache[ Log_REST_Controller::class ];
1143 }
1144 );
1145 Reg::registerService(
1146 Store_Integration_REST_Controller::class,
1147 static function () {
1148 if ( ! isset( self::$cache[ Store_Integration_REST_Controller::class ] ) ) {
1149 self::$cache[ Store_Integration_REST_Controller::class ] = new Store_Integration_REST_Controller(
1150 self::get_constants()->get_plugin_rest_namespace(),
1151 Reg::getService( Interface_Logger_Service::class ),
1152 Reg::getService( RegexProvider::class ),
1153 Reg::getService( StoreIntegrationServiceInterface::class ),
1154 Reg::getService( StoreContext::class )
1155 );
1156 }
1157 return self::$cache[ Store_Integration_REST_Controller::class ];
1158 }
1159 );
1160 }
1161 }
1162