| @@ -80,9 +80,11 @@ | ||
| 80 | 80 | use SeQura\WC\Core\Implementation\BusinessLogic\Webhook\Services\Shop_Order_Service; |
| 81 | 81 | use SeQura\WC\Core\Implementation\Infrastructure\Logger\Interfaces\Default_Logger_Adapter; |
| 82 | 82 | use SeQura\WC\Core\Implementation\Infrastructure\Logger\Interfaces\Shop_Logger_Adapter; |
| 83 | 83 | use SeQura\WC\Core\Implementation\BusinessLogic\Domain\Integration\OrderReport\Order_Report_Service; |
| 84 | +use SeQura\WC\Repositories\Cache_Repository; | |
| 84 | 85 | use SeQura\WC\Repositories\Entity_Repository; |
| 86 | +use SeQura\WC\Repositories\Interface_Cache_Repository; | |
| 85 | 87 | use SeQura\WC\Repositories\Migrations\Migration_Install_300; |
| 86 | 88 | use SeQura\WC\Repositories\Migrations\Migration_Install_320; |
| 87 | 89 | use SeQura\WC\Repositories\Queue_Item_Repository; |
| 88 | 90 | use SeQura\WC\Repositories\Repository; |
| @@ -128,8 +130,10 @@ | ||
| 128 | 130 | use SeQura\WC\Core\Implementation\BusinessLogic\Domain\Integration\Product\Product_Service as Core_Product_Service; |
| 129 | 131 | use SeQura\WC\Core\Implementation\BusinessLogic\Domain\Integration\PromotionalWidgets\Mini_Widget_Messages_Provider; |
| 130 | 132 | use SeQura\WC\Core\Implementation\BusinessLogic\Domain\Integration\PromotionalWidgets\Widget_Configurator; |
| 131 | 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; | |
| 132 | 136 | use SeQura\WC\Services\Order\Current_Order_Provider; |
| 133 | 137 | use SeQura\WC\Services\Order\Interface_Current_Order_Provider; |
| 134 | 138 | use SeQura\WC\Services\Platform\Interface_Platform_Provider; |
| 135 | 139 | use SeQura\WC\Services\Platform\Platform_Provider; |
| @@ -135,10 +139,14 @@ | ||
| 135 | 139 | use SeQura\WC\Services\Platform\Platform_Provider; |
| 136 | 140 | use SeQura\WC\Services\Widgets\Interface_Widgets_Service; |
| 137 | 141 | use SeQura\WC\Services\Widgets\Widgets_Service; |
| 138 | 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; | |
| 139 | 145 | use SeQura\Core\Infrastructure\Configuration\ConfigurationManager; |
| 146 | +use SeQura\WC\Controllers\Rest\Store_Integration_REST_Controller; | |
| 140 | 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; | |
| 141 | 149 | use SeQura\WC\Services\Order\Builder\Interface_Order_Address_Builder; |
| 142 | 150 | use SeQura\WC\Services\Order\Builder\Order_Address_Builder; |
| 143 | 151 | use SeQura\WC\Services\Order\Builder\Interface_Order_Customer_Builder; |
| 144 | 152 | use SeQura\WC\Services\Order\Builder\Interface_Order_Delivery_Method_Builder; |
| @@ -145,8 +153,14 @@ | ||
| 145 | 153 | use SeQura\WC\Services\Order\Builder\Order_Customer_Builder; |
| 146 | 154 | use SeQura\WC\Services\Order\Builder\Order_Delivery_Method_Builder; |
| 147 | 155 | use SeQura\WC\Services\Service\Interface_Settings_Service; |
| 148 | 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; | |
| 149 | 163 | |
| 150 | 164 | /** |
| 151 | 165 | * Implementation for the core bootstrap class. |
| 152 | 166 | */ |
| @@ -180,8 +194,9 @@ | ||
| 180 | 194 | Reg::getService( General_Settings_REST_Controller::class ), |
| 181 | 195 | Reg::getService( Onboarding_REST_Controller::class ), |
| 182 | 196 | Reg::getService( Payment_REST_Controller::class ), |
| 183 | 197 | Reg::getService( Log_REST_Controller::class ), |
| 198 | + Reg::getService( Store_Integration_REST_Controller::class ), | |
| 184 | 199 | Reg::getService( Interface_Product_Controller::class ), |
| 185 | 200 | Reg::getService( Interface_Async_Process_Controller::class ), |
| 186 | 201 | Reg::getService( Interface_Order_Controller::class ) |
| 187 | 202 | ); |
| @@ -346,9 +361,10 @@ | ||
| 346 | 361 | Reg::getService( MerchantOrderRequestBuilder::class ), |
| 347 | 362 | Reg::getService( Interface_Order_Delivery_Method_Builder::class ), |
| 348 | 363 | Reg::getService( Interface_Order_Address_Builder::class ), |
| 349 | 364 | Reg::getService( Interface_Order_Customer_Builder::class ), |
| 350 | - Reg::getService( CredentialsService::class ) | |
| 365 | + Reg::getService( CredentialsService::class ), | |
| 366 | + Reg::getService( SeQuraOrderRepositoryInterface::class ) | |
| 351 | 367 | ); |
| 352 | 368 | } |
| 353 | 369 | return self::$cache[ Interface_Create_Order_Request_Builder::class ]; |
| 354 | 370 | } |
| @@ -501,8 +517,18 @@ | ||
| 501 | 517 | } |
| 502 | 518 | return self::$cache[ DefaultLoggerAdapter::CLASS_NAME ]; |
| 503 | 519 | } |
| 504 | 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 | + ); | |
| 505 | 531 | |
| 506 | 532 | // Plugin services. |
| 507 | 533 | Reg::registerService( |
| 508 | 534 | Interface_Log_File::class, |
| @@ -554,8 +580,15 @@ | ||
| 554 | 580 | * @var StoreContext $store_context |
| 555 | 581 | */ |
| 556 | 582 | $store_context = Reg::getService( StoreContext::class ); |
| 557 | 583 | |
| 584 | + /** | |
| 585 | + * Cache repository. | |
| 586 | + * | |
| 587 | + * @var Interface_Cache_Repository $cache_repository | |
| 588 | + */ | |
| 589 | + $cache_repository = Reg::getService( Interface_Cache_Repository::class ); | |
| 590 | + | |
| 558 | 591 | self::$cache[ Interface_Migration_Manager::class ] = new Migration_Manager( |
| 559 | 592 | self::get_constants()->get_plugin_basename(), |
| 560 | 593 | $configuration, |
| 561 | 594 | self::get_constants()->get_plugin_data()['Version'], |
| @@ -561,8 +594,9 @@ | ||
| 561 | 594 | self::get_constants()->get_plugin_data()['Version'], |
| 562 | 595 | array( |
| 563 | 596 | new Migration_Install_300( |
| 564 | 597 | $wpdb, |
| 598 | + $cache_repository, | |
| 565 | 599 | $order_repository, |
| 566 | 600 | $entity_repository, |
| 567 | 601 | $queue_item_repository, |
| 568 | 602 | $store_context |
| @@ -568,8 +602,9 @@ | ||
| 568 | 602 | $store_context |
| 569 | 603 | ), |
| 570 | 604 | new Migration_Install_320( |
| 571 | 605 | $wpdb, |
| 606 | + $cache_repository, | |
| 572 | 607 | self::get_constants()->get_hook_add_order_indexes(), |
| 573 | 608 | $entity_repository, |
| 574 | 609 | $queue_item_repository |
| 575 | 610 | ), |
| @@ -574,11 +609,23 @@ | ||
| 574 | 609 | $queue_item_repository |
| 575 | 610 | ), |
| 576 | 611 | new Migration_Install_400( |
| 577 | 612 | $wpdb, |
| 613 | + $cache_repository, | |
| 578 | 614 | $encryptor, |
| 579 | - $store_context, | |
| 615 | + $store_context | |
| 580 | 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 | + ), | |
| 581 | 628 | ) |
| 582 | 629 | ); |
| 583 | 630 | } |
| 584 | 631 | return self::$cache[ Interface_Migration_Manager::class ]; |
| @@ -736,9 +783,9 @@ | ||
| 736 | 783 | Reg::registerService( |
| 737 | 784 | ProductServiceInterface::class, |
| 738 | 785 | static function () { |
| 739 | 786 | if ( ! isset( self::$cache[ ProductServiceInterface::class ] ) ) { |
| 740 | - self::$cache[ ProductServiceInterface::class ] = new Core_Product_Service(); | |
| 787 | + self::$cache[ ProductServiceInterface::class ] = new Core_Product_Service( Reg::getService( \wpdb::class ) ); | |
| 741 | 788 | } |
| 742 | 789 | return self::$cache[ ProductServiceInterface::class ]; |
| 743 | 790 | } |
| 744 | 791 | ); |
| @@ -860,8 +907,31 @@ | ||
| 860 | 907 | } |
| 861 | 908 | return self::$cache[ Interface_Order_Delivery_Method_Builder::class ]; |
| 862 | 909 | } |
| 863 | 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 | + ); | |
| 864 | 934 | } |
| 865 | 935 | |
| 866 | 936 | /** |
| 867 | 937 | * Initializes repositories. |
| @@ -878,8 +948,18 @@ | ||
| 878 | 948 | return self::$cache[ \wpdb::class ]; |
| 879 | 949 | } |
| 880 | 950 | ); |
| 881 | 951 | |
| 952 | + Reg::registerService( | |
| 953 | + Interface_Cache_Repository::class, | |
| 954 | + static function () { | |
| 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 ]; | |
| 959 | + } | |
| 960 | + ); | |
| 961 | + | |
| 882 | 962 | parent::initRepositories(); |
| 883 | 963 | |
| 884 | 964 | RepositoryRegistry::registerRepository( ConfigEntity::class, Entity_Repository::class ); |
| 885 | 965 | RepositoryRegistry::registerRepository( QueueItem::class, Queue_Item_Repository::class ); |
| @@ -895,8 +975,9 @@ | ||
| 895 | 975 | RepositoryRegistry::registerRepository( TransactionLog::class, Entity_Repository::class ); |
| 896 | 976 | RepositoryRegistry::registerRepository( PaymentMethod::class, Entity_Repository::class ); |
| 897 | 977 | RepositoryRegistry::registerRepository( Credentials::class, Entity_Repository::class ); |
| 898 | 978 | RepositoryRegistry::registerRepository( Deployment::class, Entity_Repository::class ); |
| 979 | + RepositoryRegistry::registerRepository( AdvancedSettings::class, Entity_Repository::class ); | |
| 899 | 980 | } |
| 900 | 981 | |
| 901 | 982 | /** |
| 902 | 983 | * Initializes controllers. |
| @@ -1004,9 +1085,10 @@ | ||
| 1004 | 1085 | if ( ! isset( self::$cache[ Interface_Order_Controller::class ] ) ) { |
| 1005 | 1086 | self::$cache[ Interface_Order_Controller::class ] = new Order_Controller( |
| 1006 | 1087 | Reg::getService( Interface_Logger_Service::class ), |
| 1007 | 1088 | self::get_constants()->get_plugin_templates_path(), |
| 1008 | - Reg::getService( Interface_Order_Service::class ) | |
| 1089 | + Reg::getService( Interface_Order_Service::class ), | |
| 1090 | + Reg::getService( Interface_Cart_Service::class ) | |
| 1009 | 1091 | ); |
| 1010 | 1092 | } |
| 1011 | 1093 | return self::$cache[ Interface_Order_Controller::class ]; |
| 1012 | 1094 | } |
| @@ -1057,12 +1139,28 @@ | ||
| 1057 | 1139 | if ( ! isset( self::$cache[ Log_REST_Controller::class ] ) ) { |
| 1058 | 1140 | self::$cache[ Log_REST_Controller::class ] = new Log_REST_Controller( |
| 1059 | 1141 | self::get_constants()->get_plugin_rest_namespace(), |
| 1060 | 1142 | Reg::getService( Interface_Logger_Service::class ), |
| 1061 | - Reg::getService( RegexProvider::class ) | |
| 1143 | + Reg::getService( RegexProvider::class ), | |
| 1144 | + Reg::getService( AdvancedSettingsService::class ) | |
| 1062 | 1145 | ); |
| 1063 | 1146 | } |
| 1064 | 1147 | return self::$cache[ Log_REST_Controller::class ]; |
| 1148 | + } | |
| 1149 | + ); | |
| 1150 | + Reg::registerService( | |
| 1151 | + Store_Integration_REST_Controller::class, | |
| 1152 | + static function () { | |
| 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 ) | |
| 1160 | + ); | |
| 1161 | + } | |
| 1162 | + return self::$cache[ Store_Integration_REST_Controller::class ]; | |
| 1065 | 1163 | } |
| 1066 | 1164 | ); |
| 1067 | 1165 | } |
| 1068 | 1166 | } |