| @@ -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,20 @@ | ||
| 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; |
| 84 | +use SeQura\WC\Repositories\Cache_Repository; | |
| 90 | 85 | use SeQura\WC\Repositories\Entity_Repository; |
| 86 | +use SeQura\WC\Repositories\Interface_Cache_Repository; | |
| 91 | 87 | use SeQura\WC\Repositories\Migrations\Migration_Install_300; |
| 88 | +use SeQura\WC\Repositories\Migrations\Migration_Install_320; | |
| 92 | 89 | use SeQura\WC\Repositories\Queue_Item_Repository; |
| 90 | +use SeQura\WC\Repositories\Repository; | |
| 93 | 91 | use SeQura\WC\Repositories\SeQura_Order_Repository; |
| 94 | -use SeQura\WC\Services\Assets\Assets; | |
| 95 | -use SeQura\WC\Services\Assets\Interface_Assets; | |
| 96 | 92 | use SeQura\WC\Services\Cart\Cart_Service; |
| 97 | 93 | use SeQura\WC\Services\Cart\Interface_Cart_Service; |
| 94 | +use SeQura\WC\Services\Constants\Constants; | |
| 98 | 95 | use SeQura\WC\Services\Core\Selling_Countries_Service; |
| 99 | 96 | use SeQura\WC\Services\Core\Store_Service; |
| 100 | 97 | use SeQura\WC\Services\Core\Version_Service; |
| 101 | 98 | use SeQura\WC\Services\Shopper\Shopper_Service; |
| @@ -101,29 +98,69 @@ | ||
| 101 | 98 | use SeQura\WC\Services\Shopper\Shopper_Service; |
| 102 | 99 | use SeQura\WC\Services\Shopper\Interface_Shopper_Service; |
| 103 | 100 | use SeQura\WC\Services\I18n\I18n; |
| 104 | 101 | 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; | |
| 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; | |
| 109 | 106 | use SeQura\WC\Services\Migration\Interface_Migration_Manager; |
| 110 | 107 | use SeQura\WC\Services\Migration\Migration_Manager; |
| 111 | 108 | use SeQura\WC\Services\Order\Interface_Order_Service; |
| 112 | 109 | use SeQura\WC\Services\Order\Order_Service; |
| 113 | 110 | use SeQura\WC\Services\Payment\Interface_Payment_Method_Service; |
| 114 | -use SeQura\WC\Services\Payment\Interface_Payment_Service; | |
| 115 | 111 | use SeQura\WC\Services\Payment\Payment_Method_Service; |
| 116 | -use SeQura\WC\Services\Payment\Payment_Service; | |
| 117 | 112 | use SeQura\WC\Services\Payment\Sequra_Payment_Gateway_Block_Support; |
| 118 | 113 | use SeQura\WC\Services\Pricing\Interface_Pricing_Service; |
| 119 | 114 | use SeQura\WC\Services\Pricing\Pricing_Service; |
| 120 | 115 | use SeQura\WC\Services\Product\Interface_Product_Service; |
| 121 | 116 | use SeQura\WC\Services\Product\Product_Service; |
| 122 | -use SeQura\WC\Services\Regex\Interface_Regex; | |
| 123 | -use SeQura\WC\Services\Regex\Regex; | |
| 124 | 117 | use SeQura\WC\Services\Report\Interface_Report_Service; |
| 125 | 118 | use SeQura\WC\Services\Report\Report_Service; |
| 119 | +use SeQura\WC\Services\Constants\Interface_Constants; | |
| 120 | +use SeQura\WC\Services\Time\Interface_Time_Checker_Service; | |
| 121 | +use SeQura\WC\Services\Time\Time_Checker_Service; | |
| 122 | +use SeQura\Core\BusinessLogic\Domain\Integration\PromotionalWidgets\WidgetConfiguratorInterface; | |
| 123 | +use SeQura\Core\BusinessLogic\Domain\Integration\PromotionalWidgets\MiniWidgetMessagesProviderInterface; | |
| 124 | +use SeQura\Core\BusinessLogic\Domain\Order\Builders\MerchantOrderRequestBuilder; | |
| 125 | +use SeQura\Core\BusinessLogic\Domain\Order\Service\OrderService; | |
| 126 | +use SeQura\Core\Infrastructure\Configuration\Configuration; | |
| 127 | +use SeQura\Core\Infrastructure\Utility\RegexProvider; | |
| 128 | +use SeQura\WC\Core\Implementation\BusinessLogic\Domain\Integration\Order\Merchant_Data_Provider; | |
| 129 | +use SeQura\WC\Core\Implementation\BusinessLogic\Domain\Integration\Order\Order_Creation; | |
| 130 | +use SeQura\WC\Core\Implementation\BusinessLogic\Domain\Integration\Product\Product_Service as Core_Product_Service; | |
| 131 | +use SeQura\WC\Core\Implementation\BusinessLogic\Domain\Integration\PromotionalWidgets\Mini_Widget_Messages_Provider; | |
| 132 | +use SeQura\WC\Core\Implementation\BusinessLogic\Domain\Integration\PromotionalWidgets\Widget_Configurator; | |
| 133 | +use SeQura\WC\Repositories\Migrations\Migration_Install_400; | |
| 134 | +use SeQura\WC\Repositories\Migrations\Migration_Install_420; | |
| 135 | +use SeQura\WC\Repositories\Migrations\Migration_Install_430; | |
| 136 | +use SeQura\WC\Services\Order\Current_Order_Provider; | |
| 137 | +use SeQura\WC\Services\Order\Interface_Current_Order_Provider; | |
| 138 | +use SeQura\WC\Services\Platform\Interface_Platform_Provider; | |
| 139 | +use SeQura\WC\Services\Platform\Platform_Provider; | |
| 140 | +use SeQura\WC\Services\Widgets\Interface_Widgets_Service; | |
| 141 | +use SeQura\WC\Services\Widgets\Widgets_Service; | |
| 142 | +use SeQura\Core\BusinessLogic\Domain\Integration\Store\StoreIdProvider; | |
| 143 | +use SeQura\Core\BusinessLogic\Domain\Integration\StoreIntegration\StoreIntegrationServiceInterface; | |
| 144 | +use SeQura\Core\BusinessLogic\Domain\Stores\Services\StoreService; | |
| 145 | +use SeQura\Core\Infrastructure\Configuration\ConfigurationManager; | |
| 146 | +use SeQura\WC\Controllers\Rest\Store_Integration_REST_Controller; | |
| 147 | +use SeQura\WC\Core\Extension\BusinessLogic\Domain\Integration\Store\Store_Id_Provider; | |
| 148 | +use SeQura\WC\Core\Implementation\BusinessLogic\Domain\Integration\StoreIntegration\Store_Integration_Service; | |
| 149 | +use SeQura\WC\Services\Order\Builder\Interface_Order_Address_Builder; | |
| 150 | +use SeQura\WC\Services\Order\Builder\Order_Address_Builder; | |
| 151 | +use SeQura\WC\Services\Order\Builder\Interface_Order_Customer_Builder; | |
| 152 | +use SeQura\WC\Services\Order\Builder\Interface_Order_Delivery_Method_Builder; | |
| 153 | +use SeQura\WC\Services\Order\Builder\Order_Customer_Builder; | |
| 154 | +use SeQura\WC\Services\Order\Builder\Order_Delivery_Method_Builder; | |
| 155 | +use SeQura\WC\Services\Service\Interface_Settings_Service; | |
| 156 | +use SeQura\WC\Services\Service\Settings_Service; | |
| 157 | +use SeQura\Core\BusinessLogic\Domain\Integration\StoreInfo\StoreInfoServiceInterface; | |
| 158 | +use SeQura\WC\Core\Implementation\BusinessLogic\Domain\Integration\StoreInfo\Store_Info_Service; | |
| 159 | +use SeQura\Core\BusinessLogic\DataAccess\AdvancedSettings\Entities\AdvancedSettings; | |
| 160 | +use SeQura\Core\BusinessLogic\Domain\AdvancedSettings\Services\AdvancedSettingsService; | |
| 161 | +use SeQura\Core\BusinessLogic\Domain\Integration\Log\LogServiceInterface; | |
| 162 | +use SeQura\WC\Core\Implementation\BusinessLogic\Domain\Integration\Log\Log_Service; | |
| 126 | 163 | |
| 127 | 164 | /** |
| 128 | 165 | * Implementation for the core bootstrap class. |
| 129 | 166 | */ |
| @@ -128,8 +165,9 @@ | ||
| 128 | 165 | * Implementation for the core bootstrap class. |
| 129 | 166 | */ |
| 130 | 167 | class Bootstrap extends BootstrapComponent { |
| 131 | 168 | |
| 169 | + | |
| 132 | 170 | /** |
| 133 | 171 | * Cache for Service instances. |
| 134 | 172 | * |
| 135 | 173 | * @var array<string, mixed> |
| @@ -145,17 +183,10 @@ | ||
| 145 | 183 | |
| 146 | 184 | Reg::registerService( |
| 147 | 185 | Plugin::class, |
| 148 | 186 | static function () { |
| 149 | - $env_data = (array) Reg::getService( 'environment.data' ); | |
| 150 | - $wc_data = (array) Reg::getService( 'woocommerce.data' ); | |
| 151 | - | |
| 152 | 187 | return new Plugin( |
| 153 | - Reg::getService( 'plugin.data' ), | |
| 154 | - $env_data['wp_version'] ?? '', | |
| 155 | - $wc_data['Version'] ?? '', | |
| 156 | - Reg::getService( 'plugin.file_path' ), | |
| 157 | - Reg::getService( 'plugin.basename' ), | |
| 188 | + Reg::getService( Interface_Constants::class ), | |
| 158 | 189 | Reg::getService( Interface_Migration_Manager::class ), |
| 159 | 190 | Reg::getService( Interface_I18n_Controller::class ), |
| 160 | 191 | Reg::getService( Interface_Assets_Controller::class ), |
| 161 | 192 | Reg::getService( Interface_Settings_Controller::class ), |
| @@ -163,8 +194,9 @@ | ||
| 163 | 194 | Reg::getService( General_Settings_REST_Controller::class ), |
| 164 | 195 | Reg::getService( Onboarding_REST_Controller::class ), |
| 165 | 196 | Reg::getService( Payment_REST_Controller::class ), |
| 166 | 197 | Reg::getService( Log_REST_Controller::class ), |
| 198 | + Reg::getService( Store_Integration_REST_Controller::class ), | |
| 167 | 199 | Reg::getService( Interface_Product_Controller::class ), |
| 168 | 200 | Reg::getService( Interface_Async_Process_Controller::class ), |
| 169 | 201 | Reg::getService( Interface_Order_Controller::class ) |
| 170 | 202 | ); |
| @@ -176,105 +208,28 @@ | ||
| 176 | 208 | * Initializes constants. |
| 177 | 209 | */ |
| 178 | 210 | public static function initConstants(): void { |
| 179 | 211 | Reg::registerService( |
| 180 | - 'plugin.dir_path', | |
| 212 | + Interface_Constants::class, | |
| 181 | 213 | static function () { |
| 182 | - if ( ! isset( self::$cache['plugin.dir_path'] ) ) { | |
| 183 | - self::$cache['plugin.dir_path'] = trailingslashit( dirname( __DIR__, 1 ) ); | |
| 184 | - } | |
| 185 | - return self::$cache['plugin.dir_path']; | |
| 186 | - } | |
| 187 | - ); | |
| 188 | - Reg::registerService( | |
| 189 | - 'plugin.file_path', | |
| 190 | - static function () { | |
| 191 | - if ( ! isset( self::$cache['plugin.file_path'] ) ) { | |
| 192 | - self::$cache['plugin.file_path'] = Reg::getService( 'plugin.dir_path' ) . 'sequra.php'; | |
| 193 | - } | |
| 194 | - return self::$cache['plugin.file_path']; | |
| 195 | - } | |
| 196 | - ); | |
| 197 | - Reg::registerService( | |
| 198 | - 'plugin.log_file_path', | |
| 199 | - static function () { | |
| 200 | - if ( ! isset( self::$cache['plugin.log_file_path'] ) ) { | |
| 201 | - self::$cache['plugin.log_file_path'] = Reg::getService( 'plugin.dir_path' ) . 'sequra.{storeId}.log'; | |
| 202 | - } | |
| 203 | - return self::$cache['plugin.log_file_path']; | |
| 204 | - } | |
| 205 | - ); | |
| 206 | 214 | |
| 207 | - Reg::registerService( | |
| 208 | - 'plugin.basename', | |
| 209 | - static function () { | |
| 210 | - if ( ! isset( self::$cache['plugin.basename'] ) ) { | |
| 211 | - self::$cache['plugin.basename'] = plugin_basename( Reg::getService( 'plugin.dir_path' ) . 'sequra.php' ); | |
| 212 | - } | |
| 213 | - return self::$cache['plugin.basename']; | |
| 214 | - } | |
| 215 | - ); | |
| 215 | + if ( ! isset( self::$cache[ Interface_Constants::class ] ) ) { | |
| 216 | + $dir_path = \trailingslashit( dirname( __DIR__, 1 ) ); | |
| 217 | + $plugin_file_path = $dir_path . 'sequra.php'; | |
| 216 | 218 | |
| 217 | - Reg::registerService( | |
| 218 | - 'plugin.dir_url', | |
| 219 | - static function () { | |
| 220 | - if ( ! isset( self::$cache['plugin.dir_url'] ) ) { | |
| 221 | - self::$cache['plugin.dir_url'] = plugin_dir_url( Reg::getService( 'plugin.file_path' ) ); | |
| 222 | - } | |
| 223 | - return self::$cache['plugin.dir_url']; | |
| 224 | - } | |
| 225 | - ); | |
| 226 | - | |
| 227 | - Reg::registerService( | |
| 228 | - 'plugin.rest_namespace', | |
| 229 | - static function () { | |
| 230 | - if ( ! isset( self::$cache['plugin.rest_namespace'] ) ) { | |
| 231 | - self::$cache['plugin.rest_namespace'] = 'sequra/v1'; | |
| 232 | - } | |
| 233 | - return self::$cache['plugin.rest_namespace']; | |
| 234 | - } | |
| 235 | - ); | |
| 236 | - | |
| 237 | - Reg::registerService( | |
| 238 | - 'woocommerce.data', | |
| 239 | - static function () { | |
| 240 | - if ( ! isset( self::$cache['woocommerce.data'] ) ) { | |
| 241 | 219 | if ( ! function_exists( 'get_plugin_data' ) ) { |
| 242 | 220 | require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
| 243 | 221 | } |
| 244 | - self::$cache['woocommerce.data'] = get_plugin_data( WP_PLUGIN_DIR . '/woocommerce/woocommerce.php' ); | |
| 245 | - } | |
| 246 | - return self::$cache['woocommerce.data']; | |
| 247 | - } | |
| 248 | - ); | |
| 249 | - | |
| 250 | - Reg::registerService( | |
| 251 | - 'plugin.data', | |
| 252 | - static function () { | |
| 253 | - if ( ! isset( self::$cache['plugin.data'] ) ) { | |
| 254 | - if ( ! function_exists( 'get_plugin_data' ) ) { | |
| 255 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; | |
| 256 | - } | |
| 257 | 222 | $add_wc_headers = function ( $headers ) { |
| 258 | 223 | $headers['WC requires at least'] = 'WC requires at least'; |
| 259 | 224 | return $headers; |
| 260 | 225 | }; |
| 261 | - add_filter( 'extra_plugin_headers', $add_wc_headers ); | |
| 262 | - $data = get_plugin_data( Reg::getService( 'plugin.file_path' ) ); | |
| 263 | - remove_filter( 'extra_plugin_headers', $add_wc_headers ); | |
| 226 | + \add_filter( 'extra_plugin_headers', $add_wc_headers ); | |
| 227 | + $data = \get_plugin_data( $plugin_file_path, true, false ); | |
| 228 | + \remove_filter( 'extra_plugin_headers', $add_wc_headers ); | |
| 264 | 229 | $data['RequiresWC'] = $data['WC requires at least']; |
| 265 | 230 | unset( $data['WC requires at least'] ); |
| 266 | 231 | |
| 267 | - self::$cache['plugin.data'] = $data; | |
| 268 | - } | |
| 269 | - return self::$cache['plugin.data']; | |
| 270 | - } | |
| 271 | - ); | |
| 272 | - | |
| 273 | - Reg::registerService( | |
| 274 | - 'environment.data', | |
| 275 | - static function () { | |
| 276 | - if ( ! isset( self::$cache['environment.data'] ) ) { | |
| 277 | 232 | /** |
| 278 | 233 | * Database instance. |
| 279 | 234 | * |
| 280 | 235 | * @var \wpdb $wpdb |
| @@ -280,10 +235,10 @@ | ||
| 280 | 235 | * @var \wpdb $wpdb |
| 281 | 236 | */ |
| 282 | 237 | $wpdb = Reg::getService( \wpdb::class ); |
| 283 | 238 | global $wp_version; |
| 284 | - | |
| 285 | - self::$cache['environment.data'] = array( | |
| 239 | + | |
| 240 | + $environment_data = array( | |
| 286 | 241 | 'php_version' => phpversion(), |
| 287 | 242 | 'php_os' => PHP_OS, |
| 288 | 243 | 'uname' => php_uname(), |
| 289 | 244 | 'db_name' => false === strpos( strtolower( $wpdb->db_server_info() ), 'mariadb' ) ? 'mysql' : 'mariadb', |
| @@ -289,40 +244,40 @@ | ||
| 289 | 244 | 'db_name' => false === strpos( strtolower( $wpdb->db_server_info() ), 'mariadb' ) ? 'mysql' : 'mariadb', |
| 290 | 245 | 'db_version' => $wpdb->db_version() ?? '', |
| 291 | 246 | 'wp_version' => strval( $wp_version ), |
| 292 | 247 | ); |
| 248 | + | |
| 249 | + $dir_url = \plugin_dir_url( $plugin_file_path ); | |
| 250 | + | |
| 251 | + self::$cache[ Interface_Constants::class ] = new Constants( | |
| 252 | + $dir_path, | |
| 253 | + $plugin_file_path, | |
| 254 | + $dir_path . 'sequra.{storeId}.log', | |
| 255 | + \plugin_basename( $plugin_file_path ), | |
| 256 | + $dir_url, | |
| 257 | + 'sequra/v1', | |
| 258 | + $data, | |
| 259 | + \get_plugin_data( WP_PLUGIN_DIR . '/woocommerce/woocommerce.php', true, false ), | |
| 260 | + $environment_data, | |
| 261 | + $dir_path . 'templates/', | |
| 262 | + $dir_path . 'assets', | |
| 263 | + \untrailingslashit( $dir_url ) . '/assets' | |
| 264 | + ); | |
| 293 | 265 | } |
| 294 | - return self::$cache['environment.data']; | |
| 266 | + | |
| 267 | + return self::$cache[ Interface_Constants::class ]; | |
| 295 | 268 | } |
| 296 | 269 | ); |
| 270 | + } | |
| 297 | 271 | |
| 298 | - Reg::registerService( | |
| 299 | - 'plugin.templates_path', | |
| 300 | - static function () { | |
| 301 | - if ( ! isset( self::$cache['plugin.templates_path'] ) ) { | |
| 302 | - self::$cache['plugin.templates_path'] = Reg::getService( 'plugin.dir_path' ) . 'templates/'; | |
| 303 | - } | |
| 304 | - return self::$cache['plugin.templates_path']; | |
| 305 | - } | |
| 306 | - ); | |
| 307 | - Reg::registerService( | |
| 308 | - 'plugin.assets_path', | |
| 309 | - static function () { | |
| 310 | - if ( ! isset( self::$cache['plugin.assets_path'] ) ) { | |
| 311 | - self::$cache['plugin.assets_path'] = Reg::getService( 'plugin.dir_path' ) . 'assets'; | |
| 312 | - } | |
| 313 | - return self::$cache['plugin.assets_path']; | |
| 314 | - } | |
| 315 | - ); | |
| 316 | - Reg::registerService( | |
| 317 | - 'plugin.assets_url', | |
| 318 | - static function () { | |
| 319 | - if ( ! isset( self::$cache['plugin.assets_url'] ) ) { | |
| 320 | - self::$cache['plugin.assets_url'] = untrailingslashit( Reg::getService( 'plugin.dir_url' ) ) . '/assets'; | |
| 321 | - } | |
| 322 | - return self::$cache['plugin.assets_url']; | |
| 323 | - } | |
| 324 | - ); | |
| 272 | + /** | |
| 273 | + * Get the constants instance. | |
| 274 | + * | |
| 275 | + * @return Interface_Constants | |
| 276 | + * @throws ServiceNotRegisteredException | |
| 277 | + */ | |
| 278 | + private static function get_constants() { | |
| 279 | + return Reg::getService( Interface_Constants::class ); | |
| 325 | 280 | } |
| 326 | 281 | |
| 327 | 282 | /** |
| 328 | 283 | * Initializes services and utilities. |
| @@ -331,9 +286,9 @@ | ||
| 331 | 286 | parent::initServices(); |
| 332 | 287 | |
| 333 | 288 | // Core Default. |
| 334 | 289 | Reg::registerService( |
| 335 | - LoggerConfiguration::class, | |
| 290 | + LoggerConfiguration::class, | |
| 336 | 291 | static function () { |
| 337 | 292 | if ( ! isset( self::$cache[ LoggerConfiguration::class ] ) ) { |
| 338 | 293 | $loggerConfig = LoggerConfiguration::getInstance(); |
| 339 | 294 | if ( ! $loggerConfig->isDefaultLoggerEnabled() ) { |
| @@ -363,50 +318,58 @@ | ||
| 363 | 318 | static function () { |
| 364 | 319 | return Reg::getService( Order_Status_Settings_Service::class ); |
| 365 | 320 | } |
| 366 | 321 | ); |
| 322 | + // Extend Configuration. | |
| 367 | 323 | Reg::registerService( |
| 368 | 324 | Configuration::class, |
| 369 | 325 | static function () { |
| 370 | 326 | if ( ! isset( self::$cache[ Configuration::class ] ) ) { |
| 371 | - self::$cache[ Configuration::class ] = Configuration::getInstance(); | |
| 327 | + self::$cache[ Configuration::class ] = \SeQura\WC\Core\Extension\Infrastructure\Configuration\Configuration::getInstance(); | |
| 372 | 328 | } |
| 373 | 329 | return self::$cache[ Configuration::class ]; |
| 374 | 330 | } |
| 375 | 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 | + */ | |
| 376 | 338 | Reg::registerService( |
| 377 | - \SeQura\Core\Infrastructure\Configuration\Configuration::CLASS_NAME, | |
| 339 | + StoreIdProvider::class, | |
| 378 | 340 | static function () { |
| 379 | - 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 ]; | |
| 380 | 345 | } |
| 381 | 346 | ); |
| 347 | + | |
| 382 | 348 | Reg::registerService( |
| 383 | 349 | Interface_Create_Order_Request_Builder::class, |
| 384 | 350 | static function () { |
| 385 | 351 | if ( ! isset( self::$cache[ Interface_Create_Order_Request_Builder::class ] ) ) { |
| 386 | 352 | self::$cache[ Interface_Create_Order_Request_Builder::class ] = new Create_Order_Request_Builder( |
| 387 | - Reg::getService( Interface_Payment_Service::class ), | |
| 388 | 353 | Reg::getService( Interface_Cart_Service::class ), |
| 389 | - Reg::getService( Configuration::class ), | |
| 354 | + Reg::getService( Interface_Platform_Provider::class ), | |
| 390 | 355 | Reg::getService( Interface_Product_Service::class ), |
| 391 | 356 | Reg::getService( Interface_Order_Service::class ), |
| 392 | 357 | Reg::getService( Interface_I18n::class ), |
| 393 | 358 | Reg::getService( Interface_Shopper_Service::class ), |
| 394 | - 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 ) | |
| 395 | 367 | ); |
| 396 | 368 | } |
| 397 | 369 | return self::$cache[ Interface_Create_Order_Request_Builder::class ]; |
| 398 | 370 | } |
| 399 | 371 | ); |
| 400 | - Reg::registerService( | |
| 401 | - AbstractItemFactory::class, | |
| 402 | - static function () { | |
| 403 | - if ( ! isset( self::$cache[ AbstractItemFactory::class ] ) ) { | |
| 404 | - self::$cache[ AbstractItemFactory::class ] = new Item_Factory(); | |
| 405 | - } | |
| 406 | - return self::$cache[ AbstractItemFactory::class ]; | |
| 407 | - } | |
| 408 | - ); | |
| 409 | 372 | |
| 410 | 373 | // Core Implementation. |
| 411 | 374 | Reg::registerService( |
| 412 | 375 | EncryptorInterface::class, |
| @@ -426,10 +389,8 @@ | ||
| 426 | 389 | RepositoryRegistry::getRepository( ConnectionData::class ), |
| 427 | 390 | RepositoryRegistry::getRepository( StatisticalData::class ), |
| 428 | 391 | RepositoryRegistry::getRepository( SendReport::class ), |
| 429 | 392 | RepositoryRegistry::getRepository( QueueItem::class ), |
| 430 | - //phpcs:ignore | |
| 431 | - // RepositoryRegistry::getRepository( SeQuraOrder::class ), | |
| 432 | 393 | ) |
| 433 | 394 | ); |
| 434 | 395 | } |
| 435 | 396 | return self::$cache[ DisconnectServiceInterface::class ]; |
| @@ -439,18 +400,46 @@ | ||
| 439 | 400 | OrderReportServiceInterface::class, |
| 440 | 401 | static function () { |
| 441 | 402 | if ( ! isset( self::$cache[ OrderReportServiceInterface::class ] ) ) { |
| 442 | 403 | self::$cache[ OrderReportServiceInterface::class ] = new Order_Report_Service( |
| 443 | - Reg::getService( Configuration::CLASS_NAME ), | |
| 404 | + Reg::getService( Interface_Platform_Provider::class ), | |
| 444 | 405 | Reg::getService( Interface_Pricing_Service::class ), |
| 445 | 406 | Reg::getService( Interface_Cart_Service::class ), |
| 446 | 407 | Reg::getService( Interface_Order_Service::class ), |
| 447 | - 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 ) | |
| 448 | 412 | ); |
| 449 | 413 | } |
| 450 | 414 | return self::$cache[ OrderReportServiceInterface::class ]; |
| 451 | 415 | } |
| 452 | 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 | + ); | |
| 453 | 442 | |
| 454 | 443 | |
| 455 | 444 | Reg::registerService( |
| 456 | 445 | Serializer::class, |
| @@ -483,9 +472,9 @@ | ||
| 483 | 472 | VersionServiceInterface::class, |
| 484 | 473 | static function () { |
| 485 | 474 | if ( ! isset( self::$cache[ VersionServiceInterface::class ] ) ) { |
| 486 | 475 | self::$cache[ VersionServiceInterface::class ] = new Version_Service( |
| 487 | - Reg::getService( 'plugin.data' )['Version'] | |
| 476 | + self::get_constants()->get_plugin_data()['Version'] | |
| 488 | 477 | ); |
| 489 | 478 | } |
| 490 | 479 | return self::$cache[ VersionServiceInterface::class ]; |
| 491 | 480 | } |
| @@ -528,8 +517,18 @@ | ||
| 528 | 517 | } |
| 529 | 518 | return self::$cache[ DefaultLoggerAdapter::CLASS_NAME ]; |
| 530 | 519 | } |
| 531 | 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 | + ); | |
| 532 | 531 | |
| 533 | 532 | // Plugin services. |
| 534 | 533 | Reg::registerService( |
| 535 | 534 | Interface_Log_File::class, |
| @@ -535,9 +534,10 @@ | ||
| 535 | 534 | Interface_Log_File::class, |
| 536 | 535 | static function () { |
| 537 | 536 | if ( ! isset( self::$cache[ Interface_Log_File::class ] ) ) { |
| 538 | 537 | self::$cache[ Interface_Log_File::class ] = new Log_File( |
| 539 | - Reg::getService( 'plugin.log_file_path' ) | |
| 538 | + self::get_constants()->get_plugin_log_file_path(), | |
| 539 | + Reg::getService( StoreContext::class ) | |
| 540 | 540 | ); |
| 541 | 541 | } |
| 542 | 542 | return self::$cache[ Interface_Log_File::class ]; |
| 543 | 543 | } |
| @@ -545,17 +545,87 @@ | ||
| 545 | 545 | Reg::registerService( |
| 546 | 546 | Interface_Migration_Manager::class, |
| 547 | 547 | static function () { |
| 548 | 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 | + | |
| 549 | 591 | self::$cache[ Interface_Migration_Manager::class ] = new Migration_Manager( |
| 550 | - Reg::getService( 'plugin.basename' ), | |
| 551 | - Reg::getService( Configuration::CLASS_NAME ), | |
| 552 | - Reg::getService( 'plugin.data' )['Version'], | |
| 592 | + self::get_constants()->get_plugin_basename(), | |
| 593 | + $configuration, | |
| 594 | + self::get_constants()->get_plugin_data()['Version'], | |
| 553 | 595 | array( |
| 554 | - new Migration_Install_300( | |
| 555 | - Reg::getService( \wpdb::class ), | |
| 556 | - Reg::getService( Configuration::CLASS_NAME ) | |
| 596 | + new Migration_Install_300( | |
| 597 | + $wpdb, | |
| 598 | + $cache_repository, | |
| 599 | + $order_repository, | |
| 600 | + $entity_repository, | |
| 601 | + $queue_item_repository, | |
| 602 | + $store_context | |
| 557 | 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 | + ), | |
| 558 | 628 | ) |
| 559 | 629 | ); |
| 560 | 630 | } |
| 561 | 631 | return self::$cache[ Interface_Migration_Manager::class ]; |
| @@ -570,28 +640,16 @@ | ||
| 570 | 640 | return self::$cache[ Interface_I18n::class ]; |
| 571 | 641 | } |
| 572 | 642 | ); |
| 573 | 643 | Reg::registerService( |
| 574 | - Interface_Regex::class, | |
| 575 | - static function () { | |
| 576 | - if ( ! isset( self::$cache[ Interface_Regex::class ] ) ) { | |
| 577 | - self::$cache[ Interface_Regex::class ] = new Regex(); | |
| 578 | - } | |
| 579 | - return self::$cache[ Interface_Regex::class ]; | |
| 580 | - } | |
| 581 | - ); | |
| 582 | - Reg::registerService( | |
| 583 | 644 | Interface_Report_Service::class, |
| 584 | 645 | static function () { |
| 585 | 646 | if ( ! isset( self::$cache[ Interface_Report_Service::class ] ) ) { |
| 586 | 647 | self::$cache[ Interface_Report_Service::class ] = new Report_Service( |
| 587 | - Reg::getService( Configuration::class ), | |
| 588 | - Reg::getService( StoreService::class ), | |
| 589 | 648 | Reg::getService( ShopOrderService::class ), |
| 590 | 649 | Reg::getService( StatisticalDataRepositoryInterface::class ), |
| 591 | 650 | Reg::getService( CountryConfigurationRepositoryInterface::class ), |
| 592 | - Reg::getService( Interface_Order_Service::class ), | |
| 593 | - Reg::getService( StoreContext::class ) | |
| 651 | + Reg::getService( Interface_Order_Service::class ) | |
| 594 | 652 | ); |
| 595 | 653 | } |
| 596 | 654 | return self::$cache[ Interface_Report_Service::class ]; |
| 597 | 655 | } |
| @@ -607,28 +665,17 @@ | ||
| 607 | 665 | } |
| 608 | 666 | return self::$cache[ Interface_Logger_Service::class ]; |
| 609 | 667 | } |
| 610 | 668 | ); |
| 669 | + | |
| 611 | 670 | Reg::registerService( |
| 612 | - Interface_Payment_Service::class, | |
| 613 | - static function () { | |
| 614 | - if ( ! isset( self::$cache[ Interface_Payment_Service::class ] ) ) { | |
| 615 | - self::$cache[ Interface_Payment_Service::class ] = new Payment_Service( | |
| 616 | - Reg::getService( Configuration::class ), | |
| 617 | - Reg::getService( Interface_I18n::class ) | |
| 618 | - ); | |
| 619 | - } | |
| 620 | - return self::$cache[ Interface_Payment_Service::class ]; | |
| 621 | - } | |
| 622 | - ); | |
| 623 | - Reg::registerService( | |
| 624 | 671 | Sequra_Payment_Gateway_Block_Support::class, |
| 625 | 672 | static function () { |
| 626 | 673 | if ( ! isset( self::$cache[ Sequra_Payment_Gateway_Block_Support::class ] ) ) { |
| 627 | 674 | self::$cache[ Sequra_Payment_Gateway_Block_Support::class ] = new Sequra_Payment_Gateway_Block_Support( |
| 628 | - Reg::getService( 'plugin.assets_path' ), | |
| 629 | - Reg::getService( 'plugin.assets_url' ), | |
| 630 | - Reg::getService( 'plugin.data' )['Version'] | |
| 675 | + self::get_constants()->get_plugin_assets_path(), | |
| 676 | + self::get_constants()->get_plugin_assets_url(), | |
| 677 | + self::get_constants()->get_plugin_data()['Version'] | |
| 631 | 678 | ); |
| 632 | 679 | } |
| 633 | 680 | return self::$cache[ Sequra_Payment_Gateway_Block_Support::class ]; |
| 634 | 681 | } |
| @@ -645,15 +692,27 @@ | ||
| 645 | 692 | Reg::registerService( |
| 646 | 693 | Interface_Order_Service::class, |
| 647 | 694 | static function () { |
| 648 | 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 | + | |
| 649 | 703 | self::$cache[ Interface_Order_Service::class ] = new Order_Service( |
| 650 | - Reg::getService( Interface_Payment_Service::class ), | |
| 704 | + Reg::getService( SeQuraOrderRepositoryInterface::class ), | |
| 651 | 705 | Reg::getService( Interface_Pricing_Service::class ), |
| 652 | 706 | Reg::getService( OrderStatusSettingsService::class ), |
| 653 | - Reg::getService( Configuration::class ), | |
| 654 | 707 | Reg::getService( Interface_Cart_Service::class ), |
| 655 | - Reg::getService( StoreContext::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 ) | |
| 656 | 715 | ); |
| 657 | 716 | } |
| 658 | 717 | return self::$cache[ Interface_Order_Service::class ]; |
| 659 | 718 | } |
| @@ -663,11 +722,11 @@ | ||
| 663 | 722 | static function () { |
| 664 | 723 | if ( ! isset( self::$cache[ Interface_Cart_Service::class ] ) ) { |
| 665 | 724 | self::$cache[ Interface_Cart_Service::class ] = new Cart_Service( |
| 666 | 725 | Reg::getService( Interface_Product_Service::class ), |
| 667 | - Reg::getService( Configuration::class ), | |
| 668 | 726 | Reg::getService( Interface_Pricing_Service::class ), |
| 669 | - Reg::getService( Interface_Logger_Service::class ) | |
| 727 | + Reg::getService( Interface_Logger_Service::class ), | |
| 728 | + Reg::getService( Interface_Shopper_Service::class ) | |
| 670 | 729 | ); |
| 671 | 730 | } |
| 672 | 731 | return self::$cache[ Interface_Cart_Service::class ]; |
| 673 | 732 | } |
| @@ -676,11 +735,11 @@ | ||
| 676 | 735 | Interface_Product_Service::class, |
| 677 | 736 | static function () { |
| 678 | 737 | if ( ! isset( self::$cache[ Interface_Product_Service::class ] ) ) { |
| 679 | 738 | self::$cache[ Interface_Product_Service::class ] = new Product_Service( |
| 680 | - Reg::getService( Configuration::class ), | |
| 681 | 739 | Reg::getService( Interface_Pricing_Service::class ), |
| 682 | - Reg::getService( Interface_Regex::class ) | |
| 740 | + Reg::getService( RegexProvider::class ), | |
| 741 | + Reg::getService( StoreContext::class ) | |
| 683 | 742 | ); |
| 684 | 743 | } |
| 685 | 744 | return self::$cache[ Interface_Product_Service::class ]; |
| 686 | 745 | } |
| @@ -688,9 +747,11 @@ | ||
| 688 | 747 | Reg::registerService( |
| 689 | 748 | Interface_Shopper_Service::class, |
| 690 | 749 | static function () { |
| 691 | 750 | if ( ! isset( self::$cache[ Interface_Shopper_Service::class ] ) ) { |
| 692 | - 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 | + ); | |
| 693 | 754 | } |
| 694 | 755 | return self::$cache[ Interface_Shopper_Service::class ]; |
| 695 | 756 | } |
| 696 | 757 | ); |
| @@ -699,9 +760,12 @@ | ||
| 699 | 760 | static function () { |
| 700 | 761 | if ( ! isset( self::$cache[ ShopOrderService::class ] ) ) { |
| 701 | 762 | self::$cache[ ShopOrderService::class ] = new Shop_Order_Service( |
| 702 | 763 | Reg::getService( SeQuraOrderRepositoryInterface::class ), |
| 703 | - Reg::getService( Interface_Logger_Service::class ) | |
| 764 | + Reg::getService( Interface_Logger_Service::class ), | |
| 765 | + Reg::getService( Interface_Create_Order_Request_Builder::class ), | |
| 766 | + Reg::getService( Interface_Current_Order_Provider::class ), | |
| 767 | + Reg::getService( OrderService::class ) | |
| 704 | 768 | ); |
| 705 | 769 | } |
| 706 | 770 | return self::$cache[ ShopOrderService::class ]; |
| 707 | 771 | } |
| @@ -706,16 +770,168 @@ | ||
| 706 | 770 | return self::$cache[ ShopOrderService::class ]; |
| 707 | 771 | } |
| 708 | 772 | ); |
| 709 | 773 | Reg::registerService( |
| 710 | - Interface_Assets::class, | |
| 774 | + Interface_Time_Checker_Service::class, | |
| 711 | 775 | static function () { |
| 712 | - if ( ! isset( self::$cache[ Interface_Assets::class ] ) ) { | |
| 713 | - 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(); | |
| 714 | 778 | } |
| 715 | - return self::$cache[ Interface_Assets::class ]; | |
| 779 | + return self::$cache[ Interface_Time_Checker_Service::class ]; | |
| 716 | 780 | } |
| 717 | 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 | + ); | |
| 718 | 934 | } |
| 719 | 935 | |
| 720 | 936 | /** |
| 721 | 937 | * Initializes repositories. |
| @@ -732,31 +948,19 @@ | ||
| 732 | 948 | return self::$cache[ \wpdb::class ]; |
| 733 | 949 | } |
| 734 | 950 | ); |
| 735 | 951 | |
| 736 | - parent::initRepositories(); | |
| 737 | - | |
| 738 | - // Extend GeneralSettingsRepository. | |
| 739 | 952 | Reg::registerService( |
| 740 | - GeneralSettingsRepositoryInterface::class, | |
| 953 | + Interface_Cache_Repository::class, | |
| 741 | 954 | static function () { |
| 742 | - return new General_Settings_Repository( | |
| 743 | - RepositoryRegistry::getRepository( GeneralSettings::getClassName() ), | |
| 744 | - Reg::getService( StoreContext::class ) | |
| 745 | - ); | |
| 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 ]; | |
| 746 | 959 | } |
| 747 | 960 | ); |
| 748 | 961 | |
| 749 | - // Extend WidgetSettingsRepository. | |
| 750 | - Reg::registerService( | |
| 751 | - WidgetSettingsRepositoryInterface::class, | |
| 752 | - static function () { | |
| 753 | - return new Widget_Settings_Repository( | |
| 754 | - RepositoryRegistry::getRepository( WidgetSettings::getClassName() ), | |
| 755 | - Reg::getService( StoreContext::class ) | |
| 756 | - ); | |
| 757 | - } | |
| 758 | - ); | |
| 962 | + parent::initRepositories(); | |
| 759 | 963 | |
| 760 | 964 | RepositoryRegistry::registerRepository( ConfigEntity::class, Entity_Repository::class ); |
| 761 | 965 | RepositoryRegistry::registerRepository( QueueItem::class, Queue_Item_Repository::class ); |
| 762 | 966 | RepositoryRegistry::registerRepository( Process::class, Entity_Repository::class ); |
| @@ -768,8 +972,12 @@ | ||
| 768 | 972 | RepositoryRegistry::registerRepository( SeQuraOrder::class, SeQura_Order_Repository::class ); |
| 769 | 973 | RepositoryRegistry::registerRepository( WidgetSettings::class, Entity_Repository::class ); |
| 770 | 974 | RepositoryRegistry::registerRepository( SendReport::class, Entity_Repository::class ); |
| 771 | 975 | RepositoryRegistry::registerRepository( TransactionLog::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 ); | |
| 772 | 980 | } |
| 773 | 981 | |
| 774 | 982 | /** |
| 775 | 983 | * Initializes controllers. |
| @@ -776,41 +984,20 @@ | ||
| 776 | 984 | */ |
| 777 | 985 | protected static function initControllers(): void { |
| 778 | 986 | parent::initControllers(); |
| 779 | 987 | |
| 780 | - // Extend GeneralSettingsController. | |
| 781 | - Reg::registerService( | |
| 782 | - GeneralSettingsController::class, | |
| 783 | - static function () { | |
| 784 | - return new General_Settings_Controller( | |
| 785 | - Reg::getService( GeneralSettingsService::class ), | |
| 786 | - Reg::getService( CategoryService::class ) | |
| 787 | - ); | |
| 788 | - } | |
| 789 | - ); | |
| 790 | - | |
| 791 | - // Extend PromotionalWidgetsController. | |
| 792 | - Reg::registerService( | |
| 793 | - PromotionalWidgetsController::class, | |
| 794 | - static function () { | |
| 795 | - return new Promotional_Widgets_Controller( | |
| 796 | - Reg::getService( WidgetSettingsService::class ) | |
| 797 | - ); | |
| 798 | - } | |
| 799 | - ); | |
| 800 | - | |
| 801 | 988 | // Plugin controllers. |
| 802 | 989 | Reg::registerService( |
| 803 | 990 | Interface_I18n_Controller::class, |
| 804 | 991 | static function () { |
| 805 | 992 | if ( ! isset( self::$cache[ Interface_I18n_Controller::class ] ) ) { |
| 806 | - $data = Reg::getService( 'plugin.data' ); | |
| 993 | + $data = self::get_constants()->get_plugin_data(); | |
| 807 | 994 | $domain = $data['TextDomain']; |
| 808 | - self::$cache[ Interface_I18n_Controller::class ] = new I18n_Controller( | |
| 995 | + self::$cache[ Interface_I18n_Controller::class ] = new I18n_Controller( | |
| 809 | 996 | $domain . $data['DomainPath'], |
| 810 | 997 | $domain, |
| 811 | 998 | Reg::getService( Interface_Logger_Service::class ), |
| 812 | - Reg::getService( 'plugin.templates_path' ) | |
| 999 | + self::get_constants()->get_plugin_templates_path() | |
| 813 | 1000 | ); |
| 814 | 1001 | } |
| 815 | 1002 | return self::$cache[ Interface_I18n_Controller::class ]; |
| 816 | 1003 | } |
| @@ -818,21 +1005,21 @@ | ||
| 818 | 1005 | Reg::registerService( |
| 819 | 1006 | Interface_Assets_Controller::class, |
| 820 | 1007 | static function () { |
| 821 | 1008 | if ( ! isset( self::$cache[ Interface_Assets_Controller::class ] ) ) { |
| 822 | - $env_data = (array) Reg::getService( 'environment.data' ); | |
| 1009 | + $env_data = self::get_constants()->get_environment_data(); | |
| 823 | 1010 | self::$cache[ Interface_Assets_Controller::class ] = new Assets_Controller( |
| 824 | - Reg::getService( 'plugin.assets_url' ), | |
| 825 | - Reg::getService( 'plugin.assets_path' ), | |
| 826 | - Reg::getService( 'plugin.data' )['Version'], | |
| 1011 | + self::get_constants()->get_plugin_assets_url(), | |
| 1012 | + self::get_constants()->get_plugin_assets_path(), | |
| 1013 | + self::get_constants()->get_plugin_data()['Version'], | |
| 827 | 1014 | $env_data['wp_version'] ?? '', |
| 828 | 1015 | Reg::getService( Interface_I18n::class ), |
| 829 | 1016 | Reg::getService( Interface_Logger_Service::class ), |
| 830 | - Reg::getService( 'plugin.templates_path' ), | |
| 831 | - Reg::getService( Configuration::class ), | |
| 832 | - Reg::getService( Interface_Assets::class ), | |
| 1017 | + self::get_constants()->get_plugin_templates_path(), | |
| 1018 | + Reg::getService( Interface_Settings_Service::class ), | |
| 833 | 1019 | Reg::getService( Interface_Payment_Method_Service::class ), |
| 834 | - Reg::getService( Interface_Regex::class ) | |
| 1020 | + Reg::getService( RegexProvider::class ), | |
| 1021 | + Reg::getService( Interface_Widgets_Service::class ) | |
| 835 | 1022 | ); |
| 836 | 1023 | } |
| 837 | 1024 | return self::$cache[ Interface_Assets_Controller::class ]; |
| 838 | 1025 | } |
| @@ -841,12 +1028,12 @@ | ||
| 841 | 1028 | Interface_Settings_Controller::class, |
| 842 | 1029 | static function () { |
| 843 | 1030 | if ( ! isset( self::$cache[ Interface_Settings_Controller::class ] ) ) { |
| 844 | 1031 | self::$cache[ Interface_Settings_Controller::class ] = new Settings_Controller( |
| 845 | - Reg::getService( 'plugin.templates_path' ), | |
| 846 | - Reg::getService( Configuration::class ), | |
| 1032 | + self::get_constants()->get_plugin_templates_path(), | |
| 1033 | + Reg::getService( Interface_Settings_Service::class ), | |
| 847 | 1034 | Reg::getService( Interface_Logger_Service::class ), |
| 848 | - Reg::getService( 'plugin.basename' ) | |
| 1035 | + self::get_constants()->get_plugin_basename() | |
| 849 | 1036 | ); |
| 850 | 1037 | } |
| 851 | 1038 | return self::$cache[ Interface_Settings_Controller::class ]; |
| 852 | 1039 | } |
| @@ -856,9 +1043,9 @@ | ||
| 856 | 1043 | static function () { |
| 857 | 1044 | if ( ! isset( self::$cache[ Interface_Payment_Controller::class ] ) ) { |
| 858 | 1045 | self::$cache[ Interface_Payment_Controller::class ] = new Payment_Controller( |
| 859 | 1046 | Reg::getService( Interface_Logger_Service::class ), |
| 860 | - Reg::getService( 'plugin.templates_path' ), | |
| 1047 | + self::get_constants()->get_plugin_templates_path(), | |
| 861 | 1048 | Reg::getService( Interface_Order_Service::class ) |
| 862 | 1049 | ); |
| 863 | 1050 | } |
| 864 | 1051 | return self::$cache[ Interface_Payment_Controller::class ]; |
| @@ -869,15 +1056,12 @@ | ||
| 869 | 1056 | static function () { |
| 870 | 1057 | if ( ! isset( self::$cache[ Interface_Product_Controller::class ] ) ) { |
| 871 | 1058 | self::$cache[ Interface_Product_Controller::class ] = new Product_Controller( |
| 872 | 1059 | Reg::getService( Interface_Logger_Service::class ), |
| 873 | - Reg::getService( 'plugin.templates_path' ), | |
| 874 | - Reg::getService( Configuration::class ), | |
| 1060 | + self::get_constants()->get_plugin_templates_path(), | |
| 875 | 1061 | Reg::getService( Interface_Product_Service::class ), |
| 876 | - Reg::getService( Interface_Payment_Service::class ), | |
| 877 | - Reg::getService( Interface_Payment_Method_Service::class ), | |
| 878 | - Reg::getService( Interface_I18n::class ), | |
| 879 | - Reg::getService( Interface_Regex::class ) | |
| 1062 | + Reg::getService( RegexProvider::class ), | |
| 1063 | + Reg::getService( Interface_Widgets_Service::class ) | |
| 880 | 1064 | ); |
| 881 | 1065 | } |
| 882 | 1066 | return self::$cache[ Interface_Product_Controller::class ]; |
| 883 | 1067 | } |
| @@ -887,9 +1071,9 @@ | ||
| 887 | 1071 | static function () { |
| 888 | 1072 | if ( ! isset( self::$cache[ Interface_Async_Process_Controller::class ] ) ) { |
| 889 | 1073 | self::$cache[ Interface_Async_Process_Controller::class ] = new Async_Process_Controller( |
| 890 | 1074 | Reg::getService( Interface_Logger_Service::class ), |
| 891 | - Reg::getService( 'plugin.templates_path' ), | |
| 1075 | + self::get_constants()->get_plugin_templates_path(), | |
| 892 | 1076 | Reg::getService( Interface_Report_Service::class ) |
| 893 | 1077 | ); |
| 894 | 1078 | } |
| 895 | 1079 | return self::$cache[ Interface_Async_Process_Controller::class ]; |
| @@ -900,10 +1084,11 @@ | ||
| 900 | 1084 | static function () { |
| 901 | 1085 | if ( ! isset( self::$cache[ Interface_Order_Controller::class ] ) ) { |
| 902 | 1086 | self::$cache[ Interface_Order_Controller::class ] = new Order_Controller( |
| 903 | 1087 | Reg::getService( Interface_Logger_Service::class ), |
| 904 | - Reg::getService( 'plugin.templates_path' ), | |
| 905 | - Reg::getService( Interface_Order_Service::class ) | |
| 1088 | + self::get_constants()->get_plugin_templates_path(), | |
| 1089 | + Reg::getService( Interface_Order_Service::class ), | |
| 1090 | + Reg::getService( Interface_Cart_Service::class ) | |
| 906 | 1091 | ); |
| 907 | 1092 | } |
| 908 | 1093 | return self::$cache[ Interface_Order_Controller::class ]; |
| 909 | 1094 | } |
| @@ -912,10 +1097,11 @@ | ||
| 912 | 1097 | Onboarding_REST_Controller::class, |
| 913 | 1098 | static function () { |
| 914 | 1099 | if ( ! isset( self::$cache[ Onboarding_REST_Controller::class ] ) ) { |
| 915 | 1100 | self::$cache[ Onboarding_REST_Controller::class ] = new Onboarding_REST_Controller( |
| 916 | - Reg::getService( 'plugin.rest_namespace' ), | |
| 917 | - Reg::getService( Interface_Logger_Service::class ) | |
| 1101 | + self::get_constants()->get_plugin_rest_namespace(), | |
| 1102 | + Reg::getService( Interface_Logger_Service::class ), | |
| 1103 | + Reg::getService( RegexProvider::class ) | |
| 918 | 1104 | ); |
| 919 | 1105 | } |
| 920 | 1106 | return self::$cache[ Onboarding_REST_Controller::class ]; |
| 921 | 1107 | } |
| @@ -924,11 +1110,11 @@ | ||
| 924 | 1110 | Payment_REST_Controller::class, |
| 925 | 1111 | static function () { |
| 926 | 1112 | if ( ! isset( self::$cache[ Payment_REST_Controller::class ] ) ) { |
| 927 | 1113 | self::$cache[ Payment_REST_Controller::class ] = new Payment_REST_Controller( |
| 928 | - Reg::getService( 'plugin.rest_namespace' ), | |
| 1114 | + self::get_constants()->get_plugin_rest_namespace(), | |
| 929 | 1115 | Reg::getService( Interface_Logger_Service::class ), |
| 930 | - Reg::getService( Interface_Payment_Method_Service::class ) | |
| 1116 | + Reg::getService( RegexProvider::class ) | |
| 931 | 1117 | ); |
| 932 | 1118 | } |
| 933 | 1119 | return self::$cache[ Payment_REST_Controller::class ]; |
| 934 | 1120 | } |
| @@ -937,10 +1123,12 @@ | ||
| 937 | 1123 | General_Settings_REST_Controller::class, |
| 938 | 1124 | static function () { |
| 939 | 1125 | if ( ! isset( self::$cache[ General_Settings_REST_Controller::class ] ) ) { |
| 940 | 1126 | self::$cache[ General_Settings_REST_Controller::class ] = new General_Settings_REST_Controller( |
| 941 | - Reg::getService( 'plugin.rest_namespace' ), | |
| 942 | - Reg::getService( Interface_Logger_Service::class ) | |
| 1127 | + self::get_constants()->get_plugin_rest_namespace(), | |
| 1128 | + Reg::getService( Interface_Logger_Service::class ), | |
| 1129 | + Reg::getService( RegexProvider::class ), | |
| 1130 | + Reg::getService( StoreContext::class ) | |
| 943 | 1131 | ); |
| 944 | 1132 | } |
| 945 | 1133 | return self::$cache[ General_Settings_REST_Controller::class ]; |
| 946 | 1134 | } |
| @@ -949,10 +1137,12 @@ | ||
| 949 | 1137 | Log_REST_Controller::class, |
| 950 | 1138 | static function () { |
| 951 | 1139 | if ( ! isset( self::$cache[ Log_REST_Controller::class ] ) ) { |
| 952 | 1140 | self::$cache[ Log_REST_Controller::class ] = new Log_REST_Controller( |
| 953 | - Reg::getService( 'plugin.rest_namespace' ), | |
| 954 | - Reg::getService( Interface_Logger_Service::class ) | |
| 1141 | + self::get_constants()->get_plugin_rest_namespace(), | |
| 1142 | + Reg::getService( Interface_Logger_Service::class ), | |
| 1143 | + Reg::getService( RegexProvider::class ), | |
| 1144 | + Reg::getService( AdvancedSettingsService::class ) | |
| 955 | 1145 | ); |
| 956 | 1146 | } |
| 957 | 1147 | return self::$cache[ Log_REST_Controller::class ]; |
| 958 | 1148 | } |
| @@ -957,19 +1147,20 @@ | ||
| 957 | 1147 | return self::$cache[ Log_REST_Controller::class ]; |
| 958 | 1148 | } |
| 959 | 1149 | ); |
| 960 | 1150 | Reg::registerService( |
| 961 | - Interface_Payment_Method_Service::class, | |
| 1151 | + Store_Integration_REST_Controller::class, | |
| 962 | 1152 | static function () { |
| 963 | - if ( ! isset( self::$cache[ Interface_Payment_Method_Service::class ] ) ) { | |
| 964 | - self::$cache[ Interface_Payment_Method_Service::class ] = new Payment_Method_Service( | |
| 965 | - Reg::getService( Configuration::class ), | |
| 966 | - Reg::getService( Interface_Create_Order_Request_Builder::class ), | |
| 967 | - Reg::getService( Interface_Order_Service::class ), | |
| 968 | - Reg::getService( Interface_Logger_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(), | |
| 1156 | + Reg::getService( Interface_Logger_Service::class ), | |
| 1157 | + Reg::getService( RegexProvider::class ), | |
| 1158 | + Reg::getService( StoreIntegrationServiceInterface::class ), | |
| 1159 | + Reg::getService( StoreContext::class ) | |
| 969 | 1160 | ); |
| 970 | 1161 | } |
| 971 | - return self::$cache[ Interface_Payment_Method_Service::class ]; | |
| 1162 | + return self::$cache[ Store_Integration_REST_Controller::class ]; | |
| 972 | 1163 | } |
| 973 | 1164 | ); |
| 974 | 1165 | } |
| 975 | 1166 | } |