Skip to content

Commit

Permalink
Merge pull request #2160 from spryker/install-the-merchant-relationsh…
Browse files Browse the repository at this point in the history
…ip-product-lists-glue-api

Install the merchant relationship product lists Glue API
  • Loading branch information
lenadoc authored Sep 11, 2023
2 parents 566e76a + 6d9af56 commit e26b03f
Show file tree
Hide file tree
Showing 2 changed files with 132 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@


## Install Merchant Relationship Product Lists Feature API

### 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
```

{% 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 -->

0 comments on commit e26b03f

Please sign in to comment.