Install the Marketplace Return Management Glue API

Edit on GitHub

This document describes how to integrate the Marketplace Return Management API feature into a Spryker project.

Install feature core

Follow the steps below to install the Marketplace Return Management Glue API feature core.

Prerequisites

Install the required features:

NAME VERSION INSTALLATION GUIDE
Marketplace Merchant 202404.0 Install the Marketplace Merchant feature
Marketplace Return Management 202404.0 Install the Marketplace Return Management feature

1) Install the required modules using Сomposer

Install the required modules using Composer:

composer require spryker/merchant-sales-returns-rest-api:"^1.0.0" --update-with-dependencies
Verification

Make sure that the following modules have been installed:

MODULE EXPECTED DIRECTORY
MerchantSalesReturnsRestApi spryker/merchant-sales-returns-rest-api

2) Set up transfer objects

Generate transfers:

console transfer:generate
Verification

Ensure the following transfers have been created:

TRANSFER TYPE EVENT PATH
RestReturnsAttributes.merchantReference attribute created src/Generated/Shared/Transfer/RestReturnsAttributesTransfer

3) Set up behavior

Enable the following behaviors by registering the plugins:

PLUGIN SPECIFICATION PREREQUISITES NAMESPACE
MerchantByMerchantReferenceResourceRelationshipPlugin Adds merchants resources as relationship by merchant references in the attributes Spryker\Glue\MerchantsRestApi\Plugin\GlueApplication
src/Pyz/Glue/GlueApplication/GlueApplicationDependencyProvider.php
<?php

namespace Pyz\Glue\GlueApplication;

use Spryker\Glue\MerchantsRestApi\Plugin\GlueApplication\MerchantByMerchantReferenceResourceRelationshipPlugin;
use Spryker\Glue\GlueApplicationExtension\Dependency\Plugin\ResourceRelationshipCollectionInterface;

class GlueApplicationDependencyProvider extends SprykerGlueApplicationDependencyProvider
{
  protected function getResourceRelationshipPlugins(
          ResourceRelationshipCollectionInterface $resourceRelationshipCollection
      ): ResourceRelationshipCollectionInterface {
          $resourceRelationshipCollection->addRelationship(
                SalesReturnsRestApiConfig::RESOURCE_RETURNS,
                new MerchantByMerchantReferenceResourceRelationshipPlugin()
            );

            return $resourceRelationshipCollection;
      }

}
Verification

Make sure that the MerchantByMerchantReferenceResourceRelationshipPlugin plugin is set up by:

  1. Sending the request GET https://glue.mysprykershop.com/returns/{{returnId}}include=merchants.

Verify that the returned data includes merchant resource attributes.

  1. Sending the request GET https://glue.mysprykershop.com/returns.

Verify that the returned data includes the merchantReference.