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