| @@ -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,30 +14,31 @@ | ||
| 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; |
| 45 | 44 | use SeQura\Core\Infrastructure\Exceptions\ServiceNotRegisteredException; |
| @@ -70,12 +69,10 @@ | ||
| 70 | 69 | use SeQura\WC\Controllers\Rest\General_Settings_REST_Controller; |
| 71 | 70 | use SeQura\WC\Controllers\Rest\Log_REST_Controller; |
| 72 | 71 | use SeQura\WC\Controllers\Rest\Onboarding_REST_Controller; |
| 73 | 72 | use SeQura\WC\Controllers\Rest\Payment_REST_Controller; |
| 74 | -use SeQura\WC\Core\BusinessLogic\Domain\Order\Models\OrderRequest\Item\Item_Factory; | |
| 75 | 73 | use SeQura\WC\Core\Extension\BusinessLogic\Domain\Order\Builders\Interface_Create_Order_Request_Builder; |
| 76 | 74 | use SeQura\WC\Core\Extension\BusinessLogic\Domain\OrderStatusSettings\Services\Order_Status_Settings_Service; |
| 77 | -use SeQura\WC\Core\Extension\Infrastructure\Configuration\Configuration; | |
| 78 | 75 | use SeQura\WC\Core\Implementation\BusinessLogic\Domain\Integration\Category\Category_Service; |
| 79 | 76 | use SeQura\WC\Core\Implementation\BusinessLogic\Domain\Integration\Disconnect\Disconnect_Service; |
| 80 | 77 | use SeQura\WC\Core\Implementation\BusinessLogic\Domain\Integration\ShopOrderStatuses\Shop_Order_Status_Service; |
| 81 | 78 | use SeQura\WC\Core\Implementation\BusinessLogic\Domain\Order\Builders\Create_Order_Request_Builder; |
| @@ -82,24 +79,20 @@ | ||
| 82 | 79 | use SeQura\WC\Core\Implementation\BusinessLogic\Utility\Encryptor; |
| 83 | 80 | use SeQura\WC\Core\Implementation\BusinessLogic\Webhook\Services\Shop_Order_Service; |
| 84 | 81 | use SeQura\WC\Core\Implementation\Infrastructure\Logger\Interfaces\Default_Logger_Adapter; |
| 85 | 82 | use SeQura\WC\Core\Implementation\Infrastructure\Logger\Interfaces\Shop_Logger_Adapter; |
| 86 | -use SeQura\WC\Core\Extension\BusinessLogic\AdminAPI\GeneralSettings\General_Settings_Controller; | |
| 87 | -use SeQura\WC\Core\Extension\BusinessLogic\AdminAPI\PromotionalWidgets\Promotional_Widgets_Controller; | |
| 88 | -use SeQura\WC\Core\Extension\BusinessLogic\DataAccess\GeneralSettings\Repositories\General_Settings_Repository; | |
| 89 | -use SeQura\WC\Core\Extension\BusinessLogic\DataAccess\PaymentMethods\Entities\Payment_Methods; | |
| 90 | -use SeQura\WC\Core\Extension\BusinessLogic\DataAccess\PromotionalWidgets\Repositories\Widget_Settings_Repository; | |
| 91 | 83 | use SeQura\WC\Core\Implementation\BusinessLogic\Domain\Integration\OrderReport\Order_Report_Service; |
| 84 | +use SeQura\WC\Repositories\Cache_Repository; | |
| 92 | 85 | use SeQura\WC\Repositories\Entity_Repository; |
| 93 | -use SeQura\WC\Repositories\Interface_Deletable_Repository; | |
| 86 | +use SeQura\WC\Repositories\Interface_Cache_Repository; | |
| 94 | 87 | use SeQura\WC\Repositories\Migrations\Migration_Install_300; |
| 88 | +use SeQura\WC\Repositories\Migrations\Migration_Install_320; | |
| 95 | 89 | use SeQura\WC\Repositories\Queue_Item_Repository; |
| 90 | +use SeQura\WC\Repositories\Repository; | |
| 96 | 91 | use SeQura\WC\Repositories\SeQura_Order_Repository; |
| 97 | -use SeQura\WC\Services\Assets\Assets; | |
| 98 | -use SeQura\WC\Services\Assets\Interface_Assets; | |
| 99 | 92 | use SeQura\WC\Services\Cart\Cart_Service; |
| 100 | 93 | use SeQura\WC\Services\Cart\Interface_Cart_Service; |
| 101 | -use SeQura\WC\Services\Constants; | |
| 94 | +use SeQura\WC\Services\Constants\Constants; | |
| 102 | 95 | use SeQura\WC\Services\Core\Selling_Countries_Service; |
| 103 | 96 | use SeQura\WC\Services\Core\Store_Service; |
| 104 | 97 | use SeQura\WC\Services\Core\Version_Service; |
| 105 | 98 | use SeQura\WC\Services\Shopper\Shopper_Service; |
| @@ -105,30 +98,69 @@ | ||
| 105 | 98 | use SeQura\WC\Services\Shopper\Shopper_Service; |
| 106 | 99 | use SeQura\WC\Services\Shopper\Interface_Shopper_Service; |
| 107 | 100 | use SeQura\WC\Services\I18n\I18n; |
| 108 | 101 | use SeQura\WC\Services\I18n\Interface_I18n; |
| 109 | -use SeQura\WC\Services\Interface_Log_File; | |
| 110 | -use SeQura\WC\Services\Interface_Logger_Service; | |
| 111 | -use SeQura\WC\Services\Log_File; | |
| 112 | -use SeQura\WC\Services\Logger_Service; | |
| 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; | |
| 113 | 106 | use SeQura\WC\Services\Migration\Interface_Migration_Manager; |
| 114 | 107 | use SeQura\WC\Services\Migration\Migration_Manager; |
| 115 | 108 | use SeQura\WC\Services\Order\Interface_Order_Service; |
| 116 | 109 | use SeQura\WC\Services\Order\Order_Service; |
| 117 | 110 | use SeQura\WC\Services\Payment\Interface_Payment_Method_Service; |
| 118 | -use SeQura\WC\Services\Payment\Interface_Payment_Service; | |
| 119 | 111 | use SeQura\WC\Services\Payment\Payment_Method_Service; |
| 120 | -use SeQura\WC\Services\Payment\Payment_Service; | |
| 121 | 112 | use SeQura\WC\Services\Payment\Sequra_Payment_Gateway_Block_Support; |
| 122 | 113 | use SeQura\WC\Services\Pricing\Interface_Pricing_Service; |
| 123 | 114 | use SeQura\WC\Services\Pricing\Pricing_Service; |
| 124 | 115 | use SeQura\WC\Services\Product\Interface_Product_Service; |
| 125 | 116 | use SeQura\WC\Services\Product\Product_Service; |
| 126 | -use SeQura\WC\Services\Regex\Interface_Regex; | |
| 127 | -use SeQura\WC\Services\Regex\Regex; | |
| 128 | 117 | use SeQura\WC\Services\Report\Interface_Report_Service; |
| 129 | 118 | use SeQura\WC\Services\Report\Report_Service; |
| 130 | -use SeQura\WC\Services\Interface_Constants; | |
| 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; | |
| 131 | 163 | |
| 132 | 164 | /** |
| 133 | 165 | * Implementation for the core bootstrap class. |
| 134 | 166 | */ |
| @@ -162,8 +194,9 @@ | ||
| 162 | 194 | Reg::getService( General_Settings_REST_Controller::class ), |
| 163 | 195 | Reg::getService( Onboarding_REST_Controller::class ), |
| 164 | 196 | Reg::getService( Payment_REST_Controller::class ), |
| 165 | 197 | Reg::getService( Log_REST_Controller::class ), |
| 198 | + Reg::getService( Store_Integration_REST_Controller::class ), | |
| 166 | 199 | Reg::getService( Interface_Product_Controller::class ), |
| 167 | 200 | Reg::getService( Interface_Async_Process_Controller::class ), |
| 168 | 201 | Reg::getService( Interface_Order_Controller::class ) |
| 169 | 202 | ); |
| @@ -285,50 +318,58 @@ | ||
| 285 | 318 | static function () { |
| 286 | 319 | return Reg::getService( Order_Status_Settings_Service::class ); |
| 287 | 320 | } |
| 288 | 321 | ); |
| 322 | + // Extend Configuration. | |
| 289 | 323 | Reg::registerService( |
| 290 | 324 | Configuration::class, |
| 291 | 325 | static function () { |
| 292 | 326 | if ( ! isset( self::$cache[ Configuration::class ] ) ) { |
| 293 | - self::$cache[ Configuration::class ] = Configuration::getInstance(); | |
| 327 | + self::$cache[ Configuration::class ] = \SeQura\WC\Core\Extension\Infrastructure\Configuration\Configuration::getInstance(); | |
| 294 | 328 | } |
| 295 | 329 | return self::$cache[ Configuration::class ]; |
| 296 | 330 | } |
| 297 | 331 | ); |
| 332 | + | |
| 333 | + /** | |
| 334 | + * Initialize StoreContext with default store ID so any service that depends on StoreContext | |
| 335 | + * will have the correct store ID set from the beginning. This will reduce the StoreContext::doWithStore | |
| 336 | + * calls to the cases where it's really necessary to set a different store ID. | |
| 337 | + */ | |
| 298 | 338 | Reg::registerService( |
| 299 | - \SeQura\Core\Infrastructure\Configuration\Configuration::CLASS_NAME, | |
| 339 | + StoreIdProvider::class, | |
| 300 | 340 | static function () { |
| 301 | - return Reg::getService( Configuration::class ); | |
| 341 | + if ( ! isset( self::$cache[ StoreIdProvider::class ] ) ) { | |
| 342 | + self::$cache[ StoreIdProvider::class ] = new Store_Id_Provider(); | |
| 343 | + } | |
| 344 | + return self::$cache[ StoreIdProvider::class ]; | |
| 302 | 345 | } |
| 303 | 346 | ); |
| 347 | + | |
| 304 | 348 | Reg::registerService( |
| 305 | 349 | Interface_Create_Order_Request_Builder::class, |
| 306 | 350 | static function () { |
| 307 | 351 | if ( ! isset( self::$cache[ Interface_Create_Order_Request_Builder::class ] ) ) { |
| 308 | 352 | self::$cache[ Interface_Create_Order_Request_Builder::class ] = new Create_Order_Request_Builder( |
| 309 | - Reg::getService( Interface_Payment_Service::class ), | |
| 310 | 353 | Reg::getService( Interface_Cart_Service::class ), |
| 311 | - Reg::getService( Configuration::class ), | |
| 354 | + Reg::getService( Interface_Platform_Provider::class ), | |
| 312 | 355 | Reg::getService( Interface_Product_Service::class ), |
| 313 | 356 | Reg::getService( Interface_Order_Service::class ), |
| 314 | 357 | Reg::getService( Interface_I18n::class ), |
| 315 | 358 | Reg::getService( Interface_Shopper_Service::class ), |
| 316 | - Reg::getService( Interface_Logger_Service::class ) | |
| 359 | + Reg::getService( Interface_Logger_Service::class ), | |
| 360 | + Reg::getService( Interface_Current_Order_Provider::class ), | |
| 361 | + Reg::getService( MerchantOrderRequestBuilder::class ), | |
| 362 | + Reg::getService( Interface_Order_Delivery_Method_Builder::class ), | |
| 363 | + Reg::getService( Interface_Order_Address_Builder::class ), | |
| 364 | + Reg::getService( Interface_Order_Customer_Builder::class ), | |
| 365 | + Reg::getService( CredentialsService::class ), | |
| 366 | + Reg::getService( SeQuraOrderRepositoryInterface::class ) | |
| 317 | 367 | ); |
| 318 | 368 | } |
| 319 | 369 | return self::$cache[ Interface_Create_Order_Request_Builder::class ]; |
| 320 | 370 | } |
| 321 | 371 | ); |
| 322 | - Reg::registerService( | |
| 323 | - AbstractItemFactory::class, | |
| 324 | - static function () { | |
| 325 | - if ( ! isset( self::$cache[ AbstractItemFactory::class ] ) ) { | |
| 326 | - self::$cache[ AbstractItemFactory::class ] = new Item_Factory(); | |
| 327 | - } | |
| 328 | - return self::$cache[ AbstractItemFactory::class ]; | |
| 329 | - } | |
| 330 | - ); | |
| 331 | 372 | |
| 332 | 373 | // Core Implementation. |
| 333 | 374 | Reg::registerService( |
| 334 | 375 | EncryptorInterface::class, |
| @@ -348,10 +389,8 @@ | ||
| 348 | 389 | RepositoryRegistry::getRepository( ConnectionData::class ), |
| 349 | 390 | RepositoryRegistry::getRepository( StatisticalData::class ), |
| 350 | 391 | RepositoryRegistry::getRepository( SendReport::class ), |
| 351 | 392 | RepositoryRegistry::getRepository( QueueItem::class ), |
| 352 | - //phpcs:ignore | |
| 353 | - // RepositoryRegistry::getRepository( SeQuraOrder::class ), | |
| 354 | 393 | ) |
| 355 | 394 | ); |
| 356 | 395 | } |
| 357 | 396 | return self::$cache[ DisconnectServiceInterface::class ]; |
| @@ -361,18 +400,46 @@ | ||
| 361 | 400 | OrderReportServiceInterface::class, |
| 362 | 401 | static function () { |
| 363 | 402 | if ( ! isset( self::$cache[ OrderReportServiceInterface::class ] ) ) { |
| 364 | 403 | self::$cache[ OrderReportServiceInterface::class ] = new Order_Report_Service( |
| 365 | - Reg::getService( Configuration::CLASS_NAME ), | |
| 404 | + Reg::getService( Interface_Platform_Provider::class ), | |
| 366 | 405 | Reg::getService( Interface_Pricing_Service::class ), |
| 367 | 406 | Reg::getService( Interface_Cart_Service::class ), |
| 368 | 407 | Reg::getService( Interface_Order_Service::class ), |
| 369 | - Reg::getService( Interface_I18n::class ) | |
| 408 | + Reg::getService( Interface_I18n::class ), | |
| 409 | + Reg::getService( Interface_Order_Delivery_Method_Builder::class ), | |
| 410 | + Reg::getService( Interface_Order_Address_Builder::class ), | |
| 411 | + Reg::getService( Interface_Order_Customer_Builder::class ) | |
| 370 | 412 | ); |
| 371 | 413 | } |
| 372 | 414 | return self::$cache[ OrderReportServiceInterface::class ]; |
| 373 | 415 | } |
| 374 | 416 | ); |
| 417 | + Reg::registerService( | |
| 418 | + MerchantDataProviderInterface::class, | |
| 419 | + static function () { | |
| 420 | + if ( ! isset( self::$cache[ MerchantDataProviderInterface::class ] ) ) { | |
| 421 | + self::$cache[ MerchantDataProviderInterface::class ] = new Merchant_Data_Provider( | |
| 422 | + Reg::getService( Interface_Current_Order_Provider::class ), | |
| 423 | + Reg::getService( Interface_Constants::class ), | |
| 424 | + Reg::getService( Interface_Product_Service::class ), | |
| 425 | + Reg::getService( Interface_Cart_Service::class ), | |
| 426 | + Reg::getService( Interface_Shopper_Service::class ), | |
| 427 | + Reg::getService( StoreContext::class ) | |
| 428 | + ); | |
| 429 | + } | |
| 430 | + return self::$cache[ MerchantDataProviderInterface::class ]; | |
| 431 | + } | |
| 432 | + ); | |
| 433 | + Reg::registerService( | |
| 434 | + OrderCreationInterface::class, | |
| 435 | + static function () { | |
| 436 | + if ( ! isset( self::$cache[ OrderCreationInterface::class ] ) ) { | |
| 437 | + self::$cache[ OrderCreationInterface::class ] = new Order_Creation(); | |
| 438 | + } | |
| 439 | + return self::$cache[ OrderCreationInterface::class ]; | |
| 440 | + } | |
| 441 | + ); | |
| 375 | 442 | |
| 376 | 443 | |
| 377 | 444 | Reg::registerService( |
| 378 | 445 | Serializer::class, |
| @@ -450,8 +517,18 @@ | ||
| 450 | 517 | } |
| 451 | 518 | return self::$cache[ DefaultLoggerAdapter::CLASS_NAME ]; |
| 452 | 519 | } |
| 453 | 520 | ); |
| 521 | + | |
| 522 | + Reg::registerService( | |
| 523 | + StoreIntegrationServiceInterface::class, | |
| 524 | + static function () { | |
| 525 | + if ( ! isset( self::$cache[ StoreIntegrationServiceInterface::class ] ) ) { | |
| 526 | + self::$cache[ StoreIntegrationServiceInterface::class ] = new Store_Integration_Service(); | |
| 527 | + } | |
| 528 | + return self::$cache[ StoreIntegrationServiceInterface::class ]; | |
| 529 | + } | |
| 530 | + ); | |
| 454 | 531 | |
| 455 | 532 | // Plugin services. |
| 456 | 533 | Reg::registerService( |
| 457 | 534 | Interface_Log_File::class, |
| @@ -457,9 +534,10 @@ | ||
| 457 | 534 | Interface_Log_File::class, |
| 458 | 535 | static function () { |
| 459 | 536 | if ( ! isset( self::$cache[ Interface_Log_File::class ] ) ) { |
| 460 | 537 | self::$cache[ Interface_Log_File::class ] = new Log_File( |
| 461 | - self::get_constants()->get_plugin_log_file_path() | |
| 538 | + self::get_constants()->get_plugin_log_file_path(), | |
| 539 | + Reg::getService( StoreContext::class ) | |
| 462 | 540 | ); |
| 463 | 541 | } |
| 464 | 542 | return self::$cache[ Interface_Log_File::class ]; |
| 465 | 543 | } |
| @@ -467,17 +545,87 @@ | ||
| 467 | 545 | Reg::registerService( |
| 468 | 546 | Interface_Migration_Manager::class, |
| 469 | 547 | static function () { |
| 470 | 548 | if ( ! isset( self::$cache[ Interface_Migration_Manager::class ] ) ) { |
| 549 | + $configuration = Reg::getService( ConfigurationManager::CLASS_NAME ); | |
| 550 | + $wpdb = Reg::getService( \wpdb::class ); | |
| 551 | + /** | |
| 552 | + * Order repository. | |
| 553 | + * | |
| 554 | + * @var Repository $order_repository | |
| 555 | + */ | |
| 556 | + $order_repository = RepositoryRegistry::getRepository( SeQuraOrder::class ); | |
| 557 | + /** | |
| 558 | + * Entity repository. | |
| 559 | + * | |
| 560 | + * @var Repository $entity_repository | |
| 561 | + */ | |
| 562 | + $entity_repository = RepositoryRegistry::getRepository( ConfigEntity::class ); | |
| 563 | + | |
| 564 | + /** | |
| 565 | + * Queue item repository. | |
| 566 | + * | |
| 567 | + * @var Repository $queue_item_repository | |
| 568 | + */ | |
| 569 | + $queue_item_repository = RepositoryRegistry::getRepository( QueueItem::class ); | |
| 570 | + /** | |
| 571 | + * Encryptor service. | |
| 572 | + * | |
| 573 | + * @var EncryptorInterface $encryptor | |
| 574 | + */ | |
| 575 | + $encryptor = Reg::getService( EncryptorInterface::class ); | |
| 576 | + | |
| 577 | + /** | |
| 578 | + * Store context service. | |
| 579 | + * | |
| 580 | + * @var StoreContext $store_context | |
| 581 | + */ | |
| 582 | + $store_context = Reg::getService( StoreContext::class ); | |
| 583 | + | |
| 584 | + /** | |
| 585 | + * Cache repository. | |
| 586 | + * | |
| 587 | + * @var Interface_Cache_Repository $cache_repository | |
| 588 | + */ | |
| 589 | + $cache_repository = Reg::getService( Interface_Cache_Repository::class ); | |
| 590 | + | |
| 471 | 591 | self::$cache[ Interface_Migration_Manager::class ] = new Migration_Manager( |
| 472 | 592 | self::get_constants()->get_plugin_basename(), |
| 473 | - Reg::getService( Configuration::CLASS_NAME ), | |
| 593 | + $configuration, | |
| 474 | 594 | self::get_constants()->get_plugin_data()['Version'], |
| 475 | 595 | array( |
| 476 | 596 | new Migration_Install_300( |
| 477 | - Reg::getService( \wpdb::class ), | |
| 478 | - Reg::getService( Configuration::CLASS_NAME ) | |
| 597 | + $wpdb, | |
| 598 | + $cache_repository, | |
| 599 | + $order_repository, | |
| 600 | + $entity_repository, | |
| 601 | + $queue_item_repository, | |
| 602 | + $store_context | |
| 479 | 603 | ), |
| 604 | + new Migration_Install_320( | |
| 605 | + $wpdb, | |
| 606 | + $cache_repository, | |
| 607 | + self::get_constants()->get_hook_add_order_indexes(), | |
| 608 | + $entity_repository, | |
| 609 | + $queue_item_repository | |
| 610 | + ), | |
| 611 | + new Migration_Install_400( | |
| 612 | + $wpdb, | |
| 613 | + $cache_repository, | |
| 614 | + $encryptor, | |
| 615 | + $store_context | |
| 616 | + ), | |
| 617 | + new Migration_Install_420( | |
| 618 | + $wpdb, | |
| 619 | + $cache_repository, | |
| 620 | + Reg::getService( AdvancedSettingsService::class ), | |
| 621 | + Reg::getService( Order_Status_Settings_Service::class ) | |
| 622 | + ), | |
| 623 | + new Migration_Install_430( | |
| 624 | + $wpdb, | |
| 625 | + $cache_repository, | |
| 626 | + Reg::getService( StoreService::class ) | |
| 627 | + ), | |
| 480 | 628 | ) |
| 481 | 629 | ); |
| 482 | 630 | } |
| 483 | 631 | return self::$cache[ Interface_Migration_Manager::class ]; |
| @@ -492,28 +640,16 @@ | ||
| 492 | 640 | return self::$cache[ Interface_I18n::class ]; |
| 493 | 641 | } |
| 494 | 642 | ); |
| 495 | 643 | Reg::registerService( |
| 496 | - Interface_Regex::class, | |
| 497 | - static function () { | |
| 498 | - if ( ! isset( self::$cache[ Interface_Regex::class ] ) ) { | |
| 499 | - self::$cache[ Interface_Regex::class ] = new Regex(); | |
| 500 | - } | |
| 501 | - return self::$cache[ Interface_Regex::class ]; | |
| 502 | - } | |
| 503 | - ); | |
| 504 | - Reg::registerService( | |
| 505 | 644 | Interface_Report_Service::class, |
| 506 | 645 | static function () { |
| 507 | 646 | if ( ! isset( self::$cache[ Interface_Report_Service::class ] ) ) { |
| 508 | 647 | self::$cache[ Interface_Report_Service::class ] = new Report_Service( |
| 509 | - Reg::getService( Configuration::class ), | |
| 510 | - Reg::getService( StoreService::class ), | |
| 511 | 648 | Reg::getService( ShopOrderService::class ), |
| 512 | 649 | Reg::getService( StatisticalDataRepositoryInterface::class ), |
| 513 | 650 | Reg::getService( CountryConfigurationRepositoryInterface::class ), |
| 514 | - Reg::getService( Interface_Order_Service::class ), | |
| 515 | - Reg::getService( StoreContext::class ) | |
| 651 | + Reg::getService( Interface_Order_Service::class ) | |
| 516 | 652 | ); |
| 517 | 653 | } |
| 518 | 654 | return self::$cache[ Interface_Report_Service::class ]; |
| 519 | 655 | } |
| @@ -529,20 +665,8 @@ | ||
| 529 | 665 | } |
| 530 | 666 | return self::$cache[ Interface_Logger_Service::class ]; |
| 531 | 667 | } |
| 532 | 668 | ); |
| 533 | - Reg::registerService( | |
| 534 | - Interface_Payment_Service::class, | |
| 535 | - static function () { | |
| 536 | - if ( ! isset( self::$cache[ Interface_Payment_Service::class ] ) ) { | |
| 537 | - self::$cache[ Interface_Payment_Service::class ] = new Payment_Service( | |
| 538 | - Reg::getService( Configuration::class ), | |
| 539 | - Reg::getService( Interface_I18n::class ) | |
| 540 | - ); | |
| 541 | - } | |
| 542 | - return self::$cache[ Interface_Payment_Service::class ]; | |
| 543 | - } | |
| 544 | - ); | |
| 545 | 669 | |
| 546 | 670 | Reg::registerService( |
| 547 | 671 | Sequra_Payment_Gateway_Block_Support::class, |
| 548 | 672 | static function () { |
| @@ -568,17 +692,27 @@ | ||
| 568 | 692 | Reg::registerService( |
| 569 | 693 | Interface_Order_Service::class, |
| 570 | 694 | static function () { |
| 571 | 695 | if ( ! isset( self::$cache[ Interface_Order_Service::class ] ) ) { |
| 696 | + /** | |
| 697 | + * This will return SeQura_Order_Repository that implements Interface_Deletable_Repository and Interface_Table_Migration_Repository. | |
| 698 | + * | |
| 699 | + * @var SeQura_Order_Repository $repository | |
| 700 | + */ | |
| 701 | + $repository = RepositoryRegistry::getRepository( SeQuraOrder::class ); | |
| 702 | + | |
| 572 | 703 | self::$cache[ Interface_Order_Service::class ] = new Order_Service( |
| 573 | 704 | Reg::getService( SeQuraOrderRepositoryInterface::class ), |
| 574 | - Reg::getService( Interface_Payment_Service::class ), | |
| 575 | 705 | Reg::getService( Interface_Pricing_Service::class ), |
| 576 | 706 | Reg::getService( OrderStatusSettingsService::class ), |
| 577 | - Reg::getService( Configuration::class ), | |
| 578 | 707 | Reg::getService( Interface_Cart_Service::class ), |
| 579 | - Reg::getService( StoreContext::class ), | |
| 580 | - Reg::getService( Interface_Logger_Service::class ) | |
| 708 | + Reg::getService( Interface_Logger_Service::class ), | |
| 709 | + Reg::getService( Interface_Time_Checker_Service::class ), | |
| 710 | + $repository, | |
| 711 | + $repository, | |
| 712 | + self::get_constants()->get_payment_gateway_id(), | |
| 713 | + Reg::getService( ConnectionService::class ), | |
| 714 | + Reg::getService( OrderService::class ) | |
| 581 | 715 | ); |
| 582 | 716 | } |
| 583 | 717 | return self::$cache[ Interface_Order_Service::class ]; |
| 584 | 718 | } |
| @@ -588,11 +722,11 @@ | ||
| 588 | 722 | static function () { |
| 589 | 723 | if ( ! isset( self::$cache[ Interface_Cart_Service::class ] ) ) { |
| 590 | 724 | self::$cache[ Interface_Cart_Service::class ] = new Cart_Service( |
| 591 | 725 | Reg::getService( Interface_Product_Service::class ), |
| 592 | - Reg::getService( Configuration::class ), | |
| 593 | 726 | Reg::getService( Interface_Pricing_Service::class ), |
| 594 | - Reg::getService( Interface_Logger_Service::class ) | |
| 727 | + Reg::getService( Interface_Logger_Service::class ), | |
| 728 | + Reg::getService( Interface_Shopper_Service::class ) | |
| 595 | 729 | ); |
| 596 | 730 | } |
| 597 | 731 | return self::$cache[ Interface_Cart_Service::class ]; |
| 598 | 732 | } |
| @@ -601,11 +735,11 @@ | ||
| 601 | 735 | Interface_Product_Service::class, |
| 602 | 736 | static function () { |
| 603 | 737 | if ( ! isset( self::$cache[ Interface_Product_Service::class ] ) ) { |
| 604 | 738 | self::$cache[ Interface_Product_Service::class ] = new Product_Service( |
| 605 | - Reg::getService( Configuration::class ), | |
| 606 | 739 | Reg::getService( Interface_Pricing_Service::class ), |
| 607 | - Reg::getService( Interface_Regex::class ) | |
| 740 | + Reg::getService( RegexProvider::class ), | |
| 741 | + Reg::getService( StoreContext::class ) | |
| 608 | 742 | ); |
| 609 | 743 | } |
| 610 | 744 | return self::$cache[ Interface_Product_Service::class ]; |
| 611 | 745 | } |
| @@ -613,9 +747,11 @@ | ||
| 613 | 747 | Reg::registerService( |
| 614 | 748 | Interface_Shopper_Service::class, |
| 615 | 749 | static function () { |
| 616 | 750 | if ( ! isset( self::$cache[ Interface_Shopper_Service::class ] ) ) { |
| 617 | - self::$cache[ Interface_Shopper_Service::class ] = new Shopper_Service(); | |
| 751 | + self::$cache[ Interface_Shopper_Service::class ] = new Shopper_Service( | |
| 752 | + Reg::getService( StoreContext::class ) | |
| 753 | + ); | |
| 618 | 754 | } |
| 619 | 755 | return self::$cache[ Interface_Shopper_Service::class ]; |
| 620 | 756 | } |
| 621 | 757 | ); |
| @@ -625,9 +761,11 @@ | ||
| 625 | 761 | if ( ! isset( self::$cache[ ShopOrderService::class ] ) ) { |
| 626 | 762 | self::$cache[ ShopOrderService::class ] = new Shop_Order_Service( |
| 627 | 763 | Reg::getService( SeQuraOrderRepositoryInterface::class ), |
| 628 | 764 | Reg::getService( Interface_Logger_Service::class ), |
| 629 | - Reg::getService( Interface_Create_Order_Request_Builder::class ) | |
| 765 | + Reg::getService( Interface_Create_Order_Request_Builder::class ), | |
| 766 | + Reg::getService( Interface_Current_Order_Provider::class ), | |
| 767 | + Reg::getService( OrderService::class ) | |
| 630 | 768 | ); |
| 631 | 769 | } |
| 632 | 770 | return self::$cache[ ShopOrderService::class ]; |
| 633 | 771 | } |
| @@ -632,16 +770,168 @@ | ||
| 632 | 770 | return self::$cache[ ShopOrderService::class ]; |
| 633 | 771 | } |
| 634 | 772 | ); |
| 635 | 773 | Reg::registerService( |
| 636 | - Interface_Assets::class, | |
| 774 | + Interface_Time_Checker_Service::class, | |
| 637 | 775 | static function () { |
| 638 | - if ( ! isset( self::$cache[ Interface_Assets::class ] ) ) { | |
| 639 | - self::$cache[ Interface_Assets::class ] = new Assets(); | |
| 776 | + if ( ! isset( self::$cache[ Interface_Time_Checker_Service::class ] ) ) { | |
| 777 | + self::$cache[ Interface_Time_Checker_Service::class ] = new Time_Checker_Service(); | |
| 640 | 778 | } |
| 641 | - return self::$cache[ Interface_Assets::class ]; | |
| 779 | + return self::$cache[ Interface_Time_Checker_Service::class ]; | |
| 642 | 780 | } |
| 643 | 781 | ); |
| 782 | + | |
| 783 | + Reg::registerService( | |
| 784 | + ProductServiceInterface::class, | |
| 785 | + static function () { | |
| 786 | + if ( ! isset( self::$cache[ ProductServiceInterface::class ] ) ) { | |
| 787 | + self::$cache[ ProductServiceInterface::class ] = new Core_Product_Service( Reg::getService( \wpdb::class ) ); | |
| 788 | + } | |
| 789 | + return self::$cache[ ProductServiceInterface::class ]; | |
| 790 | + } | |
| 791 | + ); | |
| 792 | + Reg::registerService( | |
| 793 | + WidgetConfiguratorInterface::class, | |
| 794 | + static function () { | |
| 795 | + if ( ! isset( self::$cache[ WidgetConfiguratorInterface::class ] ) ) { | |
| 796 | + self::$cache[ WidgetConfiguratorInterface::class ] = new Widget_Configurator( | |
| 797 | + Reg::getService( Interface_I18n::class ) | |
| 798 | + ); | |
| 799 | + } | |
| 800 | + return self::$cache[ WidgetConfiguratorInterface::class ]; | |
| 801 | + } | |
| 802 | + ); | |
| 803 | + | |
| 804 | + Reg::registerService( | |
| 805 | + MiniWidgetMessagesProviderInterface::class, | |
| 806 | + static function () { | |
| 807 | + if ( ! isset( self::$cache[ MiniWidgetMessagesProviderInterface::class ] ) ) { | |
| 808 | + self::$cache[ MiniWidgetMessagesProviderInterface::class ] = new Mini_Widget_Messages_Provider( | |
| 809 | + Reg::getService( Interface_I18n::class ) | |
| 810 | + ); | |
| 811 | + } | |
| 812 | + return self::$cache[ MiniWidgetMessagesProviderInterface::class ]; | |
| 813 | + } | |
| 814 | + ); | |
| 815 | + | |
| 816 | + Reg::registerService( | |
| 817 | + Interface_Current_Order_Provider::class, | |
| 818 | + static function () { | |
| 819 | + if ( ! isset( self::$cache[ Interface_Current_Order_Provider::class ] ) ) { | |
| 820 | + self::$cache[ Interface_Current_Order_Provider::class ] = new Current_Order_Provider(); | |
| 821 | + } | |
| 822 | + return self::$cache[ Interface_Current_Order_Provider::class ]; | |
| 823 | + } | |
| 824 | + ); | |
| 825 | + | |
| 826 | + Reg::registerService( | |
| 827 | + Interface_Platform_Provider::class, | |
| 828 | + static function () { | |
| 829 | + if ( ! isset( self::$cache[ Interface_Platform_Provider::class ] ) ) { | |
| 830 | + self::$cache[ Interface_Platform_Provider::class ] = new Platform_Provider( | |
| 831 | + Reg::getService( Interface_Constants::class ) | |
| 832 | + ); | |
| 833 | + } | |
| 834 | + return self::$cache[ Interface_Platform_Provider::class ]; | |
| 835 | + } | |
| 836 | + ); | |
| 837 | + | |
| 838 | + Reg::registerService( | |
| 839 | + Interface_Payment_Method_Service::class, | |
| 840 | + static function () { | |
| 841 | + if ( ! isset( self::$cache[ Interface_Payment_Method_Service::class ] ) ) { | |
| 842 | + self::$cache[ Interface_Payment_Method_Service::class ] = new Payment_Method_Service( | |
| 843 | + Reg::getService( Interface_Create_Order_Request_Builder::class ), | |
| 844 | + Reg::getService( Interface_Order_Service::class ), | |
| 845 | + Reg::getService( Interface_Logger_Service::class ), | |
| 846 | + Reg::getService( Interface_Current_Order_Provider::class ), | |
| 847 | + Reg::getService( StoreContext::class ) | |
| 848 | + ); | |
| 849 | + } | |
| 850 | + return self::$cache[ Interface_Payment_Method_Service::class ]; | |
| 851 | + } | |
| 852 | + ); | |
| 853 | + | |
| 854 | + Reg::registerService( | |
| 855 | + Interface_Widgets_Service::class, | |
| 856 | + static function () { | |
| 857 | + if ( ! isset( self::$cache[ Interface_Widgets_Service::class ] ) ) { | |
| 858 | + self::$cache[ Interface_Widgets_Service::class ] = new Widgets_Service( | |
| 859 | + Reg::getService( Interface_Logger_Service::class ), | |
| 860 | + Reg::getService( Interface_I18n::class ), | |
| 861 | + Reg::getService( Interface_Shopper_Service::class ), | |
| 862 | + Reg::getService( WidgetConfiguratorInterface::class ), | |
| 863 | + Reg::getService( StoreContext::class ) | |
| 864 | + ); | |
| 865 | + } | |
| 866 | + return self::$cache[ Interface_Widgets_Service::class ]; | |
| 867 | + } | |
| 868 | + ); | |
| 869 | + Reg::registerService( | |
| 870 | + Interface_Settings_Service::class, | |
| 871 | + static function () { | |
| 872 | + if ( ! isset( self::$cache[ Interface_Settings_Service::class ] ) ) { | |
| 873 | + self::$cache[ Interface_Settings_Service::class ] = new Settings_Service(); | |
| 874 | + } | |
| 875 | + return self::$cache[ Interface_Settings_Service::class ]; | |
| 876 | + } | |
| 877 | + ); | |
| 878 | + Reg::registerService( | |
| 879 | + Interface_Order_Address_Builder::class, | |
| 880 | + static function () { | |
| 881 | + if ( ! isset( self::$cache[ Interface_Order_Address_Builder::class ] ) ) { | |
| 882 | + self::$cache[ Interface_Order_Address_Builder::class ] = new Order_Address_Builder( | |
| 883 | + Reg::getService( Interface_Shopper_Service::class ) | |
| 884 | + ); | |
| 885 | + } | |
| 886 | + return self::$cache[ Interface_Order_Address_Builder::class ]; | |
| 887 | + } | |
| 888 | + ); | |
| 889 | + Reg::registerService( | |
| 890 | + Interface_Order_Customer_Builder::class, | |
| 891 | + static function () { | |
| 892 | + if ( ! isset( self::$cache[ Interface_Order_Customer_Builder::class ] ) ) { | |
| 893 | + self::$cache[ Interface_Order_Customer_Builder::class ] = new Order_Customer_Builder( | |
| 894 | + Reg::getService( Interface_Shopper_Service::class ), | |
| 895 | + Reg::getService( OrderStatusSettingsService::class ), | |
| 896 | + Reg::getService( Interface_Pricing_Service::class ) | |
| 897 | + ); | |
| 898 | + } | |
| 899 | + return self::$cache[ Interface_Order_Customer_Builder::class ]; | |
| 900 | + } | |
| 901 | + ); | |
| 902 | + Reg::registerService( | |
| 903 | + Interface_Order_Delivery_Method_Builder::class, | |
| 904 | + static function () { | |
| 905 | + if ( ! isset( self::$cache[ Interface_Order_Delivery_Method_Builder::class ] ) ) { | |
| 906 | + self::$cache[ Interface_Order_Delivery_Method_Builder::class ] = new Order_Delivery_Method_Builder(); | |
| 907 | + } | |
| 908 | + return self::$cache[ Interface_Order_Delivery_Method_Builder::class ]; | |
| 909 | + } | |
| 910 | + ); | |
| 911 | + Reg::registerService( | |
| 912 | + StoreInfoServiceInterface::class, | |
| 913 | + static function () { | |
| 914 | + if ( ! isset( self::$cache[ StoreInfoServiceInterface::class ] ) ) { | |
| 915 | + self::$cache[ StoreInfoServiceInterface::class ] = new Store_Info_Service( | |
| 916 | + Reg::getService( Interface_Platform_Provider::class ) | |
| 917 | + ); | |
| 918 | + } | |
| 919 | + return self::$cache[ StoreInfoServiceInterface::class ]; | |
| 920 | + } | |
| 921 | + ); | |
| 922 | + Reg::registerService( | |
| 923 | + LogServiceInterface::class, | |
| 924 | + static function () { | |
| 925 | + if ( ! isset( self::$cache[ LogServiceInterface::class ] ) ) { | |
| 926 | + self::$cache[ LogServiceInterface::class ] = new Log_Service( | |
| 927 | + Reg::getService( Interface_Logger_Service::class ), | |
| 928 | + Reg::getService( StoreContext::class ) | |
| 929 | + ); | |
| 930 | + } | |
| 931 | + return self::$cache[ LogServiceInterface::class ]; | |
| 932 | + } | |
| 933 | + ); | |
| 644 | 934 | } |
| 645 | 935 | |
| 646 | 936 | /** |
| 647 | 937 | * Initializes repositories. |
| @@ -658,31 +948,19 @@ | ||
| 658 | 948 | return self::$cache[ \wpdb::class ]; |
| 659 | 949 | } |
| 660 | 950 | ); |
| 661 | 951 | |
| 662 | - parent::initRepositories(); | |
| 663 | - | |
| 664 | - // Extend GeneralSettingsRepository. | |
| 665 | 952 | Reg::registerService( |
| 666 | - GeneralSettingsRepositoryInterface::class, | |
| 953 | + Interface_Cache_Repository::class, | |
| 667 | 954 | static function () { |
| 668 | - return new General_Settings_Repository( | |
| 669 | - RepositoryRegistry::getRepository( GeneralSettings::getClassName() ), | |
| 670 | - Reg::getService( StoreContext::class ) | |
| 671 | - ); | |
| 955 | + if ( ! isset( self::$cache[ Interface_Cache_Repository::class ] ) ) { | |
| 956 | + self::$cache[ Interface_Cache_Repository::class ] = new Cache_Repository(); | |
| 957 | + } | |
| 958 | + return self::$cache[ Interface_Cache_Repository::class ]; | |
| 672 | 959 | } |
| 673 | 960 | ); |
| 674 | 961 | |
| 675 | - // Extend WidgetSettingsRepository. | |
| 676 | - Reg::registerService( | |
| 677 | - WidgetSettingsRepositoryInterface::class, | |
| 678 | - static function () { | |
| 679 | - return new Widget_Settings_Repository( | |
| 680 | - RepositoryRegistry::getRepository( WidgetSettings::getClassName() ), | |
| 681 | - Reg::getService( StoreContext::class ) | |
| 682 | - ); | |
| 683 | - } | |
| 684 | - ); | |
| 962 | + parent::initRepositories(); | |
| 685 | 963 | |
| 686 | 964 | RepositoryRegistry::registerRepository( ConfigEntity::class, Entity_Repository::class ); |
| 687 | 965 | RepositoryRegistry::registerRepository( QueueItem::class, Queue_Item_Repository::class ); |
| 688 | 966 | RepositoryRegistry::registerRepository( Process::class, Entity_Repository::class ); |
| @@ -694,9 +972,12 @@ | ||
| 694 | 972 | RepositoryRegistry::registerRepository( SeQuraOrder::class, SeQura_Order_Repository::class ); |
| 695 | 973 | RepositoryRegistry::registerRepository( WidgetSettings::class, Entity_Repository::class ); |
| 696 | 974 | RepositoryRegistry::registerRepository( SendReport::class, Entity_Repository::class ); |
| 697 | 975 | RepositoryRegistry::registerRepository( TransactionLog::class, Entity_Repository::class ); |
| 698 | - RepositoryRegistry::registerRepository( Payment_Methods::class, Entity_Repository::class ); | |
| 976 | + RepositoryRegistry::registerRepository( PaymentMethod::class, Entity_Repository::class ); | |
| 977 | + RepositoryRegistry::registerRepository( Credentials::class, Entity_Repository::class ); | |
| 978 | + RepositoryRegistry::registerRepository( Deployment::class, Entity_Repository::class ); | |
| 979 | + RepositoryRegistry::registerRepository( AdvancedSettings::class, Entity_Repository::class ); | |
| 699 | 980 | } |
| 700 | 981 | |
| 701 | 982 | /** |
| 702 | 983 | * Initializes controllers. |
| @@ -703,29 +984,8 @@ | ||
| 703 | 984 | */ |
| 704 | 985 | protected static function initControllers(): void { |
| 705 | 986 | parent::initControllers(); |
| 706 | 987 | |
| 707 | - // Extend GeneralSettingsController. | |
| 708 | - Reg::registerService( | |
| 709 | - GeneralSettingsController::class, | |
| 710 | - static function () { | |
| 711 | - return new General_Settings_Controller( | |
| 712 | - Reg::getService( GeneralSettingsService::class ), | |
| 713 | - Reg::getService( CategoryService::class ) | |
| 714 | - ); | |
| 715 | - } | |
| 716 | - ); | |
| 717 | - | |
| 718 | - // Extend PromotionalWidgetsController. | |
| 719 | - Reg::registerService( | |
| 720 | - PromotionalWidgetsController::class, | |
| 721 | - static function () { | |
| 722 | - return new Promotional_Widgets_Controller( | |
| 723 | - Reg::getService( WidgetSettingsService::class ) | |
| 724 | - ); | |
| 725 | - } | |
| 726 | - ); | |
| 727 | - | |
| 728 | 988 | // Plugin controllers. |
| 729 | 989 | Reg::registerService( |
| 730 | 990 | Interface_I18n_Controller::class, |
| 731 | 991 | static function () { |
| @@ -754,12 +1014,12 @@ | ||
| 754 | 1014 | $env_data['wp_version'] ?? '', |
| 755 | 1015 | Reg::getService( Interface_I18n::class ), |
| 756 | 1016 | Reg::getService( Interface_Logger_Service::class ), |
| 757 | 1017 | self::get_constants()->get_plugin_templates_path(), |
| 758 | - Reg::getService( Configuration::class ), | |
| 759 | - Reg::getService( Interface_Assets::class ), | |
| 1018 | + Reg::getService( Interface_Settings_Service::class ), | |
| 760 | 1019 | Reg::getService( Interface_Payment_Method_Service::class ), |
| 761 | - Reg::getService( Interface_Regex::class ) | |
| 1020 | + Reg::getService( RegexProvider::class ), | |
| 1021 | + Reg::getService( Interface_Widgets_Service::class ) | |
| 762 | 1022 | ); |
| 763 | 1023 | } |
| 764 | 1024 | return self::$cache[ Interface_Assets_Controller::class ]; |
| 765 | 1025 | } |
| @@ -769,9 +1029,9 @@ | ||
| 769 | 1029 | static function () { |
| 770 | 1030 | if ( ! isset( self::$cache[ Interface_Settings_Controller::class ] ) ) { |
| 771 | 1031 | self::$cache[ Interface_Settings_Controller::class ] = new Settings_Controller( |
| 772 | 1032 | self::get_constants()->get_plugin_templates_path(), |
| 773 | - Reg::getService( Configuration::class ), | |
| 1033 | + Reg::getService( Interface_Settings_Service::class ), | |
| 774 | 1034 | Reg::getService( Interface_Logger_Service::class ), |
| 775 | 1035 | self::get_constants()->get_plugin_basename() |
| 776 | 1036 | ); |
| 777 | 1037 | } |
| @@ -797,14 +1057,11 @@ | ||
| 797 | 1057 | if ( ! isset( self::$cache[ Interface_Product_Controller::class ] ) ) { |
| 798 | 1058 | self::$cache[ Interface_Product_Controller::class ] = new Product_Controller( |
| 799 | 1059 | Reg::getService( Interface_Logger_Service::class ), |
| 800 | 1060 | self::get_constants()->get_plugin_templates_path(), |
| 801 | - Reg::getService( Configuration::class ), | |
| 802 | 1061 | Reg::getService( Interface_Product_Service::class ), |
| 803 | - Reg::getService( Interface_Payment_Service::class ), | |
| 804 | - Reg::getService( Interface_Payment_Method_Service::class ), | |
| 805 | - Reg::getService( Interface_I18n::class ), | |
| 806 | - Reg::getService( Interface_Regex::class ) | |
| 1062 | + Reg::getService( RegexProvider::class ), | |
| 1063 | + Reg::getService( Interface_Widgets_Service::class ) | |
| 807 | 1064 | ); |
| 808 | 1065 | } |
| 809 | 1066 | return self::$cache[ Interface_Product_Controller::class ]; |
| 810 | 1067 | } |
| @@ -828,9 +1085,10 @@ | ||
| 828 | 1085 | if ( ! isset( self::$cache[ Interface_Order_Controller::class ] ) ) { |
| 829 | 1086 | self::$cache[ Interface_Order_Controller::class ] = new Order_Controller( |
| 830 | 1087 | Reg::getService( Interface_Logger_Service::class ), |
| 831 | 1088 | self::get_constants()->get_plugin_templates_path(), |
| 832 | - Reg::getService( Interface_Order_Service::class ) | |
| 1089 | + Reg::getService( Interface_Order_Service::class ), | |
| 1090 | + Reg::getService( Interface_Cart_Service::class ) | |
| 833 | 1091 | ); |
| 834 | 1092 | } |
| 835 | 1093 | return self::$cache[ Interface_Order_Controller::class ]; |
| 836 | 1094 | } |
| @@ -840,9 +1098,10 @@ | ||
| 840 | 1098 | static function () { |
| 841 | 1099 | if ( ! isset( self::$cache[ Onboarding_REST_Controller::class ] ) ) { |
| 842 | 1100 | self::$cache[ Onboarding_REST_Controller::class ] = new Onboarding_REST_Controller( |
| 843 | 1101 | self::get_constants()->get_plugin_rest_namespace(), |
| 844 | - Reg::getService( Interface_Logger_Service::class ) | |
| 1102 | + Reg::getService( Interface_Logger_Service::class ), | |
| 1103 | + Reg::getService( RegexProvider::class ) | |
| 845 | 1104 | ); |
| 846 | 1105 | } |
| 847 | 1106 | return self::$cache[ Onboarding_REST_Controller::class ]; |
| 848 | 1107 | } |
| @@ -853,9 +1112,9 @@ | ||
| 853 | 1112 | if ( ! isset( self::$cache[ Payment_REST_Controller::class ] ) ) { |
| 854 | 1113 | self::$cache[ Payment_REST_Controller::class ] = new Payment_REST_Controller( |
| 855 | 1114 | self::get_constants()->get_plugin_rest_namespace(), |
| 856 | 1115 | Reg::getService( Interface_Logger_Service::class ), |
| 857 | - Reg::getService( Interface_Payment_Method_Service::class ) | |
| 1116 | + Reg::getService( RegexProvider::class ) | |
| 858 | 1117 | ); |
| 859 | 1118 | } |
| 860 | 1119 | return self::$cache[ Payment_REST_Controller::class ]; |
| 861 | 1120 | } |
| @@ -865,9 +1124,11 @@ | ||
| 865 | 1124 | static function () { |
| 866 | 1125 | if ( ! isset( self::$cache[ General_Settings_REST_Controller::class ] ) ) { |
| 867 | 1126 | self::$cache[ General_Settings_REST_Controller::class ] = new General_Settings_REST_Controller( |
| 868 | 1127 | self::get_constants()->get_plugin_rest_namespace(), |
| 869 | - Reg::getService( Interface_Logger_Service::class ) | |
| 1128 | + Reg::getService( Interface_Logger_Service::class ), | |
| 1129 | + Reg::getService( RegexProvider::class ), | |
| 1130 | + Reg::getService( StoreContext::class ) | |
| 870 | 1131 | ); |
| 871 | 1132 | } |
| 872 | 1133 | return self::$cache[ General_Settings_REST_Controller::class ]; |
| 873 | 1134 | } |
| @@ -877,9 +1138,11 @@ | ||
| 877 | 1138 | static function () { |
| 878 | 1139 | if ( ! isset( self::$cache[ Log_REST_Controller::class ] ) ) { |
| 879 | 1140 | self::$cache[ Log_REST_Controller::class ] = new Log_REST_Controller( |
| 880 | 1141 | self::get_constants()->get_plugin_rest_namespace(), |
| 881 | - Reg::getService( Interface_Logger_Service::class ) | |
| 1142 | + Reg::getService( Interface_Logger_Service::class ), | |
| 1143 | + Reg::getService( RegexProvider::class ), | |
| 1144 | + Reg::getService( AdvancedSettingsService::class ) | |
| 882 | 1145 | ); |
| 883 | 1146 | } |
| 884 | 1147 | return self::$cache[ Log_REST_Controller::class ]; |
| 885 | 1148 | } |
| @@ -884,20 +1147,20 @@ | ||
| 884 | 1147 | return self::$cache[ Log_REST_Controller::class ]; |
| 885 | 1148 | } |
| 886 | 1149 | ); |
| 887 | 1150 | Reg::registerService( |
| 888 | - Interface_Payment_Method_Service::class, | |
| 1151 | + Store_Integration_REST_Controller::class, | |
| 889 | 1152 | static function () { |
| 890 | - if ( ! isset( self::$cache[ Interface_Payment_Method_Service::class ] ) ) { | |
| 891 | - self::$cache[ Interface_Payment_Method_Service::class ] = new Payment_Method_Service( | |
| 892 | - Reg::getService( Configuration::class ), | |
| 893 | - Reg::getService( Interface_Create_Order_Request_Builder::class ), | |
| 894 | - Reg::getService( Interface_Order_Service::class ), | |
| 1153 | + if ( ! isset( self::$cache[ Store_Integration_REST_Controller::class ] ) ) { | |
| 1154 | + self::$cache[ Store_Integration_REST_Controller::class ] = new Store_Integration_REST_Controller( | |
| 1155 | + self::get_constants()->get_plugin_rest_namespace(), | |
| 895 | 1156 | Reg::getService( Interface_Logger_Service::class ), |
| 896 | - RepositoryRegistry::getRepository( Payment_Methods::CLASS_NAME ) | |
| 1157 | + Reg::getService( RegexProvider::class ), | |
| 1158 | + Reg::getService( StoreIntegrationServiceInterface::class ), | |
| 1159 | + Reg::getService( StoreContext::class ) | |
| 897 | 1160 | ); |
| 898 | 1161 | } |
| 899 | - return self::$cache[ Interface_Payment_Method_Service::class ]; | |
| 1162 | + return self::$cache[ Store_Integration_REST_Controller::class ]; | |
| 900 | 1163 | } |
| 901 | 1164 | ); |
| 902 | 1165 | } |
| 903 | 1166 | } |