From 3f1d3f702f216ccc3ed3257cb4945f0b7f0f221b Mon Sep 17 00:00:00 2001 From: Jaume Malia Date: Fri, 16 Jun 2023 14:05:56 +0200 Subject: [PATCH 1/3] PBC-1580: Integrates Merchant Events --- composer.lock | 35 +++++++++++-------- config/Shared/config_default.php | 21 ++++++++++- .../MessageBrokerDependencyProvider.php | 2 ++ .../Publisher/PublisherDependencyProvider.php | 16 +++++++++ 4 files changed, 58 insertions(+), 16 deletions(-) diff --git a/composer.lock b/composer.lock index 7dc8474c6c..db71fb4573 100644 --- a/composer.lock +++ b/composer.lock @@ -31478,16 +31478,16 @@ }, { "name": "spryker/merchant", - "version": "3.6.0", + "version": "3.7.0", "source": { "type": "git", "url": "https://github.com/spryker/merchant.git", - "reference": "6dcf160e3a7ebdd1e9d7551f216954aa7efb9e3d" + "reference": "e6013c11278d692f2bb2ed40eb5d870de22634ef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spryker/merchant/zipball/6dcf160e3a7ebdd1e9d7551f216954aa7efb9e3d", - "reference": "6dcf160e3a7ebdd1e9d7551f216954aa7efb9e3d", + "url": "https://api.github.com/repos/spryker/merchant/zipball/e6013c11278d692f2bb2ed40eb5d870de22634ef", + "reference": "e6013c11278d692f2bb2ed40eb5d870de22634ef", "shasum": "" }, "require": { @@ -31495,19 +31495,24 @@ "spryker/acl-merchant-portal-extension": "^1.0.0", "spryker/cart-extension": "^4.0.0", "spryker/checkout-extension": "^1.2.0", - "spryker/event": "^2.0.0", + "spryker/event": "^2.3.0", "spryker/kernel": "^3.33.0", + "spryker/log": "^3.0.0", "spryker/merchant-extension": "^1.1.0", + "spryker/message-broker": "^1.5.0", + "spryker/message-broker-extension": "^1.0.0", "spryker/price-product-merchant-relationship-storage-extension": "^1.0.0", "spryker/propel-orm": "^1.0.0", + "spryker/publisher-extension": "^1.0.0", "spryker/shopping-list-extension": "^1.2.0", - "spryker/store": "^1.1.0", - "spryker/transfer": "^3.25.0", + "spryker/store": "^1.20.0", + "spryker/transfer": "^3.27.0", "spryker/url": "^3.0.0", "spryker/util-text": "^1.0.0" }, "require-dev": { "spryker/code-sniffer": "*", + "spryker/container": "*", "spryker/propel": "*", "spryker/testify": "*" }, @@ -31529,9 +31534,9 @@ ], "description": "Merchant module", "support": { - "source": "https://github.com/spryker/merchant/tree/3.6.0" + "source": "https://github.com/spryker/merchant/tree/3.7.0" }, - "time": "2023-03-10T14:11:16+00:00" + "time": "2023-05-22T19:10:17+00:00" }, { "name": "spryker/merchant-data-import", @@ -50621,16 +50626,16 @@ }, { "name": "spryker/store", - "version": "1.19.1", + "version": "1.20.0", "source": { "type": "git", "url": "https://github.com/spryker/store.git", - "reference": "abba25f1a572607891806b95384d9489ccbd3c2c" + "reference": "a9996e7c6f5c6ee5b63382bbe5d26de91a6ccb8c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spryker/store/zipball/abba25f1a572607891806b95384d9489ccbd3c2c", - "reference": "abba25f1a572607891806b95384d9489ccbd3c2c", + "url": "https://api.github.com/repos/spryker/store/zipball/a9996e7c6f5c6ee5b63382bbe5d26de91a6ccb8c", + "reference": "a9996e7c6f5c6ee5b63382bbe5d26de91a6ccb8c", "shasum": "" }, "require": { @@ -50679,9 +50684,9 @@ ], "description": "Store module", "support": { - "source": "https://github.com/spryker/store/tree/1.19.1" + "source": "https://github.com/spryker/store/tree/1.20.0" }, - "time": "2023-05-05T18:20:59+00:00" + "time": "2023-05-22T19:10:17+00:00" }, { "name": "spryker/store-context-gui", diff --git a/config/Shared/config_default.php b/config/Shared/config_default.php index f6d7dedc9c..df4cd17cd8 100644 --- a/config/Shared/config_default.php +++ b/config/Shared/config_default.php @@ -4,7 +4,11 @@ use Generated\Shared\Transfer\AssetAddedTransfer; use Generated\Shared\Transfer\AssetDeletedTransfer; use Generated\Shared\Transfer\AssetUpdatedTransfer; +use Generated\Shared\Transfer\ExportMerchantsTransfer; use Generated\Shared\Transfer\InitializeProductExportTransfer; +use Generated\Shared\Transfer\MerchantCreatedTransfer; +use Generated\Shared\Transfer\MerchantExportedTransfer; +use Generated\Shared\Transfer\MerchantUpdatedTransfer; use Generated\Shared\Transfer\OrderStatusChangedTransfer; use Generated\Shared\Transfer\PaymentCancelReservationFailedTransfer; use Generated\Shared\Transfer\PaymentCancelReservationRequestedTransfer; @@ -752,15 +756,29 @@ SearchEndpointRemovedTransfer::class => 'search', AddReviewsTransfer::class => 'reviews', OrderStatusChangedTransfer::class => 'orders', + ExportMerchantsTransfer::class => 'merchant-commands', + MerchantExportedTransfer::class => 'merchant-events', + MerchantCreatedTransfer::class => 'merchant-events', + MerchantUpdatedTransfer::class => 'merchant-events', +]; + +$config[MessageBrokerConstants::CHANNEL_TO_TRANSPORT_MAP] = [ + 'payment' => MessageBrokerAwsConfig::SQS_TRANSPORT, + 'assets' => MessageBrokerAwsConfig::SQS_TRANSPORT, + 'product' => MessageBrokerAwsConfig::SQS_TRANSPORT, + 'reviews' => MessageBrokerAwsConfig::SQS_TRANSPORT, + 'search' => MessageBrokerAwsConfig::SQS_TRANSPORT, + 'merchant-commands' => MessageBrokerAwsConfig::SQS_TRANSPORT, + 'merchant-events' => 'http', ]; -$config[MessageBrokerConstants::CHANNEL_TO_TRANSPORT_MAP] = $config[MessageBrokerAwsConstants::CHANNEL_TO_RECEIVER_TRANSPORT_MAP] = [ 'payment' => MessageBrokerAwsConfig::SQS_TRANSPORT, 'assets' => MessageBrokerAwsConfig::SQS_TRANSPORT, 'product' => MessageBrokerAwsConfig::SQS_TRANSPORT, 'search' => MessageBrokerAwsConfig::SQS_TRANSPORT, 'reviews' => MessageBrokerAwsConfig::SQS_TRANSPORT, + 'merchant-commands' => MessageBrokerAwsConfig::SQS_TRANSPORT, ]; $config[CartsRestApiConstants::IS_QUOTE_RELOAD_ENABLED] = true; @@ -769,6 +787,7 @@ 'assets' => 'http', 'product' => 'http', 'orders' => 'http', + 'merchant-events' => 'http', ]; $aopInfrastructureConfiguration = json_decode(html_entity_decode((string)getenv('SPRYKER_AOP_INFRASTRUCTURE')), true); diff --git a/src/Pyz/Zed/MessageBroker/MessageBrokerDependencyProvider.php b/src/Pyz/Zed/MessageBroker/MessageBrokerDependencyProvider.php index 115c632470..e6b265c3d8 100644 --- a/src/Pyz/Zed/MessageBroker/MessageBrokerDependencyProvider.php +++ b/src/Pyz/Zed/MessageBroker/MessageBrokerDependencyProvider.php @@ -10,6 +10,7 @@ use Spryker\Zed\Asset\Communication\Plugin\MessageBroker\AssetAddedMessageHandlerPlugin; use Spryker\Zed\Asset\Communication\Plugin\MessageBroker\AssetDeletedMessageHandlerPlugin; use Spryker\Zed\Asset\Communication\Plugin\MessageBroker\AssetUpdatedMessageHandlerPlugin; +use Spryker\Zed\Merchant\Communication\Plugin\MessageBroker\MerchantExportMerchantsMessageHandlerPlugin; use Spryker\Zed\MessageBroker\Communication\Plugin\MessageBroker\CorrelationIdMessageAttributeProviderPlugin; use Spryker\Zed\MessageBroker\Communication\Plugin\MessageBroker\TimestampMessageAttributeProviderPlugin; use Spryker\Zed\MessageBroker\Communication\Plugin\MessageBroker\TransactionIdMessageAttributeProviderPlugin; @@ -85,6 +86,7 @@ public function getMessageHandlerPlugins(): array new SearchEndpointAvailableMessageHandlerPlugin(), new SearchEndpointRemovedMessageHandlerPlugin(), new ProductReviewAddReviewsMessageHandlerPlugin(), + new MerchantExportMerchantsMessageHandlerPlugin(), ]; } diff --git a/src/Pyz/Zed/Publisher/PublisherDependencyProvider.php b/src/Pyz/Zed/Publisher/PublisherDependencyProvider.php index 0bae4be476..70c6237c90 100644 --- a/src/Pyz/Zed/Publisher/PublisherDependencyProvider.php +++ b/src/Pyz/Zed/Publisher/PublisherDependencyProvider.php @@ -46,6 +46,9 @@ use Spryker\Zed\GlossaryStorage\Communication\Plugin\Publisher\GlossaryKey\GlossaryWritePublisherPlugin as GlossaryKeyWriterPublisherPlugin; use Spryker\Zed\GlossaryStorage\Communication\Plugin\Publisher\GlossaryPublisherTriggerPlugin; use Spryker\Zed\GlossaryStorage\Communication\Plugin\Publisher\GlossaryTranslation\GlossaryWritePublisherPlugin as GlossaryTranslationWritePublisherPlugin; +use Spryker\Zed\Merchant\Communication\Plugin\Publisher\MerchantCreatedMessageBrokerPublisherPlugin; +use Spryker\Zed\Merchant\Communication\Plugin\Publisher\MerchantExportedMessageBrokerPublisherPlugin; +use Spryker\Zed\Merchant\Communication\Plugin\Publisher\MerchantUpdatedMessageBrokerPublisherPlugin; use Spryker\Zed\PriceProductMerchantRelationshipStorage\Communication\Plugin\Publisher\Merchant\MerchantWritePublisherPlugin; use Spryker\Zed\Product\Communication\Plugin\Publisher\ProductAbstractUpdatedMessageBrokerPublisherPlugin; use Spryker\Zed\Product\Communication\Plugin\Publisher\ProductConcreteCreatedMessageBrokerPublisherPlugin; @@ -135,6 +138,7 @@ protected function getPublisherPlugins(): array $this->getProductBundleStoragePlugins(), $this->getProductConfigurationStoragePlugins(), $this->getProductExportPlugins(), + $this->getMerchantExportPlugins(), ); } @@ -401,4 +405,16 @@ protected function getProductExportPlugins(): array new ProductAbstractUpdatedMessageBrokerPublisherPlugin(), ]; } + + /** + * @return array<\Spryker\Zed\PublisherExtension\Dependency\Plugin\PublisherPluginInterface> + */ + protected function getMerchantExportPlugins(): array + { + return [ + new MerchantExportedMessageBrokerPublisherPlugin(), + new MerchantCreatedMessageBrokerPublisherPlugin(), + new MerchantUpdatedMessageBrokerPublisherPlugin(), + ]; + } } From cdefd09f04fb2a9b82787842cf13340fd9c6c125 Mon Sep 17 00:00:00 2001 From: Jaume Malia Date: Mon, 19 Jun 2023 10:28:29 +0200 Subject: [PATCH 2/3] PBC-1580: Updates configs --- config/Shared/config_default.php | 3 ++- src/Pyz/Zed/MessageBroker/MessageBrokerConfig.php | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/config/Shared/config_default.php b/config/Shared/config_default.php index 46d84f7ac9..850c48477b 100644 --- a/config/Shared/config_default.php +++ b/config/Shared/config_default.php @@ -765,9 +765,9 @@ 'asset-commands' => MessageBrokerAwsConfig::SQS_TRANSPORT, 'product-commands' => MessageBrokerAwsConfig::SQS_TRANSPORT, 'search-commands' => MessageBrokerAwsConfig::SQS_TRANSPORT, + 'merchant-commands' => MessageBrokerAwsConfig::SQS_TRANSPORT, 'order-events' => 'http', 'product-events' => 'http', - 'merchant-commands' => MessageBrokerAwsConfig::SQS_TRANSPORT, 'merchant-events' => 'http', ]; @@ -787,6 +787,7 @@ 'payment-commands' => 'http', 'product-events' => 'http', 'order-events' => 'http', + 'merchant-events' => 'http', ]; $aopInfrastructureConfiguration = json_decode(html_entity_decode((string)getenv('SPRYKER_AOP_INFRASTRUCTURE')), true); diff --git a/src/Pyz/Zed/MessageBroker/MessageBrokerConfig.php b/src/Pyz/Zed/MessageBroker/MessageBrokerConfig.php index 6c5a6723bd..98c4dfb362 100644 --- a/src/Pyz/Zed/MessageBroker/MessageBrokerConfig.php +++ b/src/Pyz/Zed/MessageBroker/MessageBrokerConfig.php @@ -25,6 +25,7 @@ public function getDefaultWorkerChannels(): array 'asset-commands', 'product-commands', 'search-commands', + 'merchant-commands', ]; } From 8278f0274c0d241be65dd043526cf222ef1d9471 Mon Sep 17 00:00:00 2001 From: Jaume Malia Date: Tue, 20 Jun 2023 12:04:03 +0200 Subject: [PATCH 3/3] PBC-1580: Rearrange CHANNEL_TO_TRANSPORT_MAP --- config/Shared/config_default.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/Shared/config_default.php b/config/Shared/config_default.php index 850c48477b..cae44e0aa0 100644 --- a/config/Shared/config_default.php +++ b/config/Shared/config_default.php @@ -765,9 +765,9 @@ 'asset-commands' => MessageBrokerAwsConfig::SQS_TRANSPORT, 'product-commands' => MessageBrokerAwsConfig::SQS_TRANSPORT, 'search-commands' => MessageBrokerAwsConfig::SQS_TRANSPORT, - 'merchant-commands' => MessageBrokerAwsConfig::SQS_TRANSPORT, 'order-events' => 'http', 'product-events' => 'http', + 'merchant-commands' => MessageBrokerAwsConfig::SQS_TRANSPORT, 'merchant-events' => 'http', ];