PluginProbe
seQura / trunk
seQura vtrunk
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 trunk, at src/class-bootstrap.php

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