Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install the merchant relationship product lists Glue API #2160

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@


## Install Merchant Relationship Product Lists Feature API
DmitryLymarenko marked this conversation as resolved.
Show resolved Hide resolved

### Prerequisites

Install the required features:

| NAME | VERSION | INTEGRATION GUIDE |
|-------------------------------|------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Glue API: Spryker Core | {{page.version}} | [Glue API: Spryker Core feature integration](/docs/pbc/all/miscellaneous/{{page.version}}/install-and-upgrade/install-glue-api/install-the-spryker-core-glue-api.html) |
| Merchant Product Restrictions | {{page.version}} | [Merchant Product Restrictions feature integration](/docs/pbc/all/merchant-management/{{page.version}}/base-shop/install-and-upgrade/install-the-merchant-product-restrictions-feature.html) |

### 1) Install the required modules using Composer

Run the following command to install the required modules:

```bash
composer require spryker/merchant-relationship-product-lists-rest-api:"^0.1.0" --update-with-dependencies
DmitryLymarenko marked this conversation as resolved.
Show resolved Hide resolved
```

{% info_block warningBox “Verification” %}

Make sure that the following modules are installed:

| MODULE | EXPECTED DIRECTORY |
|-----------------------------------------|-------------------------------------------------------------|
| MerchantRelationshipProductListsRestApi | vendor/spryker/merchant-relationship-product-lists-rest-api |

{% endinfo_block %}

### 2) Set up transfer objects

Run the following command to generate transfer changes:

```bash
console transfer:generate
```

{% info_block warningBox “Verification” %}

Make sure that the following changes have occurred in transfer objects:

| TRANSFER | TYPE | EVENT | PATH |
|---------------------------------|--------|----------|-------------------------------------------------------------------------|
| Customer | class | created | src/Generated/Shared/Transfer/RestCatalogSearchAttributesTransfer |
| RestUser | class | created | src/Generated/Shared/Transfer/RestCatalogSearchSortTransfer |
| CustomerProductListCollection | class | created | src/Generated/Shared/Transfer/RestCatalogSearchPaginationTransfer |
| CustomerIdentifier | class | created | src/Generated/Shared/Transfer/RestCatalogSearchAbstractProductsTransfer |

{% endinfo_block %}

### 3) Set up behavior

Activate the following plugins:

| PLUGIN | SPECIFICATION | PREREQUISITES | NAMESPACE |
|----------------------------------------------------------|------------------------------------------------------------------------------|---------------|--------------------------------------------------------------------------------------------------|
| CustomerProductListOauthCustomerIdentifierExpanderPlugin | Expands `CustomerIdentifierTransfer` with customers product list collection. | None | Spryker\Zed\MerchantRelationshipProductListsRestApi\Communication\Plugin\OauthCustomerConnector |
| CustomerProductListCustomerExpanderPlugin | Expands `CustomerTransfer` with customer's product list collection. | None | Spryker\Glue\MerchantRelationshipProductListsRestApi\Plugin\CustomersRestApi |


**src/Pyz/Zed/OauthCustomerConnector/OauthCustomerConnectorDependencyProvider.php**

```php
<?php

namespace Pyz\Zed\OauthCustomerConnector;

use Spryker\Zed\MerchantRelationshipProductListsRestApi\Communication\Plugin\OauthCustomerConnector\CustomerProductListOauthCustomerIdentifierExpanderPlugin;
use Spryker\Zed\OauthCustomerConnector\OauthCustomerConnectorDependencyProvider as SprykerOauthCustomerConnectorDependencyProvider;

/**
* @method \Spryker\Zed\OauthCustomerConnector\OauthCustomerConnectorConfig getConfig()
*/
class OauthCustomerConnectorDependencyProvider extends SprykerOauthCustomerConnectorDependencyProvider
{
/**
* @return array<\Spryker\Zed\OauthCustomerConnectorExtension\Dependency\Plugin\OauthCustomerIdentifierExpanderPluginInterface>
*/
protected function getOauthCustomerIdentifierExpanderPlugins(): array
{
return [
new CustomerProductListOauthCustomerIdentifierExpanderPlugin(),
];
}
}
```

{% info_block warningBox "Verification" %}

Send request `POST https://glue.mysprykershop.com/access-tokens` and make sure that `sub` property includes related `customer_product_list_collection`.

{% endinfo_block %}

**src/Pyz/Glue/CustomersRestApi/CustomersRestApiDependencyProvider.php**

```php
<?php

namespace Pyz\Glue\CustomersRestApi;

use Spryker\Glue\CustomersRestApi\CustomersRestApiDependencyProvider as SprykerCustomersRestApiDependencyProvider;
use Spryker\Glue\MerchantRelationshipProductListsRestApi\Plugin\CustomersRestApi\CustomerProductListCustomerExpanderPlugin;

class CustomersRestApiDependencyProvider extends SprykerCustomersRestApiDependencyProvider
{
/**
* @return array<\Spryker\Glue\CustomersRestApiExtension\Dependency\Plugin\CustomerExpanderPluginInterface>
*/
protected function getCustomerExpanderPlugins(): array
{
return array_merge(parent::getCustomerExpanderPlugins(), [
new CustomerProductListCustomerExpanderPlugin(),
]);
}
}
```

{% info_block warningBox "Verification" %}

Send request `GET https://glue.mysprykershop.com/catalog-search` and make sure that response is considering the customers black- and whitelists.

{% endinfo_block %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: Install the Merchant Relationship Product Lists Glue API
description: The guide walks you through the process of installing the Merchant Relationship Product Lists API feature into the project.
last_updated: Sep 11, 2023
template: feature-integration-guide-template
---

{% include pbc/all/install-features/202307.0/install-glue-api/install-the-merchant-relationship-product-lists-glue-api.md %} <!-- To edit, see /_includes/pbc/all/install-features/202307.0/install-glue-api/install-the-merchant-relationship-product-lists-glue-api.md -->