init
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModule1\Controller;
|
||||
|
||||
use Magento\Framework\App\RequestInterface;
|
||||
use Magento\Framework\Stdlib\Cookie\CookieMetadataFactory;
|
||||
use Magento\Framework\Stdlib\Cookie\PhpCookieManager;
|
||||
|
||||
/**
|
||||
* Controller for testing the CookieManager.
|
||||
*
|
||||
*/
|
||||
abstract class CookieTester implements \Magento\Framework\App\ActionInterface
|
||||
{
|
||||
/** @var PhpCookieManager */
|
||||
protected $cookieManager;
|
||||
|
||||
/** @var CookieMetadataFactory */
|
||||
protected $cookieMetadataFactory;
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\App\ResponseInterface
|
||||
*/
|
||||
protected $_response;
|
||||
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
protected $request;
|
||||
|
||||
/**
|
||||
* @param \Magento\Framework\App\Action\Context $context
|
||||
* @param PhpCookieManager $cookieManager
|
||||
* @param CookieMetadataFactory $cookieMetadataFactory
|
||||
*/
|
||||
public function __construct(
|
||||
\Magento\Framework\App\Action\Context $context,
|
||||
PhpCookieManager $cookieManager,
|
||||
CookieMetadataFactory $cookieMetadataFactory
|
||||
) {
|
||||
$this->cookieManager = $cookieManager;
|
||||
$this->cookieMetadataFactory = $cookieMetadataFactory;
|
||||
$this->_response = $context->getResponse();
|
||||
$this->request = $context->getRequest();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve cookie metadata factory
|
||||
*/
|
||||
protected function getCookieMetadataFactory()
|
||||
{
|
||||
return $this->cookieMetadataFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve cookie metadata factory
|
||||
*/
|
||||
protected function getCookieManager()
|
||||
{
|
||||
return $this->cookieManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatch request
|
||||
*
|
||||
* @param RequestInterface $request
|
||||
* @return \Magento\Framework\App\ResponseInterface
|
||||
*/
|
||||
public function dispatch(RequestInterface $request)
|
||||
{
|
||||
$this->request = $request;
|
||||
$result = $this->execute();
|
||||
return $result ? $result : $this->_response;
|
||||
}
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModule1\Controller\CookieTester;
|
||||
|
||||
use \Magento\Framework\App\RequestInterface;
|
||||
|
||||
/**
|
||||
* Controller to test deletion of a cookie
|
||||
*/
|
||||
class DeleteCookie extends \Magento\TestModule1\Controller\CookieTester
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @return \Magento\Framework\App\ResponseInterface
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
$cookieName = $this->request->getParam('cookie_name');
|
||||
$this->getCookieManager()->deleteCookie($cookieName);
|
||||
return $this->_response;
|
||||
}
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModule1\Controller\CookieTester;
|
||||
|
||||
use \Magento\Framework\App\RequestInterface;
|
||||
|
||||
/**
|
||||
*/
|
||||
class SetPublicCookie extends \Magento\TestModule1\Controller\CookieTester
|
||||
{
|
||||
/**
|
||||
* Sets a public cookie with data from url parameters
|
||||
*
|
||||
* @return \Magento\Framework\App\ResponseInterface
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
$publicCookieMetadata = $this->getCookieMetadataFactory()->createPublicCookieMetadata();
|
||||
|
||||
$cookieDomain = $this->request->getParam('cookie_domain');
|
||||
if ($cookieDomain !== null) {
|
||||
$publicCookieMetadata->setDomain($cookieDomain);
|
||||
}
|
||||
|
||||
$cookiePath = $this->request->getParam('cookie_path');
|
||||
if ($cookiePath !== null) {
|
||||
$publicCookieMetadata->setPath($cookiePath);
|
||||
}
|
||||
|
||||
$cookieDuration = $this->request->getParam('cookie_duration');
|
||||
if ($cookieDuration !== null) {
|
||||
$publicCookieMetadata->setDuration($cookieDuration);
|
||||
}
|
||||
|
||||
$httpOnly = $this->request->getParam('cookie_httponly');
|
||||
if ($httpOnly !== null) {
|
||||
$publicCookieMetadata->setHttpOnly($httpOnly);
|
||||
}
|
||||
|
||||
$secure = $this->request->getParam('cookie_secure');
|
||||
if ($secure !== null) {
|
||||
$publicCookieMetadata->setSecure($secure);
|
||||
}
|
||||
|
||||
$cookieName = $this->request->getParam('cookie_name');
|
||||
$cookieValue = $this->request->getParam('cookie_value');
|
||||
$this->getCookieManager()->setPublicCookie($cookieName, $cookieValue, $publicCookieMetadata);
|
||||
return $this->_response;
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModule1\Controller\CookieTester;
|
||||
|
||||
use \Magento\Framework\App\RequestInterface;
|
||||
|
||||
/**
|
||||
*/
|
||||
class SetSensitiveCookie extends \Magento\TestModule1\Controller\CookieTester
|
||||
{
|
||||
/**
|
||||
* Sets a sensitive cookie with data from url parameters
|
||||
*
|
||||
* @return \Magento\Framework\App\ResponseInterface
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
$sensitiveCookieMetadata = $this->getCookieMetadataFactory()->createSensitiveCookieMetadata();
|
||||
|
||||
$cookieDomain = $this->request->getParam('cookie_domain');
|
||||
if ($cookieDomain !== null) {
|
||||
$sensitiveCookieMetadata->setDomain($cookieDomain);
|
||||
}
|
||||
$cookiePath = $this->request->getParam('cookie_domain');
|
||||
if ($cookiePath !== null) {
|
||||
$sensitiveCookieMetadata->setPath($cookiePath);
|
||||
}
|
||||
|
||||
$cookieName = $this->request->getParam('cookie_name');
|
||||
$cookieValue = $this->request->getParam('cookie_value');
|
||||
$this->getCookieManager()->setSensitiveCookie($cookieName, $cookieValue, $sensitiveCookieMetadata);
|
||||
return $this->_response;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModule1\Service\V1;
|
||||
|
||||
use Magento\TestModuleMSC\Model\Data\CustomAttributeDataObjectFactory;
|
||||
use Magento\TestModule1\Service\V1\Entity\Item;
|
||||
use Magento\TestModule1\Service\V1\Entity\ItemFactory;
|
||||
|
||||
class AllSoapAndRest implements \Magento\TestModule1\Service\V1\AllSoapAndRestInterface
|
||||
{
|
||||
/**
|
||||
* @var ItemFactory
|
||||
*/
|
||||
protected $itemFactory;
|
||||
|
||||
/**
|
||||
* @var CustomAttributeDataObjectFactory
|
||||
*/
|
||||
protected $customAttributeDataObjectFactory;
|
||||
|
||||
/**
|
||||
* @param ItemFactory $itemFactory
|
||||
* @param CustomAttributeDataObjectFactory $customAttributeNestedDataObjectFactory
|
||||
*/
|
||||
public function __construct(
|
||||
ItemFactory $itemFactory,
|
||||
CustomAttributeDataObjectFactory $customAttributeNestedDataObjectFactory
|
||||
) {
|
||||
$this->itemFactory = $itemFactory;
|
||||
$this->customAttributeDataObjectFactory = $customAttributeNestedDataObjectFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function item($itemId)
|
||||
{
|
||||
return $this->itemFactory->create()->setItemId($itemId)->setName('testProduct1');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function items()
|
||||
{
|
||||
$result1 = $this->itemFactory->create()->setItemId(1)->setName('testProduct1');
|
||||
$result2 = $this->itemFactory->create()->setItemId(2)->setName('testProduct2');
|
||||
|
||||
return [$result1, $result2];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function create($name)
|
||||
{
|
||||
return $this->itemFactory->create()->setItemId(rand())->setName($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function update(Item $entityItem)
|
||||
{
|
||||
return $this->itemFactory->create()->setItemId($entityItem->getItemId())
|
||||
->setName('Updated' . $entityItem->getName());
|
||||
}
|
||||
|
||||
public function testOptionalParam($name = null)
|
||||
{
|
||||
if ($name === null) {
|
||||
return $this->itemFactory->create()->setItemId(3)->setName('No Name');
|
||||
} else {
|
||||
return $this->itemFactory->create()->setItemId(3)->setName($name);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function itemAnyType(Item $item)
|
||||
{
|
||||
return $item;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getPreconfiguredItem()
|
||||
{
|
||||
$customAttributeDataObject = $this->customAttributeDataObjectFactory->create()
|
||||
->setName('nameValue')
|
||||
->setCustomAttribute('custom_attribute_int', 1);
|
||||
|
||||
$item = $this->itemFactory->create()
|
||||
->setItemId(1)
|
||||
->setName('testProductAnyType')
|
||||
->setCustomAttribute('custom_attribute_data_object', $customAttributeDataObject)
|
||||
->setCustomAttribute('custom_attribute_string', 'someStringValue');
|
||||
|
||||
return $item;
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModule1\Service\V1;
|
||||
|
||||
use Magento\TestModule1\Service\V1\Entity\Item;
|
||||
|
||||
interface AllSoapAndRestInterface
|
||||
{
|
||||
/**
|
||||
* @param int $itemId
|
||||
* @return \Magento\TestModule1\Service\V1\Entity\Item
|
||||
*/
|
||||
public function item($itemId);
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @return \Magento\TestModule1\Service\V1\Entity\Item
|
||||
*/
|
||||
public function create($name);
|
||||
|
||||
/**
|
||||
* @param \Magento\TestModule1\Service\V1\Entity\Item $entityItem
|
||||
* @return \Magento\TestModule1\Service\V1\Entity\Item
|
||||
*/
|
||||
public function update(Item $entityItem);
|
||||
|
||||
/**
|
||||
* @return \Magento\TestModule1\Service\V1\Entity\Item[]
|
||||
*/
|
||||
public function items();
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @return \Magento\TestModule1\Service\V1\Entity\Item
|
||||
*/
|
||||
public function testOptionalParam($name = null);
|
||||
|
||||
/**
|
||||
* @param \Magento\TestModule1\Service\V1\Entity\Item $entityItem
|
||||
* @return \Magento\TestModule1\Service\V1\Entity\Item
|
||||
*/
|
||||
public function itemAnyType(Item $entityItem);
|
||||
|
||||
/**
|
||||
* @return \Magento\TestModule1\Service\V1\Entity\Item
|
||||
*/
|
||||
public function getPreconfiguredItem();
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModule1\Service\V1\Entity;
|
||||
|
||||
class Item extends \Magento\Framework\Api\AbstractExtensibleObject
|
||||
{
|
||||
/**#@+
|
||||
* Custom attribute code constants
|
||||
*/
|
||||
const CUSTOM_ATTRIBUTE_1 = 'custom_attribute1';
|
||||
const CUSTOM_ATTRIBUTE_2 = 'custom_attribute2';
|
||||
const CUSTOM_ATTRIBUTE_3 = 'custom_attribute3';
|
||||
/**#@-*/
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getItemId()
|
||||
{
|
||||
return $this->_data['item_id'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $itemId
|
||||
* @return $this
|
||||
*/
|
||||
public function setItemId($itemId)
|
||||
{
|
||||
return $this->setData('item_id', $itemId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->_data['name'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @return $this
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
return $this->setData('name', $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Template method used to configure the attribute codes for the custom attributes
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
protected function getCustomAttributesCodes()
|
||||
{
|
||||
return array_merge(
|
||||
parent::getCustomAttributesCodes(),
|
||||
[self::CUSTOM_ATTRIBUTE_1, self::CUSTOM_ATTRIBUTE_2, self::CUSTOM_ATTRIBUTE_3]
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModule1\Service\V2;
|
||||
|
||||
use Magento\TestModule1\Service\V2\Entity\Item;
|
||||
use Magento\TestModule1\Service\V2\Entity\ItemFactory;
|
||||
|
||||
class AllSoapAndRest implements \Magento\TestModule1\Service\V2\AllSoapAndRestInterface
|
||||
{
|
||||
/**
|
||||
* @var ItemFactory
|
||||
*/
|
||||
protected $itemFactory;
|
||||
|
||||
/**
|
||||
* @param ItemFactory $itemFactory
|
||||
*/
|
||||
public function __construct(ItemFactory $itemFactory)
|
||||
{
|
||||
$this->itemFactory = $itemFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function item($id)
|
||||
{
|
||||
return $this->itemFactory->create()->setId($id)->setName('testProduct1')->setPrice('1');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function items($filters = [], $sortOrder = 'ASC')
|
||||
{
|
||||
$result = [];
|
||||
$firstItem = $this->itemFactory->create()->setId(1)->setName('testProduct1')->setPrice('1');
|
||||
$secondItem = $this->itemFactory->create()->setId(2)->setName('testProduct2')->setPrice('2');
|
||||
|
||||
/** Simple filtration implementation */
|
||||
if (!empty($filters)) {
|
||||
/** @var \Magento\Framework\Api\Filter $filter */
|
||||
foreach ($filters as $filter) {
|
||||
if ('id' == $filter->getField() && $filter->getValue() == 1) {
|
||||
$result[] = $firstItem;
|
||||
} elseif ('id' == $filter->getField() && $filter->getValue() == 2) {
|
||||
$result[] = $secondItem;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/** No filter is specified. */
|
||||
$result = [$firstItem, $secondItem];
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function create($name)
|
||||
{
|
||||
return $this->itemFactory->create()->setId(rand())->setName($name)->setPrice('10');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function update(Item $entityItem)
|
||||
{
|
||||
return $this->itemFactory->create()
|
||||
->setId($entityItem->getId())
|
||||
->setName('Updated' . $entityItem->getName())
|
||||
->setPrice('5');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
return $this->itemFactory->create()->setId($id)->setName('testProduct1')->setPrice('1');
|
||||
}
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModule1\Service\V2;
|
||||
|
||||
use Magento\TestModule1\Service\V2\Entity\Item;
|
||||
|
||||
interface AllSoapAndRestInterface
|
||||
{
|
||||
/**
|
||||
* Get item.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Magento\TestModule1\Service\V2\Entity\Item
|
||||
*/
|
||||
public function item($id);
|
||||
|
||||
/**
|
||||
* Create item.
|
||||
*
|
||||
* @param string $name
|
||||
* @return \Magento\TestModule1\Service\V2\Entity\Item
|
||||
*/
|
||||
public function create($name);
|
||||
|
||||
/**
|
||||
* Update item.
|
||||
*
|
||||
* @param \Magento\TestModule1\Service\V2\Entity\Item $entityItem
|
||||
* @return \Magento\TestModule1\Service\V2\Entity\Item
|
||||
*/
|
||||
public function update(Item $entityItem);
|
||||
|
||||
/**
|
||||
* Retrieve a list of items.
|
||||
*
|
||||
* @param \Magento\Framework\Api\Filter[] $filters
|
||||
* @param string $sortOrder
|
||||
* @return \Magento\TestModule1\Service\V2\Entity\Item[]
|
||||
*/
|
||||
public function items($filters = [], $sortOrder = 'ASC');
|
||||
|
||||
/**
|
||||
* Delete an item.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Magento\TestModule1\Service\V2\Entity\Item
|
||||
*/
|
||||
public function delete($id);
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModule1\Service\V2\Entity;
|
||||
|
||||
class Item extends \Magento\Framework\Api\AbstractExtensibleObject
|
||||
{
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->_data['id'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @return $this
|
||||
*/
|
||||
public function setId($id)
|
||||
{
|
||||
return $this->setData('id', $id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->_data['name'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @return $this
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
return $this->setData('name', $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPrice()
|
||||
{
|
||||
return $this->_data['price'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $price
|
||||
* @return $this
|
||||
*/
|
||||
public function setPrice($price)
|
||||
{
|
||||
return $this->setData('price', $price);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
|
||||
<acl>
|
||||
<resources>
|
||||
<resource id="Magento_Backend::admin">
|
||||
<resource id="Magento_TestModule1::all" title="TestModule1" sortOrder="1">
|
||||
<resource id="Magento_TestModule1::resource1" title="Resource1" sortOrder="20"/>
|
||||
<resource id="Magento_TestModule1::resource2" title="Resource2" sortOrder="10"/>
|
||||
<resource id="Magento_TestModule1::resource3" title="Resource3" sortOrder="30"/>
|
||||
</resource>
|
||||
</resource>
|
||||
</resources>
|
||||
</acl>
|
||||
</config>
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
|
||||
<default>
|
||||
<oauth>
|
||||
<consumer>
|
||||
<enable_integration_as_bearer>1</enable_integration_as_bearer>
|
||||
</consumer>
|
||||
</oauth>
|
||||
</default>
|
||||
</config>
|
||||
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
|
||||
<preference for="Magento\TestModule1\Service\V1\AllSoapAndRestInterface" type="Magento\TestModule1\Service\V1\AllSoapAndRest" />
|
||||
<preference for="Magento\TestModule1\Service\V2\AllSoapAndRestInterface" type="Magento\TestModule1\Service\V2\AllSoapAndRest" />
|
||||
|
||||
<virtualType name="Magento\TestModule1\Service\Config\TestModule1MetadataConfig" type="Magento\Framework\Api\ExtensionAttribute\Config\MetadataConfig">
|
||||
<arguments>
|
||||
<argument name="attributeMetadataBuilder" xsi:type="object">Magento\TestModuleMSC\Model\Data\Eav\AttributeMetadataBuilder</argument>
|
||||
<argument name="dataObjectClassName" xsi:type="string">Magento\TestModule1\Service\V1\Entity\Item</argument>
|
||||
</arguments>
|
||||
</virtualType>
|
||||
<type name="Magento\TestModule1\Service\V1\Entity\ItemBuilder">
|
||||
<arguments>
|
||||
<argument name="metadataService" xsi:type="object">Magento\TestModule1\Service\Config\TestModule1MetadataConfig</argument>
|
||||
</arguments>
|
||||
</type>
|
||||
</config>
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
|
||||
<extension_attributes for="Magento\TestModule1\Service\V1\Entity\Item">
|
||||
<attribute code="custom_attribute_data_object" type="Magento\TestModuleMSC\Model\Data\CustomAttributeDataObject" />
|
||||
<attribute code="custom_attribute_string" type="string" />
|
||||
</extension_attributes>
|
||||
<extension_attributes for="Magento\TestModuleMSC\Model\Data\CustomAttributeDataObject">
|
||||
<attribute code="custom_attribute_nested" type="Magento\TestModuleMSC\Model\Data\CustomAttributeNestedDataObject" />
|
||||
<attribute code="custom_attribute_int" type="int" />
|
||||
</extension_attributes>
|
||||
</config>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
|
||||
<router id="standard">
|
||||
<route id="testmoduleone" frontName="testmoduleone">
|
||||
<module name="Magento_TestModule1" />
|
||||
</route>
|
||||
</router>
|
||||
</config>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
|
||||
<module name="Magento_TestModule1" />
|
||||
</config>
|
||||
@@ -0,0 +1,116 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Webapi:etc/webapi.xsd">
|
||||
|
||||
<route method="GET" url="/V1/testmodule1/overwritten">
|
||||
<service class="Magento\TestModule1\Service\V1\AllSoapAndRestInterface" method="item" />
|
||||
<resources>
|
||||
<resource ref="Magento_TestModule1::resource1" />
|
||||
</resources>
|
||||
<data>
|
||||
<parameter name="itemId" force="true">-55</parameter>
|
||||
</data>
|
||||
</route>
|
||||
|
||||
<route method="POST" url="/V1/testmodule1/testOptionalParam">
|
||||
<service class="Magento\TestModule1\Service\V1\AllSoapAndRestInterface" method="testOptionalParam" />
|
||||
<resources>
|
||||
<resource ref="Magento_TestModule1::resource1" />
|
||||
</resources>
|
||||
<data>
|
||||
<parameter name="name">Default Name</parameter>
|
||||
</data>
|
||||
</route>
|
||||
|
||||
<route method="GET" url="/V1/testmodule1/:itemId">
|
||||
<service class="Magento\TestModule1\Service\V1\AllSoapAndRestInterface" method="item" />
|
||||
<resources>
|
||||
<resource ref="Magento_TestModule1::resource1" />
|
||||
</resources>
|
||||
</route>
|
||||
<route method="GET" url="/V1/testmodule1">
|
||||
<service class="Magento\TestModule1\Service\V1\AllSoapAndRestInterface" method="items" />
|
||||
<resources>
|
||||
<resource ref="Magento_TestModule1::resource2" />
|
||||
</resources>
|
||||
</route>
|
||||
<route method="POST" url="/V1/testmodule1">
|
||||
<service class="Magento\TestModule1\Service\V1\AllSoapAndRestInterface" method="create" />
|
||||
<resources>
|
||||
<resource ref="Magento_TestModule1::resource3" />
|
||||
</resources>
|
||||
</route>
|
||||
<route method="PUT" url="/V1/testmodule1/:itemId">
|
||||
<service class="Magento\TestModule1\Service\V1\AllSoapAndRestInterface" method="update" />
|
||||
<resources>
|
||||
<resource ref="Magento_TestModule1::resource1" />
|
||||
<resource ref="Magento_TestModule1::resource2" />
|
||||
</resources>
|
||||
</route>
|
||||
<route method="GET" url="/V1/testmodule1/resource1/:itemId">
|
||||
<service class="Magento\TestModule1\Service\V1\AllSoapAndRestInterface" method="item" />
|
||||
<resources>
|
||||
<resource ref="anonymous" />
|
||||
</resources>
|
||||
</route>
|
||||
<route method="POST" url="/V1/testmodule1/itemAnyType">
|
||||
<service class="Magento\TestModule1\Service\V1\AllSoapAndRestInterface" method="itemAnyType" />
|
||||
<resources>
|
||||
<resource ref="Magento_TestModule1::resource1" />
|
||||
<resource ref="Magento_TestModule1::resource2" />
|
||||
</resources>
|
||||
</route>
|
||||
<route method="GET" url="/V1/testmodule1/itemPreconfigured">
|
||||
<service class="Magento\TestModule1\Service\V1\AllSoapAndRestInterface" method="getPreconfiguredItem" />
|
||||
<resources>
|
||||
<resource ref="Magento_TestModule1::resource1" />
|
||||
<resource ref="Magento_TestModule1::resource2" />
|
||||
</resources>
|
||||
</route>
|
||||
<route method="PUT" url="/V1/testmodule1/withParam">
|
||||
<service class="Magento\TestModule1\Service\V1\AllSoapAndRestInterface" method="update" />
|
||||
<resources>
|
||||
<resource ref="Magento_TestModule1::resource1" />
|
||||
<resource ref="Magento_TestModule1::resource2" />
|
||||
</resources>
|
||||
<data>
|
||||
<parameter name="paramId" force="true">%param_id%</parameter>
|
||||
</data>
|
||||
</route>
|
||||
<route method="GET" url="/V2/testmodule1/:id">
|
||||
<service class="Magento\TestModule1\Service\V2\AllSoapAndRestInterface" method="item" />
|
||||
<resources>
|
||||
<resource ref="Magento_TestModule1::resource1" />
|
||||
</resources>
|
||||
</route>
|
||||
<route method="GET" url="/V2/testmodule1">
|
||||
<service class="Magento\TestModule1\Service\V2\AllSoapAndRestInterface" method="items" />
|
||||
<resources>
|
||||
<resource ref="Magento_TestModule1::resource2" />
|
||||
</resources>
|
||||
</route>
|
||||
<route method="POST" url="/V2/testmodule1">
|
||||
<service class="Magento\TestModule1\Service\V2\AllSoapAndRestInterface" method="create" />
|
||||
<resources>
|
||||
<resource ref="Magento_TestModule1::resource3" />
|
||||
</resources>
|
||||
</route>
|
||||
<route method="PUT" url="/V2/testmodule1/:id">
|
||||
<service class="Magento\TestModule1\Service\V2\AllSoapAndRestInterface" method="update" />
|
||||
<resources>
|
||||
<resource ref="Magento_TestModule1::resource1" />
|
||||
<resource ref="Magento_TestModule1::resource2" />
|
||||
</resources>
|
||||
</route>
|
||||
<route method="DELETE" url="/V2/testmodule1/:id">
|
||||
<service class="Magento\TestModule1\Service\V2\AllSoapAndRestInterface" method="delete" />
|
||||
<resources>
|
||||
<resource ref="Magento_TestModule1::resource1" />
|
||||
</resources>
|
||||
</route>
|
||||
</routes>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
use Magento\Framework\Component\ComponentRegistrar;
|
||||
|
||||
$registrar = new ComponentRegistrar();
|
||||
if ($registrar->getPath(ComponentRegistrar::MODULE, 'Magento_TestModule1') === null) {
|
||||
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_TestModule1', __DIR__);
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModule2\Service\V1\Entity;
|
||||
|
||||
class Item extends \Magento\Framework\Api\AbstractExtensibleObject
|
||||
{
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->_data['id'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @return $this
|
||||
*/
|
||||
public function setId($id)
|
||||
{
|
||||
return $this->setData('id', $id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->_data['name'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @return $this
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
return $this->setData('name', $name);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModule2\Service\V1;
|
||||
|
||||
use Magento\TestModule2\Service\V1\Entity\Item;
|
||||
use Magento\TestModule2\Service\V1\Entity\ItemFactory;
|
||||
|
||||
class NoWebApiXml implements \Magento\TestModule2\Service\V1\NoWebApiXmlInterface
|
||||
{
|
||||
/**
|
||||
* @var ItemFactory
|
||||
*/
|
||||
protected $itemFactory;
|
||||
|
||||
/**
|
||||
* @param ItemFactory $itemFactory
|
||||
*/
|
||||
public function __construct(ItemFactory $itemFactory)
|
||||
{
|
||||
$this->itemFactory = $itemFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function item($id)
|
||||
{
|
||||
return $this->itemFactory->create()->setId($id)->setName('testProduct1');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function items()
|
||||
{
|
||||
$result1 = $this->itemFactory->create()->setId(1)->setName('testProduct1');
|
||||
|
||||
$result2 = $this->itemFactory->create()->setId(2)->setName('testProduct2');
|
||||
|
||||
return [$result1, $result2];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function create($name)
|
||||
{
|
||||
return $this->itemFactory->create()->setId(rand())->setName($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function update(Item $item)
|
||||
{
|
||||
return $this->itemFactory->create()->setId($item->getId())->setName('Updated' . $item->getName());
|
||||
}
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModule2\Service\V1;
|
||||
|
||||
use Magento\TestModule2\Service\V1\Entity\Item;
|
||||
|
||||
interface NoWebApiXmlInterface
|
||||
{
|
||||
/**
|
||||
* Get an item.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Magento\TestModule2\Service\V1\Entity\Item
|
||||
*/
|
||||
public function item($id);
|
||||
|
||||
/**
|
||||
* Create an item.
|
||||
*
|
||||
* @param string $name
|
||||
* @return \Magento\TestModule2\Service\V1\Entity\Item
|
||||
*/
|
||||
public function create($name);
|
||||
|
||||
/**
|
||||
* Update an item.
|
||||
*
|
||||
* @param \Magento\TestModule2\Service\V1\Entity\Item $item
|
||||
* @return \Magento\TestModule2\Service\V1\Entity\Item
|
||||
*/
|
||||
public function update(Item $item);
|
||||
|
||||
/**
|
||||
* Retrieve a list of items.
|
||||
*
|
||||
* @return \Magento\TestModule2\Service\V1\Entity\Item[]
|
||||
*/
|
||||
public function items();
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModule2\Service\V1;
|
||||
|
||||
use Magento\TestModule2\Service\V1\Entity\Item;
|
||||
use Magento\TestModule2\Service\V1\Entity\ItemFactory;
|
||||
|
||||
class SubsetRest implements \Magento\TestModule2\Service\V1\SubsetRestInterface
|
||||
{
|
||||
/**
|
||||
* @var ItemFactory
|
||||
*/
|
||||
protected $itemFactory;
|
||||
|
||||
/**
|
||||
* @param ItemFactory $itemFactory
|
||||
*/
|
||||
public function __construct(ItemFactory $itemFactory)
|
||||
{
|
||||
$this->itemFactory = $itemFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function item($id)
|
||||
{
|
||||
return $this->itemFactory->create()->setId($id)->setName('testItem' . $id);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function items()
|
||||
{
|
||||
$result1 = $this->itemFactory->create()->setId(1)->setName('testItem1');
|
||||
|
||||
$result2 = $this->itemFactory->create()->setId(2)->setName('testItem2');
|
||||
|
||||
return [$result1, $result2];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function create($name)
|
||||
{
|
||||
return $this->itemFactory->create()->setId(rand())->setName($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function update(Item $item)
|
||||
{
|
||||
return $this->itemFactory->create()->setId($item->getId())->setName('Updated' . $item->getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function remove($id)
|
||||
{
|
||||
return $this->itemFactory->create()->setId(1);
|
||||
}
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModule2\Service\V1;
|
||||
|
||||
use Magento\TestModule2\Service\V1\Entity\Item;
|
||||
|
||||
interface SubsetRestInterface
|
||||
{
|
||||
/**
|
||||
* Return a single item.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Magento\TestModule2\Service\V1\Entity\Item
|
||||
*/
|
||||
public function item($id);
|
||||
|
||||
/**
|
||||
* Return multiple items.
|
||||
*
|
||||
* @return \Magento\TestModule2\Service\V1\Entity\Item[]
|
||||
*/
|
||||
public function items();
|
||||
|
||||
/**
|
||||
* Create an item.
|
||||
*
|
||||
* @param string $name
|
||||
* @return \Magento\TestModule2\Service\V1\Entity\Item
|
||||
*/
|
||||
public function create($name);
|
||||
|
||||
/**
|
||||
* Update an item.
|
||||
*
|
||||
* @param \Magento\TestModule2\Service\V1\Entity\Item $item
|
||||
* @return \Magento\TestModule2\Service\V1\Entity\Item
|
||||
*/
|
||||
public function update(Item $item);
|
||||
|
||||
/**
|
||||
* Delete an item.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Magento\TestModule2\Service\V1\Entity\Item
|
||||
*/
|
||||
public function remove($id);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
|
||||
<acl>
|
||||
<resources>
|
||||
<resource id="Magento_Backend::admin">
|
||||
<resource id="Magento_TestModule2::all" title="TestModule2" sortOrder="1">
|
||||
<resource id="Magento_TestModule2::resource1" title="Resource1" sortOrder="20"/>
|
||||
<resource id="Magento_TestModule2::resource2" title="Resource2" sortOrder="10"/>
|
||||
<resource id="Magento_TestModule2::resource3" title="Resource3" sortOrder="30"/>
|
||||
</resource>
|
||||
</resource>
|
||||
</resources>
|
||||
</acl>
|
||||
</config>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
|
||||
<preference for="Magento\TestModule2\Service\V1\SubsetRestInterface" type="Magento\TestModule2\Service\V1\SubsetRest" />
|
||||
<preference for="Magento\TestModule2\Service\V1\NoWebApiXmlInterface" type="Magento\TestModule2\Service\V1\NoWebApiXml" />
|
||||
</config>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
|
||||
<module name="Magento_TestModule2" />
|
||||
</config>
|
||||
@@ -0,0 +1,240 @@
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<xsd:complexType name="ItemRequest">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation/>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap"/>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="id" type="xsd:int">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Entity ID</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap">
|
||||
<inf:min/>
|
||||
<inf:max/>
|
||||
<inf:callInfo>
|
||||
<inf:callName>Item</inf:callName>
|
||||
<inf:requiredInput>Yes</inf:requiredInput>
|
||||
</inf:callInfo>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="ItemResponse">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Response container for the Item call.</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap"/>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="id" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Default label</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap">
|
||||
<inf:maxLength/>
|
||||
<inf:callInfo>
|
||||
<inf:callName>Item</inf:callName>
|
||||
<inf:returned>Always</inf:returned>
|
||||
</inf:callInfo>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="ItemsResponse">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Response container for the Items call.</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap"/>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element minOccurs="0" maxOccurs="unbounded" name="complexObjectArray"
|
||||
type="ItemsArray">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Default label</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap">
|
||||
<inf:maxLength/>
|
||||
<inf:callInfo>
|
||||
<inf:callName>Items</inf:callName>
|
||||
<inf:returned>Always</inf:returned>
|
||||
</inf:callInfo>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
|
||||
|
||||
<xsd:complexType name="ItemsArray">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Response container for the Items call.</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap"/>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="id" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Default label</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap">
|
||||
<inf:maxLength/>
|
||||
<inf:callInfo>
|
||||
<inf:callName>Items</inf:callName>
|
||||
<inf:returned>Always</inf:returned>
|
||||
</inf:callInfo>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
<xsd:element name="name" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Default label</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap">
|
||||
<inf:maxLength/>
|
||||
<inf:callInfo>
|
||||
<inf:callName>Item</inf:callName>
|
||||
<inf:returned>Always</inf:returned>
|
||||
</inf:callInfo>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="CreateRequest">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation/>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap"/>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="name" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Default label</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap">
|
||||
<inf:maxLength/>
|
||||
<inf:callInfo>
|
||||
<inf:callName>Create</inf:callName>
|
||||
<inf:returned>Always</inf:returned>
|
||||
</inf:callInfo>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="CreateResponse">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Response container for the Create call.</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap"/>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="id" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Default label</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap">
|
||||
<inf:maxLength/>
|
||||
<inf:callInfo>
|
||||
<inf:callName>Create</inf:callName>
|
||||
<inf:returned>Always</inf:returned>
|
||||
</inf:callInfo>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
<xsd:element name="name" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Default label</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap">
|
||||
<inf:maxLength/>
|
||||
<inf:callInfo>
|
||||
<inf:callName>Create</inf:callName>
|
||||
<inf:returned>Always</inf:returned>
|
||||
</inf:callInfo>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="UpdateRequest">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation/>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap"/>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="id" type="xsd:int">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Entity ID</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap">
|
||||
<inf:min/>
|
||||
<inf:max/>
|
||||
<inf:callInfo>
|
||||
<inf:callName>Update</inf:callName>
|
||||
<inf:requiredInput>Yes</inf:requiredInput>
|
||||
</inf:callInfo>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="UpdateResponse">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Response container for the Update call.</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap"/>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="id" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Default label</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap">
|
||||
<inf:maxLength/>
|
||||
<inf:callInfo>
|
||||
<inf:callName>Update</inf:callName>
|
||||
<inf:returned>Always</inf:returned>
|
||||
</inf:callInfo>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="RemoveRequest">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation/>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap"/>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="id" type="xsd:int">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Entity ID</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap">
|
||||
<inf:min/>
|
||||
<inf:max/>
|
||||
<inf:callInfo>
|
||||
<inf:callName>Remove</inf:callName>
|
||||
<inf:requiredInput>Yes</inf:requiredInput>
|
||||
</inf:callInfo>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="RemoveResponse">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Response container for the Remove call.</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap"/>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="id" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Default label</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap">
|
||||
<inf:maxLength/>
|
||||
<inf:callInfo>
|
||||
<inf:callName>Remove</inf:callName>
|
||||
<inf:returned>Always</inf:returned>
|
||||
</inf:callInfo>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:schema>
|
||||
@@ -0,0 +1,240 @@
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<xsd:complexType name="ItemRequest">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation/>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap"/>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="id" type="xsd:int">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Entity ID</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap">
|
||||
<inf:min/>
|
||||
<inf:max/>
|
||||
<inf:callInfo>
|
||||
<inf:callName>Item</inf:callName>
|
||||
<inf:requiredInput>Yes</inf:requiredInput>
|
||||
</inf:callInfo>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="ItemResponse">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Response container for the Item call.</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap"/>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="id" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Default label</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap">
|
||||
<inf:maxLength/>
|
||||
<inf:callInfo>
|
||||
<inf:callName>Item</inf:callName>
|
||||
<inf:returned>Always</inf:returned>
|
||||
</inf:callInfo>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="ItemsResponse">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Response container for the Items call.</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap"/>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element minOccurs="0" maxOccurs="unbounded" name="complexObjectArray"
|
||||
type="ItemsArray">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Default label</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap">
|
||||
<inf:maxLength/>
|
||||
<inf:callInfo>
|
||||
<inf:callName>Items</inf:callName>
|
||||
<inf:returned>Always</inf:returned>
|
||||
</inf:callInfo>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
|
||||
|
||||
<xsd:complexType name="ItemsArray">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Response container for the Items call.</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap"/>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="id" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Default label</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap">
|
||||
<inf:maxLength/>
|
||||
<inf:callInfo>
|
||||
<inf:callName>Items</inf:callName>
|
||||
<inf:returned>Always</inf:returned>
|
||||
</inf:callInfo>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
<xsd:element name="name" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Default label</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap">
|
||||
<inf:maxLength/>
|
||||
<inf:callInfo>
|
||||
<inf:callName>Item</inf:callName>
|
||||
<inf:returned>Always</inf:returned>
|
||||
</inf:callInfo>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="CreateRequest">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation/>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap"/>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="name" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Default label</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap">
|
||||
<inf:maxLength/>
|
||||
<inf:callInfo>
|
||||
<inf:callName>Create</inf:callName>
|
||||
<inf:returned>Always</inf:returned>
|
||||
</inf:callInfo>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="CreateResponse">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Response container for the Create call.</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap"/>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="id" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Default label</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap">
|
||||
<inf:maxLength/>
|
||||
<inf:callInfo>
|
||||
<inf:callName>Create</inf:callName>
|
||||
<inf:returned>Always</inf:returned>
|
||||
</inf:callInfo>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
<xsd:element name="name" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Default label</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap">
|
||||
<inf:maxLength/>
|
||||
<inf:callInfo>
|
||||
<inf:callName>Create</inf:callName>
|
||||
<inf:returned>Always</inf:returned>
|
||||
</inf:callInfo>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="UpdateRequest">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation/>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap"/>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="id" type="xsd:int">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Entity ID</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap">
|
||||
<inf:min/>
|
||||
<inf:max/>
|
||||
<inf:callInfo>
|
||||
<inf:callName>Update</inf:callName>
|
||||
<inf:requiredInput>Yes</inf:requiredInput>
|
||||
</inf:callInfo>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="UpdateResponse">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Response container for the Update call.</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap"/>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="id" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Default label</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap">
|
||||
<inf:maxLength/>
|
||||
<inf:callInfo>
|
||||
<inf:callName>Update</inf:callName>
|
||||
<inf:returned>Always</inf:returned>
|
||||
</inf:callInfo>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="RemoveRequest">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation/>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap"/>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="id" type="xsd:int">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Entity ID</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap">
|
||||
<inf:min/>
|
||||
<inf:max/>
|
||||
<inf:callInfo>
|
||||
<inf:callName>Remove</inf:callName>
|
||||
<inf:requiredInput>Yes</inf:requiredInput>
|
||||
</inf:callInfo>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="RemoveResponse">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Response container for the Remove call.</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap"/>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="id" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Default label</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap">
|
||||
<inf:maxLength/>
|
||||
<inf:callInfo>
|
||||
<inf:callName>Remove</inf:callName>
|
||||
<inf:returned>Always</inf:returned>
|
||||
</inf:callInfo>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:schema>
|
||||
@@ -0,0 +1,240 @@
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<xsd:complexType name="ItemRequest">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation/>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap"/>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="id" type="xsd:int">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Entity ID</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap">
|
||||
<inf:min/>
|
||||
<inf:max/>
|
||||
<inf:callInfo>
|
||||
<inf:callName>Item</inf:callName>
|
||||
<inf:requiredInput>Yes</inf:requiredInput>
|
||||
</inf:callInfo>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="ItemResponse">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Response container for the Item call.</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap"/>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="id" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Default label</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap">
|
||||
<inf:maxLength/>
|
||||
<inf:callInfo>
|
||||
<inf:callName>Item</inf:callName>
|
||||
<inf:returned>Always</inf:returned>
|
||||
</inf:callInfo>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="ItemsResponse">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Response container for the Items call.</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap"/>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element minOccurs="0" maxOccurs="unbounded" name="complexObjectArray"
|
||||
type="ItemsArray">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Default label</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap">
|
||||
<inf:maxLength/>
|
||||
<inf:callInfo>
|
||||
<inf:callName>Items</inf:callName>
|
||||
<inf:returned>Always</inf:returned>
|
||||
</inf:callInfo>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
|
||||
|
||||
<xsd:complexType name="ItemsArray">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Response container for the Items call.</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap"/>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="id" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Default label</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap">
|
||||
<inf:maxLength/>
|
||||
<inf:callInfo>
|
||||
<inf:callName>Items</inf:callName>
|
||||
<inf:returned>Always</inf:returned>
|
||||
</inf:callInfo>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
<xsd:element name="name" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Default label</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap">
|
||||
<inf:maxLength/>
|
||||
<inf:callInfo>
|
||||
<inf:callName>Item</inf:callName>
|
||||
<inf:returned>Always</inf:returned>
|
||||
</inf:callInfo>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="CreateRequest">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation/>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap"/>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="name" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Default label</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap">
|
||||
<inf:maxLength/>
|
||||
<inf:callInfo>
|
||||
<inf:callName>Create</inf:callName>
|
||||
<inf:returned>Always</inf:returned>
|
||||
</inf:callInfo>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="CreateResponse">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Response container for the Create call.</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap"/>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="id" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Default label</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap">
|
||||
<inf:maxLength/>
|
||||
<inf:callInfo>
|
||||
<inf:callName>Create</inf:callName>
|
||||
<inf:returned>Always</inf:returned>
|
||||
</inf:callInfo>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
<xsd:element name="name" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Default label</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap">
|
||||
<inf:maxLength/>
|
||||
<inf:callInfo>
|
||||
<inf:callName>Create</inf:callName>
|
||||
<inf:returned>Always</inf:returned>
|
||||
</inf:callInfo>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="UpdateRequest">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation/>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap"/>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="id" type="xsd:int">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Entity ID</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap">
|
||||
<inf:min/>
|
||||
<inf:max/>
|
||||
<inf:callInfo>
|
||||
<inf:callName>Update</inf:callName>
|
||||
<inf:requiredInput>Yes</inf:requiredInput>
|
||||
</inf:callInfo>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="UpdateResponse">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Response container for the Update call.</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap"/>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="id" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Default label</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap">
|
||||
<inf:maxLength/>
|
||||
<inf:callInfo>
|
||||
<inf:callName>Update</inf:callName>
|
||||
<inf:returned>Always</inf:returned>
|
||||
</inf:callInfo>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="RemoveRequest">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation/>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap"/>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="id" type="xsd:int">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Entity ID</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap">
|
||||
<inf:min/>
|
||||
<inf:max/>
|
||||
<inf:callInfo>
|
||||
<inf:callName>Remove</inf:callName>
|
||||
<inf:requiredInput>Yes</inf:requiredInput>
|
||||
</inf:callInfo>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="RemoveResponse">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Response container for the Remove call.</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap"/>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="id" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>Default label</xsd:documentation>
|
||||
<xsd:appinfo xmlns:inf="http://magento.ll/webapi/soap">
|
||||
<inf:maxLength/>
|
||||
<inf:callInfo>
|
||||
<inf:callName>Remove</inf:callName>
|
||||
<inf:returned>Always</inf:returned>
|
||||
</inf:callInfo>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:schema>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Webapi:etc/webapi.xsd">
|
||||
<route method="GET" url="/V1/testModule2SubsetRest/:id">
|
||||
<service class="Magento\TestModule2\Service\V1\SubsetRestInterface" method="item" />
|
||||
<resources>
|
||||
<resource ref="Magento_TestModule2::resource1" />
|
||||
</resources>
|
||||
</route>
|
||||
<route method="GET" url="/V1/testModule2SubsetRest">
|
||||
<service class="Magento\TestModule2\Service\V1\SubsetRestInterface" method="items" />
|
||||
<resources>
|
||||
<resource ref="Magento_TestModule2::resource2" />
|
||||
<resource ref="Magento_TestModule2::resource3" />
|
||||
</resources>
|
||||
</route>
|
||||
</routes>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
use Magento\Framework\Component\ComponentRegistrar;
|
||||
|
||||
$registrar = new ComponentRegistrar();
|
||||
if ($registrar->getPath(ComponentRegistrar::MODULE, 'Magento_TestModule2') === null) {
|
||||
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_TestModule2', __DIR__);
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
namespace Magento\TestModule3\Service\V1\Entity;
|
||||
|
||||
class Parameter extends \Magento\Framework\Api\AbstractExtensibleObject
|
||||
{
|
||||
/**
|
||||
* Get Name.
|
||||
*
|
||||
* @return string $name
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->_data['name'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Name.
|
||||
*
|
||||
* @param string $name
|
||||
* @return $this
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
return $this->setData('name', $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get value.
|
||||
*
|
||||
* @return string $value
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return $this->_data['value'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Set value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
*/
|
||||
public function setValue($value)
|
||||
{
|
||||
return $this->setData('value', $value);
|
||||
}
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
namespace Magento\TestModule3\Service\V1\Entity;
|
||||
|
||||
class WrappedErrorParameter extends \Magento\Framework\Api\AbstractExtensibleObject
|
||||
{
|
||||
/**
|
||||
* Get field name.
|
||||
*
|
||||
* @return string $name
|
||||
*/
|
||||
public function getFieldName()
|
||||
{
|
||||
return $this->_data['field_name'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get value.
|
||||
*
|
||||
* @return string $value
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return $this->_data['value'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Set field name.
|
||||
*
|
||||
* @param string $fieldName
|
||||
* @return $this
|
||||
*/
|
||||
public function setFieldName($fieldName)
|
||||
{
|
||||
return $this->setData('field_name', $fieldName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
*/
|
||||
public function setValue($value)
|
||||
{
|
||||
return $this->setData('value', $value);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
/**
|
||||
* Implementation of a test service for error handling testing
|
||||
*
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
namespace Magento\TestModule3\Service\V1;
|
||||
|
||||
use Magento\Framework\Exception\AuthorizationException;
|
||||
use Magento\Framework\Exception\InputException;
|
||||
use Magento\Framework\Exception\LocalizedException;
|
||||
use Magento\Framework\Exception\NoSuchEntityException;
|
||||
use Magento\TestModule3\Service\V1\Entity\Parameter;
|
||||
use Magento\TestModule3\Service\V1\Entity\ParameterFactory;
|
||||
|
||||
class Error implements \Magento\TestModule3\Service\V1\ErrorInterface
|
||||
{
|
||||
/**
|
||||
* @var ParameterFactory
|
||||
*/
|
||||
protected $parameterFactory;
|
||||
|
||||
/**
|
||||
* @param ParameterFactory $parameterFactory
|
||||
*/
|
||||
public function __construct(ParameterFactory $parameterFactory)
|
||||
{
|
||||
$this->parameterFactory = $parameterFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function success()
|
||||
{
|
||||
return $this->parameterFactory->create()->setName('id')->setValue('a good id');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function resourceNotFoundException()
|
||||
{
|
||||
throw new NoSuchEntityException(
|
||||
__(
|
||||
'Resource with ID "%1" not found.',
|
||||
'resourceY'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function serviceException()
|
||||
{
|
||||
throw new LocalizedException(__('Generic service exception %1', 3456));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function authorizationException()
|
||||
{
|
||||
throw new AuthorizationException(__("The consumer isn't authorized to access %1.", 'resourceN'));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function webapiException()
|
||||
{
|
||||
throw new \Magento\Framework\Webapi\Exception(
|
||||
__('Service not found'),
|
||||
5555,
|
||||
\Magento\Framework\Webapi\Exception::HTTP_NOT_FOUND
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function otherException()
|
||||
{
|
||||
throw new \Exception('Non service exception', 5678);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function returnIncompatibleDataType()
|
||||
{
|
||||
return "incompatibleDataType";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function inputException($wrappedErrorParameters)
|
||||
{
|
||||
$exception = new InputException();
|
||||
if ($wrappedErrorParameters) {
|
||||
foreach ($wrappedErrorParameters as $error) {
|
||||
$exception->addError(
|
||||
__(
|
||||
'Invalid value of "%value" provided for the %fieldName field.',
|
||||
['fieldName' => $error->getFieldName(), 'value' => $error->getValue()]
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
throw $exception;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* Interface for a test service for error handling testing
|
||||
*
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModule3\Service\V1;
|
||||
|
||||
interface ErrorInterface
|
||||
{
|
||||
/**
|
||||
* @return \Magento\TestModule3\Service\V1\Entity\Parameter
|
||||
*/
|
||||
public function success();
|
||||
|
||||
/**
|
||||
* @return int Status
|
||||
*/
|
||||
public function resourceNotFoundException();
|
||||
|
||||
/**
|
||||
* @return int Status
|
||||
*/
|
||||
public function serviceException();
|
||||
|
||||
/**
|
||||
* @return int Status
|
||||
*/
|
||||
public function authorizationException();
|
||||
|
||||
/**
|
||||
* @return int Status
|
||||
*/
|
||||
public function webapiException();
|
||||
|
||||
/**
|
||||
* @return int Status
|
||||
*/
|
||||
public function otherException();
|
||||
|
||||
/**
|
||||
* @return int Status
|
||||
*/
|
||||
public function returnIncompatibleDataType();
|
||||
|
||||
/**
|
||||
* @param \Magento\TestModule3\Service\V1\Entity\WrappedErrorParameter[] $wrappedErrorParameters
|
||||
* @return int Status
|
||||
*/
|
||||
public function inputException($wrappedErrorParameters);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
|
||||
<acl>
|
||||
<resources>
|
||||
<resource id="Magento_Backend::admin">
|
||||
<resource id="Magento_TestModule3::all" title="TestModule3" sortOrder="1">
|
||||
<resource id="Magento_TestModule3::resource1" title="Resource1" sortOrder="20"/>
|
||||
</resource>
|
||||
</resource>
|
||||
</resources>
|
||||
</acl>
|
||||
</config>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
|
||||
<preference for="Magento\TestModule3\Service\V1\ErrorInterface" type="Magento\TestModule3\Service\V1\Error" />
|
||||
</config>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
|
||||
<module name="Magento_TestModule3" />
|
||||
</config>
|
||||
@@ -0,0 +1,58 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Webapi:etc/webapi.xsd">
|
||||
<route method="GET" url="/V1/errortest/success">
|
||||
<service class="Magento\TestModule3\Service\V1\ErrorInterface" method="success" />
|
||||
<resources>
|
||||
<resource ref="Magento_TestModule3::resource1" />
|
||||
</resources>
|
||||
</route>
|
||||
<route method="GET" url="/V1/errortest/notfound">
|
||||
<service class="Magento\TestModule3\Service\V1\ErrorInterface" method="resourceNotFoundException" />
|
||||
<resources>
|
||||
<resource ref="Magento_TestModule3::resource1" />
|
||||
</resources>
|
||||
</route>
|
||||
<route method="GET" url="/V1/errortest/serviceexception">
|
||||
<service class="Magento\TestModule3\Service\V1\ErrorInterface" method="serviceException" />
|
||||
<resources>
|
||||
<resource ref="Magento_TestModule3::resource1" />
|
||||
</resources>
|
||||
</route>
|
||||
<route method="GET" url="/V1/errortest/unauthorized">
|
||||
<service class="Magento\TestModule3\Service\V1\ErrorInterface" method="authorizationException" />
|
||||
<resources>
|
||||
<resource ref="Magento_TestModule3::resource1" />
|
||||
<resource ref="Magento_TestModule3::resource2" />
|
||||
</resources>
|
||||
</route>
|
||||
<route method="GET" url="/V1/errortest/otherException">
|
||||
<service class="Magento\TestModule3\Service\V1\ErrorInterface" method="otherException" />
|
||||
<resources>
|
||||
<resource ref="Magento_TestModule3::resource1" />
|
||||
</resources>
|
||||
</route>
|
||||
<route method="GET" url="/V1/errortest/returnIncompatibleDataType">
|
||||
<service class="Magento\TestModule3\Service\V1\ErrorInterface" method="returnIncompatibleDataType" />
|
||||
<resources>
|
||||
<resource ref="Magento_TestModule3::resource1" />
|
||||
</resources>
|
||||
</route>
|
||||
<route method="GET" url="/V1/errortest/webapiException">
|
||||
<service class="Magento\TestModule3\Service\V1\ErrorInterface" method="webapiException" />
|
||||
<resources>
|
||||
<resource ref="Magento_TestModule3::resource1" />
|
||||
</resources>
|
||||
</route>
|
||||
<route method="POST" url="/V1/errortest/inputException">
|
||||
<service class="Magento\TestModule3\Service\V1\ErrorInterface" method="inputException" />
|
||||
<resources>
|
||||
<resource ref="Magento_TestModule3::resource1" />
|
||||
</resources>
|
||||
</route>
|
||||
</routes>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
use Magento\Framework\Component\ComponentRegistrar;
|
||||
|
||||
$registrar = new ComponentRegistrar();
|
||||
if ($registrar->getPath(ComponentRegistrar::MODULE, 'Magento_TestModule3') === null) {
|
||||
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_TestModule3', __DIR__);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
namespace Magento\TestModule4\Model\ResourceModel;
|
||||
|
||||
/**
|
||||
* Sample resource model
|
||||
*/
|
||||
class Item extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
|
||||
{
|
||||
/**
|
||||
* Initialize connection and define main table
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function _construct()
|
||||
{
|
||||
$this->_init('dummy_item', 'dummy_item_id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModule4\Service\V1;
|
||||
|
||||
use Magento\TestModule4\Service\V1\Entity\DataObjectRequest;
|
||||
use Magento\TestModule4\Service\V1\Entity\DataObjectResponseFactory;
|
||||
use Magento\TestModule4\Service\V1\Entity\ExtensibleRequestInterface;
|
||||
use Magento\TestModule4\Service\V1\Entity\NestedDataObjectRequest;
|
||||
|
||||
class DataObjectService implements \Magento\TestModule4\Service\V1\DataObjectServiceInterface
|
||||
{
|
||||
/**
|
||||
* @var DataObjectResponseFactory
|
||||
*/
|
||||
protected $responseFactory;
|
||||
|
||||
/**
|
||||
* @param DataObjectResponseFactory $responseFactory
|
||||
*/
|
||||
public function __construct(DataObjectResponseFactory $responseFactory)
|
||||
{
|
||||
$this->responseFactory = $responseFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getData($id)
|
||||
{
|
||||
return $this->responseFactory->create()->setEntityId($id)->setName("Test");
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function updateData($id, DataObjectRequest $request)
|
||||
{
|
||||
return $this->responseFactory->create()->setEntityId($id)->setName($request->getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function nestedData($id, NestedDataObjectRequest $request)
|
||||
{
|
||||
return $this->responseFactory->create()->setEntityId($id)->setName($request->getDetails()->getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test return scalar value
|
||||
*
|
||||
* @param int $id
|
||||
* @return int
|
||||
*/
|
||||
public function scalarResponse($id)
|
||||
{
|
||||
return $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function extensibleDataObject($id, ExtensibleRequestInterface $request)
|
||||
{
|
||||
return $this->responseFactory->create()->setEntityId($id)->setName($request->getName());
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
namespace Magento\TestModule4\Service\V1;
|
||||
|
||||
use Magento\TestModule4\Service\V1\Entity\DataObjectRequest;
|
||||
use Magento\TestModule4\Service\V1\Entity\NestedDataObjectRequest;
|
||||
|
||||
interface DataObjectServiceInterface
|
||||
{
|
||||
/**
|
||||
* @param int $id
|
||||
* @return \Magento\TestModule4\Service\V1\Entity\DataObjectResponse
|
||||
*/
|
||||
public function getData($id);
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @param \Magento\TestModule4\Service\V1\Entity\DataObjectRequest $request
|
||||
* @return \Magento\TestModule4\Service\V1\Entity\DataObjectResponse
|
||||
*/
|
||||
public function updateData($id, DataObjectRequest $request);
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @param \Magento\TestModule4\Service\V1\Entity\NestedDataObjectRequest $request
|
||||
* @return \Magento\TestModule4\Service\V1\Entity\DataObjectResponse
|
||||
*/
|
||||
public function nestedData($id, NestedDataObjectRequest $request);
|
||||
|
||||
/**
|
||||
* Test return scalar value
|
||||
*
|
||||
* @param int $id
|
||||
* @return int
|
||||
*/
|
||||
public function scalarResponse($id);
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @param \Magento\TestModule4\Service\V1\Entity\ExtensibleRequestInterface $request
|
||||
* @return \Magento\TestModule4\Service\V1\Entity\DataObjectResponse
|
||||
*/
|
||||
public function extensibleDataObject(
|
||||
$id,
|
||||
\Magento\TestModule4\Service\V1\Entity\ExtensibleRequestInterface $request
|
||||
);
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModule4\Service\V1\Entity;
|
||||
|
||||
class DataObjectRequest extends \Magento\Framework\Api\AbstractExtensibleObject
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->_get('name');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @return $this
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
return $this->setData('name', $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int|null
|
||||
*/
|
||||
public function getEntityId()
|
||||
{
|
||||
return $this->_get('entity_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $entityId
|
||||
* @return $this
|
||||
*/
|
||||
public function setEntityId($entityId)
|
||||
{
|
||||
return $this->setData('entity_id', $entityId);
|
||||
}
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModule4\Service\V1\Entity;
|
||||
|
||||
class DataObjectResponse extends \Magento\Framework\Api\AbstractExtensibleObject
|
||||
{
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getEntityId()
|
||||
{
|
||||
return $this->_get('entity_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $entityId
|
||||
* @return $this
|
||||
*/
|
||||
public function setEntityId($entityId)
|
||||
{
|
||||
return $this->setData('entity_id', $entityId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->_get('name');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @return $this
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
return $this->setData('name', $name);
|
||||
}
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
namespace Magento\TestModule4\Service\V1\Entity;
|
||||
|
||||
/**
|
||||
* Class ExtensibleRequest
|
||||
*
|
||||
* @method \Magento\TestModule4\Service\V1\Entity\ExtensibleRequestExtensionInterface getExtensionAttributes()
|
||||
*/
|
||||
class ExtensibleRequest extends \Magento\Framework\Model\AbstractExtensibleModel implements ExtensibleRequestInterface
|
||||
{
|
||||
public function getName()
|
||||
{
|
||||
return $this->getData("name");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @return $this
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
return $this->setData("name", $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $entityId
|
||||
* @return $this
|
||||
*/
|
||||
public function setEntityId($entityId)
|
||||
{
|
||||
return $this->setData("entity_id", $entityId);
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModule4\Service\V1\Entity;
|
||||
|
||||
interface ExtensibleRequestInterface extends \Magento\Framework\Api\ExtensibleDataInterface
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName();
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @return $this
|
||||
*/
|
||||
public function setName($name);
|
||||
|
||||
/**
|
||||
* @return int|null
|
||||
*/
|
||||
public function getEntityId();
|
||||
|
||||
/**
|
||||
* @param int $entityId
|
||||
* @return $this
|
||||
*/
|
||||
public function setEntityId($entityId);
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModule4\Service\V1\Entity;
|
||||
|
||||
class NestedDataObjectRequest extends \Magento\Framework\Api\AbstractExtensibleObject
|
||||
{
|
||||
/**
|
||||
* @return \Magento\TestModule4\Service\V1\Entity\DataObjectRequest
|
||||
*/
|
||||
public function getDetails()
|
||||
{
|
||||
return $this->_get('details');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Magento\TestModule4\Service\V1\Entity\DataObjectRequest $details
|
||||
* @return $this
|
||||
*/
|
||||
public function setDetails(\Magento\TestModule4\Service\V1\Entity\DataObjectRequest $details = null)
|
||||
{
|
||||
return $this->setData('details', $details);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
|
||||
<acl>
|
||||
<resources>
|
||||
<resource id="Magento_Backend::admin">
|
||||
<resource id="Magento_TestModule4::all" title="TestModule4" sortOrder="1">
|
||||
<resource id="Magento_TestModule4::resource1" title="Resource1" sortOrder="20"/>
|
||||
<resource id="Magento_TestModule4::resource2" title="Resource2" sortOrder="10"/>
|
||||
<resource id="Magento_TestModule4::resource3" title="Resource3" sortOrder="30"/>
|
||||
</resource>
|
||||
</resource>
|
||||
</resources>
|
||||
</acl>
|
||||
</config>
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
|
||||
<preference for="Magento\TestModule4\Service\V1\DataObjectServiceInterface" type="Magento\TestModule4\Service\V1\DataObjectService" />
|
||||
<preference for="Magento\TestModule4\Service\V1\Entity\ExtensibleRequestInterface" type="Magento\TestModule4\Service\V1\Entity\ExtensibleRequest" />
|
||||
<type name="Magento\TestModule4\Service\V1\Entity\ExtensibleRequest">
|
||||
<arguments>
|
||||
<argument name="resource" xsi:type="object">Magento\TestModule4\Model\ResourceModel\Item</argument>
|
||||
</arguments>
|
||||
</type>
|
||||
</config>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
|
||||
<module name="Magento_TestModule4" />
|
||||
</config>
|
||||
@@ -0,0 +1,39 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Webapi:etc/webapi.xsd">
|
||||
<route method="GET" url="/V1/testmodule4/:id">
|
||||
<service class="Magento\TestModule4\Service\V1\DataObjectServiceInterface" method="getData" />
|
||||
<resources>
|
||||
<resource ref="Magento_TestModule4::resource1" />
|
||||
</resources>
|
||||
</route>
|
||||
<route method="GET" url="/V1/testmodule4/scalar/:id">
|
||||
<service class="Magento\TestModule4\Service\V1\DataObjectServiceInterface" method="scalarResponse" />
|
||||
<resources>
|
||||
<resource ref="Magento_TestModule4::resource1" />
|
||||
</resources>
|
||||
</route>
|
||||
<route method="POST" url="/V1/testmodule4/:id">
|
||||
<service class="Magento\TestModule4\Service\V1\DataObjectServiceInterface" method="updateData" />
|
||||
<resources>
|
||||
<resource ref="Magento_TestModule4::resource2" />
|
||||
</resources>
|
||||
</route>
|
||||
<route method="POST" url="/V1/testmodule4/:id/nested">
|
||||
<service class="Magento\TestModule4\Service\V1\DataObjectServiceInterface" method="nestedData" />
|
||||
<resources>
|
||||
<resource ref="Magento_TestModule4::resource3" />
|
||||
</resources>
|
||||
</route>
|
||||
<route method="POST" url="/V1/testmodule4/extensibleDataObject/:id">
|
||||
<service class="Magento\TestModule4\Service\V1\DataObjectServiceInterface" method="extensibleDataObject" />
|
||||
<resources>
|
||||
<resource ref="Magento_TestModule4::resource3" />
|
||||
</resources>
|
||||
</route>
|
||||
</routes>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
use Magento\Framework\Component\ComponentRegistrar;
|
||||
|
||||
$registrar = new ComponentRegistrar();
|
||||
if ($registrar->getPath(ComponentRegistrar::MODULE, 'Magento_TestModule4') === null) {
|
||||
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_TestModule4', __DIR__);
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModule5\Service\V1;
|
||||
|
||||
use Magento\TestModule5\Service\V1\Entity\AllSoapAndRestFactory;
|
||||
|
||||
class AllSoapAndRest implements \Magento\TestModule5\Service\V1\AllSoapAndRestInterface
|
||||
{
|
||||
/**
|
||||
* @var AllSoapAndRestFactory
|
||||
*/
|
||||
protected $factory;
|
||||
|
||||
/**
|
||||
* @param AllSoapAndRestFactory $factory
|
||||
*/
|
||||
public function __construct(AllSoapAndRestFactory $factory)
|
||||
{
|
||||
$this->factory = $factory;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function item($entityId)
|
||||
{
|
||||
return $this->factory->create()
|
||||
->setEntityId($entityId)
|
||||
->setName('testItemName')
|
||||
->setIsEnabled(true)
|
||||
->setHasOrders(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function items()
|
||||
{
|
||||
$allSoapAndRest1 = $this->factory->create()->setEntityId(1)->setName('testProduct1');
|
||||
$allSoapAndRest2 = $this->factory->create()->setEntityId(2)->setName('testProduct2');
|
||||
return [$allSoapAndRest1, $allSoapAndRest2];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function create(\Magento\TestModule5\Service\V1\Entity\AllSoapAndRest $item)
|
||||
{
|
||||
return $this->factory->create()
|
||||
->setEntityId($item->getEntityId())
|
||||
->setName($item->getName())
|
||||
->setIsEnabled($item->isEnabled())
|
||||
->setHasOrders($item->hasOrders());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function update(\Magento\TestModule5\Service\V1\Entity\AllSoapAndRest $entityItem)
|
||||
{
|
||||
return $entityItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function nestedUpdate(
|
||||
$parentId,
|
||||
$entityId,
|
||||
\Magento\TestModule5\Service\V1\Entity\AllSoapAndRest $entityItem
|
||||
) {
|
||||
return $entityItem;
|
||||
}
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModule5\Service\V1;
|
||||
|
||||
/**
|
||||
* Both SOAP and REST Version ONE
|
||||
* @package Magento\TestModule5\Service\V1
|
||||
*/
|
||||
interface AllSoapAndRestInterface
|
||||
{
|
||||
/**
|
||||
* Retrieve an item.
|
||||
*
|
||||
* @param int $entityId
|
||||
* @return \Magento\TestModule5\Service\V1\Entity\AllSoapAndRest
|
||||
* @throws \Magento\Framework\Webapi\Exception
|
||||
*/
|
||||
public function item($entityId);
|
||||
|
||||
/**
|
||||
* Retrieve all items.
|
||||
*
|
||||
* @return \Magento\TestModule5\Service\V1\Entity\AllSoapAndRest[]
|
||||
*/
|
||||
public function items();
|
||||
|
||||
/**
|
||||
* Create a new item.
|
||||
*
|
||||
* @param \Magento\TestModule5\Service\V1\Entity\AllSoapAndRest $item
|
||||
* @return \Magento\TestModule5\Service\V1\Entity\AllSoapAndRest
|
||||
*/
|
||||
public function create(\Magento\TestModule5\Service\V1\Entity\AllSoapAndRest $item);
|
||||
|
||||
/**
|
||||
* Update existing item.
|
||||
*
|
||||
* @param \Magento\TestModule5\Service\V1\Entity\AllSoapAndRest $entityItem
|
||||
* @return \Magento\TestModule5\Service\V1\Entity\AllSoapAndRest
|
||||
*/
|
||||
public function update(\Magento\TestModule5\Service\V1\Entity\AllSoapAndRest $entityItem);
|
||||
|
||||
/**
|
||||
* Update existing item.
|
||||
*
|
||||
* @param string $parentId
|
||||
* @param string $entityId
|
||||
* @param \Magento\TestModule5\Service\V1\Entity\AllSoapAndRest $entityItem
|
||||
* @return \Magento\TestModule5\Service\V1\Entity\AllSoapAndRest
|
||||
*/
|
||||
public function nestedUpdate(
|
||||
$parentId,
|
||||
$entityId,
|
||||
\Magento\TestModule5\Service\V1\Entity\AllSoapAndRest $entityItem
|
||||
);
|
||||
}
|
||||
+122
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModule5\Service\V1\Entity;
|
||||
|
||||
/**
|
||||
* Some Data Object short description.
|
||||
*
|
||||
* Data Object long
|
||||
* multi line description.
|
||||
*/
|
||||
class AllSoapAndRest extends \Magento\Framework\Api\AbstractExtensibleObject
|
||||
{
|
||||
/**
|
||||
* Entity ID
|
||||
*/
|
||||
const ID = 'entity_id';
|
||||
const NAME = 'name';
|
||||
|
||||
/**
|
||||
* Is Enabled
|
||||
*/
|
||||
const ENABLED = 'enabled';
|
||||
const HAS_ORDERS = 'orders';
|
||||
|
||||
/**
|
||||
* Retrieve item ID.
|
||||
*
|
||||
* @return int Item ID
|
||||
*/
|
||||
public function getEntityId()
|
||||
{
|
||||
return $this->_get(self::ID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set item ID.
|
||||
*
|
||||
* @param int $entityId
|
||||
* @return $this
|
||||
*/
|
||||
public function setEntityId($entityId)
|
||||
{
|
||||
return $this->setData(self::ID, $entityId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve item Name.
|
||||
*
|
||||
* @return string|null Item name
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->_get(self::NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set item Name.
|
||||
*
|
||||
* @param string $name
|
||||
* @return $this
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
return $this->setData(self::NAME, $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if entity is enabled
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isEnabled()
|
||||
{
|
||||
return $this->_get(self::ENABLED);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set if entity is enabled
|
||||
*
|
||||
* @param bool $isEnabled
|
||||
* @return bool
|
||||
*/
|
||||
public function setIsEnabled($isEnabled)
|
||||
{
|
||||
return $this->setData(self::ENABLED, $isEnabled);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if current entity has a property defined
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasOrders()
|
||||
{
|
||||
return $this->_get(self::HAS_ORDERS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether current entity has a property defined
|
||||
*
|
||||
* @param bool $setHasOrders
|
||||
* @return $this
|
||||
*/
|
||||
public function setHasOrders($hasOrders)
|
||||
{
|
||||
return $this->setData(self::HAS_ORDERS, $hasOrders);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method which will not be used when adding complex type field to WSDL.
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
*/
|
||||
public function getFieldExcludedFromWsdl($value)
|
||||
{
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
namespace Magento\TestModule5\Service\V1;
|
||||
|
||||
use Magento\TestModule5\Service\V1\Entity\AllSoapAndRestFactory;
|
||||
|
||||
class OverrideService implements OverrideServiceInterface
|
||||
{
|
||||
/**
|
||||
* @var AllSoapAndRestFactory
|
||||
*/
|
||||
protected $factory;
|
||||
|
||||
/**
|
||||
* @param AllSoapAndRestFactory $factory
|
||||
*/
|
||||
public function __construct(AllSoapAndRestFactory $factory)
|
||||
{
|
||||
$this->factory = $factory;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function scalarUpdate($entityId, $name, $hasOrders)
|
||||
{
|
||||
return $this->factory->create()
|
||||
->setEntityId($entityId)
|
||||
->setName($name)
|
||||
->setHasOrders($hasOrders);
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
namespace Magento\TestModule5\Service\V1;
|
||||
|
||||
interface OverrideServiceInterface
|
||||
{
|
||||
/**
|
||||
* Update existing item.
|
||||
*
|
||||
* @param string $entityId
|
||||
* @param string $name
|
||||
* @param bool $orders
|
||||
* @return \Magento\TestModule5\Service\V1\Entity\AllSoapAndRest
|
||||
*/
|
||||
public function scalarUpdate($entityId, $name, $orders);
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModule5\Service\V2;
|
||||
|
||||
use Magento\TestModule5\Service\V2\Entity\AllSoapAndRest as AllSoapAndRestEntity;
|
||||
use Magento\TestModule5\Service\V2\Entity\AllSoapAndRestFactory;
|
||||
|
||||
class AllSoapAndRest implements AllSoapAndRestInterface
|
||||
{
|
||||
/**
|
||||
* @var AllSoapAndRestFactory
|
||||
*/
|
||||
protected $factory;
|
||||
|
||||
/**
|
||||
* @param AllSoapAndRestFactory $factory
|
||||
*/
|
||||
public function __construct(AllSoapAndRestFactory $factory)
|
||||
{
|
||||
$this->factory = $factory;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function item($id)
|
||||
{
|
||||
return $this->factory->create()->setPrice(1)->setId($id)->setName('testItemName');
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function items()
|
||||
{
|
||||
$allSoapAndRest1 = $this->factory->create()->setPrice(1)->setId(1)->setName('testProduct1');
|
||||
$allSoapAndRest2 = $this->factory->create()->setPrice(1)->setId(2)->setName('testProduct2');
|
||||
return [$allSoapAndRest1, $allSoapAndRest2];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function create(\Magento\TestModule5\Service\V2\Entity\AllSoapAndRest $item)
|
||||
{
|
||||
return $this->factory->create()->setPrice($item->getPrice());
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function update(\Magento\TestModule5\Service\V2\Entity\AllSoapAndRest $item)
|
||||
{
|
||||
$item->setName('Updated' . $item->getName());
|
||||
return $item;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $id
|
||||
* @return AllSoapAndRestEntity
|
||||
* @throws \Magento\Framework\Webapi\Exception
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
return $this->factory->create()->setPrice(1)->setId($id)->setName('testItemName');
|
||||
}
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModule5\Service\V2;
|
||||
|
||||
/**
|
||||
* Both SOAP and REST Version TWO
|
||||
* @package Magento\TestModule5\Service\V2
|
||||
*/
|
||||
interface AllSoapAndRestInterface
|
||||
{
|
||||
/**
|
||||
* Retrieve existing item.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Magento\TestModule5\Service\V2\Entity\AllSoapAndRest
|
||||
* @throws \Magento\Framework\Webapi\Exception
|
||||
*/
|
||||
public function item($id);
|
||||
|
||||
/**
|
||||
* Retrieve a list of all existing items.
|
||||
*
|
||||
* @return \Magento\TestModule5\Service\V2\Entity\AllSoapAndRest[]
|
||||
*/
|
||||
public function items();
|
||||
|
||||
/**
|
||||
* Add new item.
|
||||
*
|
||||
* @param \Magento\TestModule5\Service\V2\Entity\AllSoapAndRest $item
|
||||
* @return \Magento\TestModule5\Service\V2\Entity\AllSoapAndRest
|
||||
*/
|
||||
public function create(\Magento\TestModule5\Service\V2\Entity\AllSoapAndRest $item);
|
||||
|
||||
/**
|
||||
* Update one item.
|
||||
*
|
||||
* @param \Magento\TestModule5\Service\V2\Entity\AllSoapAndRest $item
|
||||
* @return \Magento\TestModule5\Service\V2\Entity\AllSoapAndRest
|
||||
*/
|
||||
public function update(\Magento\TestModule5\Service\V2\Entity\AllSoapAndRest $item);
|
||||
|
||||
/**
|
||||
* Delete existing item.
|
||||
*
|
||||
* @param string $id
|
||||
* @return \Magento\TestModule5\Service\V2\Entity\AllSoapAndRest
|
||||
*/
|
||||
public function delete($id);
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModule5\Service\V2\Entity;
|
||||
|
||||
/**
|
||||
* Some Data Object short description.
|
||||
*
|
||||
* Data Object long
|
||||
* multi line description.
|
||||
*/
|
||||
class AllSoapAndRest extends \Magento\TestModule5\Service\V2\AllSoapAndRest
|
||||
{
|
||||
/**
|
||||
* Price field
|
||||
*/
|
||||
const PRICE = 'price';
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getPrice()
|
||||
{
|
||||
return $this->_get(self::PRICE);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
|
||||
<acl>
|
||||
<resources>
|
||||
<resource id="Magento_Backend::admin">
|
||||
<resource id="Magento_TestModule5::all" title="TestModule5" sortOrder="1">
|
||||
<resource id="Magento_TestModule5::resource1" title="Resource1" sortOrder="20"/>
|
||||
<resource id="Magento_TestModule5::resource2" title="Resource2" sortOrder="10"/>
|
||||
<resource id="Magento_TestModule5::resource3" title="Resource3" sortOrder="30"/>
|
||||
</resource>
|
||||
</resource>
|
||||
</resources>
|
||||
</acl>
|
||||
</config>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
|
||||
<preference for="Magento\TestModule5\Service\V1\AllSoapAndRestInterface" type="Magento\TestModule5\Service\V1\AllSoapAndRest" />
|
||||
<preference for="Magento\TestModule5\Service\V2\AllSoapAndRestInterface" type="Magento\TestModule5\Service\V2\AllSoapAndRest" />
|
||||
<preference for="Magento\TestModule5\Service\V1\OverrideServiceInterface" type="Magento\TestModule5\Service\V1\OverrideService" />
|
||||
</config>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
|
||||
<module name="Magento_TestModule5" />
|
||||
</config>
|
||||
@@ -0,0 +1,79 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Webapi:etc/webapi.xsd">
|
||||
<route method="GET" url="/V1/TestModule5/:entityId">
|
||||
<service class="Magento\TestModule5\Service\V1\AllSoapAndRestInterface" method="item" />
|
||||
<resources>
|
||||
<resource ref="Magento_TestModule5::resource1" />
|
||||
</resources>
|
||||
</route>
|
||||
<route method="GET" url="/V1/TestModule5">
|
||||
<service class="Magento\TestModule5\Service\V1\AllSoapAndRestInterface" method="items" />
|
||||
<resources>
|
||||
<resource ref="Magento_TestModule5::resource2" />
|
||||
</resources>
|
||||
</route>
|
||||
<route method="POST" url="/V1/TestModule5">
|
||||
<service class="Magento\TestModule5\Service\V1\AllSoapAndRestInterface" method="create" />
|
||||
<resources>
|
||||
<resource ref="Magento_TestModule5::resource3" />
|
||||
</resources>
|
||||
</route>
|
||||
<route method="PUT" url="/V1/TestModule5/:entityId">
|
||||
<service class="Magento\TestModule5\Service\V1\AllSoapAndRestInterface" method="update" />
|
||||
<resources>
|
||||
<resource ref="Magento_TestModule5::resource1" />
|
||||
<resource ref="Magento_TestModule5::resource2" />
|
||||
</resources>
|
||||
</route>
|
||||
<route method="PUT" url="/V1/TestModule5/:parentId/nestedResource/:entityId">
|
||||
<service class="Magento\TestModule5\Service\V1\AllSoapAndRestInterface" method="nestedUpdate" />
|
||||
<resources>
|
||||
<resource ref="Magento_TestModule5::resource1" />
|
||||
<resource ref="Magento_TestModule5::resource2" />
|
||||
</resources>
|
||||
</route>
|
||||
<route method="PUT" url="/V1/TestModule5/OverrideService/:parentId/nestedResource/:entityId">
|
||||
<service class="Magento\TestModule5\Service\V1\OverrideServiceInterface" method="scalarUpdate" />
|
||||
<resources>
|
||||
<resource ref="Magento_TestModule5::resource1" />
|
||||
<resource ref="Magento_TestModule5::resource2" />
|
||||
</resources>
|
||||
</route>
|
||||
<route method="GET" url="/V2/TestModule5/:id">
|
||||
<service class="Magento\TestModule5\Service\V2\AllSoapAndRestInterface" method="item" />
|
||||
<resources>
|
||||
<resource ref="Magento_TestModule5::resource1" />
|
||||
</resources>
|
||||
</route>
|
||||
<route method="GET" url="/V2/TestModule5">
|
||||
<service class="Magento\TestModule5\Service\V2\AllSoapAndRestInterface" method="items" />
|
||||
<resources>
|
||||
<resource ref="Magento_TestModule5::resource2" />
|
||||
</resources>
|
||||
</route>
|
||||
<route method="POST" url="/V2/TestModule5">
|
||||
<service class="Magento\TestModule5\Service\V2\AllSoapAndRestInterface" method="create" />
|
||||
<resources>
|
||||
<resource ref="Magento_TestModule5::resource3" />
|
||||
</resources>
|
||||
</route>
|
||||
<route method="PUT" url="/V2/TestModule5/:id">
|
||||
<service class="Magento\TestModule5\Service\V2\AllSoapAndRestInterface" method="update" />
|
||||
<resources>
|
||||
<resource ref="Magento_TestModule5::resource1" />
|
||||
<resource ref="Magento_TestModule5::resource2" />
|
||||
</resources>
|
||||
</route>
|
||||
<route method="DELETE" url="/V2/TestModule5/:id">
|
||||
<service class="Magento\TestModule5\Service\V2\AllSoapAndRestInterface" method="delete" />
|
||||
<resources>
|
||||
<resource ref="Magento_TestModule5::resource1" />
|
||||
</resources>
|
||||
</route>
|
||||
</routes>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
use Magento\Framework\Component\ComponentRegistrar;
|
||||
|
||||
$registrar = new ComponentRegistrar();
|
||||
if ($registrar->getPath(ComponentRegistrar::MODULE, 'Magento_TestModule5') === null) {
|
||||
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_TestModule5', __DIR__);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
|
||||
<module name="Magento_TestModuleCatalogSearch">
|
||||
<sequence>
|
||||
<module name="Magento_CatalogSearch"/>
|
||||
</sequence>
|
||||
</module>
|
||||
</config>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
use Magento\Framework\Component\ComponentRegistrar;
|
||||
|
||||
$registrar = new ComponentRegistrar();
|
||||
if ($registrar->getPath(ComponentRegistrar::MODULE, 'Magento_TestModuleCatalogSearch') === null) {
|
||||
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_TestModuleCatalogSearch', __DIR__);
|
||||
}
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModuleDefaultHydrator\Api;
|
||||
|
||||
/**
|
||||
* Customer CRUD interface
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
interface CustomerPersistenceInterface
|
||||
{
|
||||
/**
|
||||
* Create customer
|
||||
*
|
||||
* @param \Magento\Customer\Api\Data\CustomerInterface $customer
|
||||
* @param string $passwordHash
|
||||
* @return \Magento\Customer\Api\Data\CustomerInterface
|
||||
* @throws \Magento\Framework\Exception\InputException If bad input is provided
|
||||
* @throws \Magento\Framework\Exception\State\InputMismatchException If the provided email is already used
|
||||
* @throws \Magento\Framework\Exception\LocalizedException
|
||||
*/
|
||||
public function save(\Magento\Customer\Api\Data\CustomerInterface $customer);
|
||||
|
||||
/**
|
||||
* Retrieve customer by email
|
||||
*
|
||||
* @param string $email
|
||||
* @param int|null $websiteId
|
||||
* @return \Magento\Customer\Api\Data\CustomerInterface
|
||||
* @throws \Magento\Framework\Exception\NoSuchEntityException If customer with the specified email does not exist
|
||||
* @throws \Magento\Framework\Exception\LocalizedException
|
||||
*/
|
||||
public function get($email, $websiteId = null);
|
||||
|
||||
/**
|
||||
* Retrieve customer by id
|
||||
*
|
||||
* @param int $id
|
||||
* @param int|null $websiteId
|
||||
* @return \Magento\Customer\Api\Data\CustomerInterface
|
||||
* @throws \Magento\Framework\Exception\NoSuchEntityException
|
||||
* @throws \Magento\Framework\Exception\LocalizedException
|
||||
*/
|
||||
public function getById($id, $websiteId = null);
|
||||
|
||||
/**
|
||||
* Delete customer by id
|
||||
*
|
||||
* @param int $id
|
||||
* @return bool
|
||||
* @throws \Magento\Framework\Exception\NoSuchEntityException
|
||||
* @throws \Magento\Framework\Exception\LocalizedException
|
||||
*/
|
||||
public function delete($id);
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModuleDefaultHydrator\Api\Data;
|
||||
|
||||
/**
|
||||
* @api
|
||||
*/
|
||||
interface ExtensionAttributeInterface
|
||||
{
|
||||
/**#@+
|
||||
* Constants for keys of data array. Identical to the name of the getter in snake case
|
||||
*/
|
||||
public const ID = 'id';
|
||||
public const CUSTOMER_ID = 'customer_id';
|
||||
public const VALUE = 'value';
|
||||
/**#@-*/
|
||||
|
||||
/**
|
||||
* Get ID
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
public function getId();
|
||||
|
||||
/**
|
||||
* Set ID
|
||||
*
|
||||
* @param int $id
|
||||
* @return $this
|
||||
*/
|
||||
public function setId($id);
|
||||
|
||||
/**
|
||||
* Get customer ID
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
public function getCustomerId();
|
||||
|
||||
/**
|
||||
* Set customer ID
|
||||
*
|
||||
* @param int $customerId
|
||||
* @return $this
|
||||
*/
|
||||
public function setCustomerId($customerId);
|
||||
|
||||
/**
|
||||
* Get value
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getValue();
|
||||
|
||||
/**
|
||||
* Set value
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
*/
|
||||
public function setValue($value);
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModuleDefaultHydrator\Model\Address;
|
||||
|
||||
use Magento\Framework\EntityManager\MapperInterface;
|
||||
|
||||
/**
|
||||
* Class Mapper
|
||||
*/
|
||||
class Mapper implements MapperInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function entityToDatabase($entityType, $data)
|
||||
{
|
||||
$data['street'] = implode("\n", $data['street']);
|
||||
$data['region_id'] = $data['region']['region_id'];
|
||||
$data['region_code'] = $data['region']['region_code'];
|
||||
$data['region'] = $data['region']['region'];
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function databaseToEntity($entityType, $data)
|
||||
{
|
||||
$data['street'] = explode("\n", $data['street']);
|
||||
$region = [
|
||||
'region' => $data['region'],
|
||||
'region_code' => $data['region_code'],
|
||||
'region_id' => $data['region_id']
|
||||
];
|
||||
$data['region'] = $region;
|
||||
unset($data['region_id'], $data['region_code']);
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModuleDefaultHydrator\Model;
|
||||
|
||||
use Magento\TestModuleDefaultHydrator\Api\CustomerPersistenceInterface;
|
||||
use Magento\Framework\EntityManager\EntityManager;
|
||||
use Magento\Customer\Api\Data\CustomerInterfaceFactory;
|
||||
|
||||
class CustomerPersistence implements CustomerPersistenceInterface
|
||||
{
|
||||
/**
|
||||
* @var EntityManager
|
||||
*/
|
||||
private $entityManager;
|
||||
|
||||
/**
|
||||
* @var CustomerInterfaceFactory
|
||||
*/
|
||||
private $customerDataFactory;
|
||||
|
||||
public function __construct(
|
||||
EntityManager $entityManager,
|
||||
CustomerInterfaceFactory $customerDataFactory
|
||||
) {
|
||||
$this->entityManager = $entityManager;
|
||||
$this->customerDataFactory = $customerDataFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function save(\Magento\Customer\Api\Data\CustomerInterface $customer)
|
||||
{
|
||||
return $this->entityManager->save($customer);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get($email, $websiteId = null)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getById($id, $websiteId = null)
|
||||
{
|
||||
/** @var \Magento\Customer\Api\Data\CustomerInterface $customer */
|
||||
$customer = $this->customerDataFactory->create();
|
||||
$entity = $this->entityManager->load($customer, $id);
|
||||
return $entity;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
/** @var \Magento\Customer\Api\Data\CustomerInterface $customer */
|
||||
$customer = $this->customerDataFactory->create();
|
||||
$customer = $this->entityManager->load($customer, $id);
|
||||
try {
|
||||
$this->entityManager->delete($customer);
|
||||
} catch (\Exception $e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModuleDefaultHydrator\Model\Data;
|
||||
|
||||
class ExtensionAttribute extends \Magento\Framework\Api\AbstractSimpleObject implements
|
||||
\Magento\TestModuleDefaultHydrator\Api\Data\ExtensionAttributeInterface
|
||||
{
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->_get(self::ID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get customer id
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCustomerId()
|
||||
{
|
||||
return $this->_get(self::CUSTOMER_ID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get value
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return $this->_get(self::VALUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set id
|
||||
*
|
||||
* @param int $id
|
||||
* @return $this
|
||||
*/
|
||||
public function setId($id)
|
||||
{
|
||||
return $this->setData(self::ID, $id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set customer id
|
||||
*
|
||||
* @param int $customerId
|
||||
* @return $this
|
||||
*/
|
||||
public function setCustomerId($customerId)
|
||||
{
|
||||
return $this->setData(self::CUSTOMER_ID, $customerId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set value
|
||||
*
|
||||
* @param int $value
|
||||
* @return $this
|
||||
*/
|
||||
public function setValue($value)
|
||||
{
|
||||
return $this->setData(self::VALUE, $value);
|
||||
}
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModuleDefaultHydrator\Model\ResourceModel\Address;
|
||||
|
||||
use Magento\Framework\EntityManager\Operation\ExtensionInterface;
|
||||
use Magento\Customer\Api\AddressRepositoryInterface;
|
||||
use Magento\Framework\Api\SearchCriteriaBuilder;
|
||||
use Magento\Customer\Api\Data\CustomerInterface;
|
||||
use Magento\Framework\EntityManager\EntityManager;
|
||||
|
||||
class ReadHandler implements ExtensionInterface
|
||||
{
|
||||
/**
|
||||
* @var EntityManager
|
||||
*/
|
||||
private $addressRepository;
|
||||
|
||||
/**
|
||||
* @var SearchCriteriaBuilder
|
||||
*/
|
||||
private $searchCriteriaBuilder;
|
||||
|
||||
/**
|
||||
* @param AddressRepositoryInterface $addressRepositoryInterface
|
||||
* @param SearchCriteriaBuilder $SearchCriteriaBuilder
|
||||
*/
|
||||
public function __construct(
|
||||
\Magento\Customer\Api\AddressRepositoryInterface $addressRepository,
|
||||
\Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder
|
||||
) {
|
||||
$this->addressRepository = $addressRepository;
|
||||
$this->searchCriteriaBuilder = $searchCriteriaBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CustomerInterface $entity
|
||||
* @return CustomerInterface
|
||||
* @throws \Exception
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function execute($entity, $arguments = [])
|
||||
{
|
||||
$searchCriteria = $this->searchCriteriaBuilder->addFilter('parent_id', $entity->getId())
|
||||
->create();
|
||||
$addressesResult = $this->addressRepository->getList($searchCriteria);
|
||||
$entity->setAddresses($addressesResult->getItems());
|
||||
return $entity;
|
||||
}
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModuleDefaultHydrator\Model\ResourceModel\Address;
|
||||
|
||||
use Magento\Framework\EntityManager\Operation\ExtensionInterface;
|
||||
use Magento\Framework\EntityManager\MetadataPool;
|
||||
use Magento\Framework\EntityManager\EntityManager;
|
||||
use Magento\Customer\Api\Data\CustomerInterface;
|
||||
|
||||
class SaveHandler implements ExtensionInterface
|
||||
{
|
||||
/**
|
||||
* @var EntityManager
|
||||
*/
|
||||
private $entityManager;
|
||||
|
||||
/**
|
||||
* @param EntityManager $entityManager
|
||||
*/
|
||||
public function __construct(
|
||||
EntityManager $entityManager
|
||||
) {
|
||||
$this->entityManager = $entityManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CustomerInterface $entity
|
||||
* @param array $arguments
|
||||
* @return CustomerInterface
|
||||
* @throws \Exception
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function execute($entity, $arguments = [])
|
||||
{
|
||||
$newAddresses = [];
|
||||
foreach ($entity->getAddresses() as $address) {
|
||||
$address->setCustomerId($entity->getId());
|
||||
$newAddresses[] = $this->entityManager->save($address);
|
||||
}
|
||||
$entity->setAddresses($newAddresses);
|
||||
return $entity;
|
||||
}
|
||||
}
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModuleDefaultHydrator\Model\ResourceModel;
|
||||
|
||||
use Magento\Framework\EntityManager\Operation\ExtensionInterface;
|
||||
use Magento\Framework\EntityManager\MetadataPool;
|
||||
use Magento\Framework\EntityManager\EntityManager;
|
||||
use Magento\Framework\App\ResourceConnection;
|
||||
use Magento\Customer\Api\Data\CustomerInterface;
|
||||
use Magento\Customer\Api\Data\CustomerExtensionFactory;
|
||||
use Magento\TestModuleDefaultHydrator\Api\Data\ExtensionAttributeInterface;
|
||||
use Magento\TestModuleDefaultHydrator\Api\Data\ExtensionAttributeInterfaceFactory as ExtensionAttributeFactory;
|
||||
|
||||
class ReadHandler implements ExtensionInterface
|
||||
{
|
||||
/**
|
||||
* @var EntityManager
|
||||
*/
|
||||
private $entityManager;
|
||||
|
||||
/**
|
||||
* @var ExtensionAttributeFactory
|
||||
*/
|
||||
private $extensionAttributeFactory;
|
||||
|
||||
/**
|
||||
* @var CustomerExtensionFactory
|
||||
*/
|
||||
private $customerExtensionFactory;
|
||||
|
||||
/**
|
||||
* @var MetadataPool
|
||||
*/
|
||||
private $metadataPool;
|
||||
|
||||
/**
|
||||
* @var ResourceConnection
|
||||
*/
|
||||
private $resourceConnection;
|
||||
|
||||
/**
|
||||
* @param EntityManager $entityManager
|
||||
* @param ExtensionAttributeFactory $extensionAttributeFactory
|
||||
* @param CustomerExtensionFactory $customerExtensionFactory
|
||||
* @param MetadataPool $metadataPool
|
||||
* @param ResourceConnection $resourceConnection
|
||||
*/
|
||||
public function __construct(
|
||||
EntityManager $entityManager,
|
||||
ExtensionAttributeFactory $extensionAttributeFactory,
|
||||
CustomerExtensionFactory $customerExtensionFactory,
|
||||
MetadataPool $metadataPool,
|
||||
ResourceConnection $resourceConnection
|
||||
) {
|
||||
$this->entityManager = $entityManager;
|
||||
$this->extensionAttributeFactory = $extensionAttributeFactory;
|
||||
$this->customerExtensionFactory = $customerExtensionFactory;
|
||||
$this->metadataPool = $metadataPool;
|
||||
$this->resourceConnection = $resourceConnection;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CustomerInterface $entity
|
||||
* @param array $arguments
|
||||
* @return CustomerInterface
|
||||
* @throws \Exception
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function execute($entity, $arguments = [])
|
||||
{
|
||||
$metadata = $this->metadataPool->getMetadata(ExtensionAttributeInterface::class);
|
||||
$connection = $this->resourceConnection->getConnectionByName(
|
||||
$metadata->getEntityConnectionName()
|
||||
);
|
||||
$id = $connection->fetchOne(
|
||||
$connection->select()
|
||||
->from($metadata->getEntityTable(), [$metadata->getIdentifierField()])
|
||||
->where('customer_id = ?', $entity->getId())
|
||||
->limit(1)
|
||||
);
|
||||
$extensionAttribute = $this->extensionAttributeFactory->create();
|
||||
$extensionAttribute = $this->entityManager->load($extensionAttribute, $id);
|
||||
$customerExtension = $this->customerExtensionFactory->create(
|
||||
[
|
||||
'data' => ['extension_attribute' => $extensionAttribute]
|
||||
]
|
||||
);
|
||||
$entity->setExtensionAttributes($customerExtension);
|
||||
return $entity;
|
||||
}
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\TestModuleDefaultHydrator\Model\ResourceModel;
|
||||
|
||||
use Magento\Framework\EntityManager\Operation\ExtensionInterface;
|
||||
use Magento\TestModuleDefaultHydrator\Api\Data\ExtensionAttributeInterface;
|
||||
use Magento\Customer\Api\Data\CustomerInterface;
|
||||
use Magento\Framework\EntityManager\EntityManager;
|
||||
|
||||
class SaveHandler implements ExtensionInterface
|
||||
{
|
||||
/**
|
||||
* @var EntityManager
|
||||
*/
|
||||
private $entityManager;
|
||||
|
||||
/**
|
||||
* @param EntityManager $entityManager
|
||||
*/
|
||||
public function __construct(
|
||||
EntityManager $entityManager
|
||||
) {
|
||||
$this->entityManager = $entityManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CustomerInterface $entity
|
||||
* @param array $arguments
|
||||
* @return CustomerInterface
|
||||
* @throws \Exception
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function execute($entity, $arguments = [])
|
||||
{
|
||||
$extensionAttribute = $entity->getExtensionAttributes()->getExtensionAttribute();
|
||||
$extensionAttribute->setCustomerId($entity->getId());
|
||||
$extensionAttribute = $this->entityManager->save($extensionAttribute);
|
||||
$entity->getExtensionAttributes()->setExtensionAttribute($extensionAttribute);
|
||||
return $entity;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
|
||||
<table name="testmodule_default_hydrator_extension_attribute_entity" resource="default" engine="innodb">
|
||||
<column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="true"/>
|
||||
<column xsi:type="int" name="customer_id" padding="10" unsigned="true" nullable="false" identity="false"/>
|
||||
<column xsi:type="varchar" name="value" nullable="true" length="255"/>
|
||||
<constraint xsi:type="primary" referenceId="PRIMARY">
|
||||
<column name="entity_id"/>
|
||||
</constraint>
|
||||
<constraint xsi:type="foreign" referenceId="CSTR_EXTENSION_ATTR_ENTT_CSTR_ID_CSTR_ENTT_ENTT_ID"
|
||||
table="testmodule_default_hydrator_extension_attribute_entity" column="customer_id"
|
||||
referenceTable="customer_entity" referenceColumn="entity_id" onDelete="CASCADE"/>
|
||||
</table>
|
||||
</schema>
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"testmodule_default_hydrator_extension_attribute_entity": {
|
||||
"column": {
|
||||
"entity_id": true,
|
||||
"customer_id": true,
|
||||
"value": true
|
||||
},
|
||||
"constraint": {
|
||||
"PRIMARY": true,
|
||||
"CSTR_EXTENSION_ATTR_ENTT_CSTR_ID_CSTR_ENTT_ENTT_ID": true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
|
||||
<preference for="Magento\TestModuleDefaultHydrator\Api\CustomerPersistenceInterface" type="Magento\TestModuleDefaultHydrator\Model\CustomerPersistence" />
|
||||
<preference for="Magento\TestModuleDefaultHydrator\Api\Data\ExtensionAttributeInterface" type="Magento\TestModuleDefaultHydrator\Model\Data\ExtensionAttribute" />
|
||||
<type name="Magento\Framework\EntityManager\Operation\ExtensionPool">
|
||||
<arguments>
|
||||
<argument name="extensionActions" xsi:type="array">
|
||||
<item name="Magento\Customer\Api\Data\CustomerInterface" xsi:type="array">
|
||||
<item name="read" xsi:type="array">
|
||||
<item name="extensionAttribute" xsi:type="string">Magento\TestModuleDefaultHydrator\Model\ResourceModel\ReadHandler</item>
|
||||
<item name="address" xsi:type="string">Magento\TestModuleDefaultHydrator\Model\ResourceModel\Address\ReadHandler</item>
|
||||
</item>
|
||||
<item name="create" xsi:type="array">
|
||||
<item name="extensionAttribute" xsi:type="string">Magento\TestModuleDefaultHydrator\Model\ResourceModel\SaveHandler</item>
|
||||
<item name="address" xsi:type="string">Magento\TestModuleDefaultHydrator\Model\ResourceModel\Address\SaveHandler</item>
|
||||
</item>
|
||||
<item name="update" xsi:type="array">
|
||||
<item name="extensionAttribute" xsi:type="string">Magento\TestModuleDefaultHydrator\Model\ResourceModel\SaveHandler</item>
|
||||
<item name="address" xsi:type="string">Magento\TestModuleDefaultHydrator\Model\ResourceModel\Address\SaveHandler</item>
|
||||
</item>
|
||||
</item>
|
||||
</argument>
|
||||
</arguments>
|
||||
</type>
|
||||
<type name="Magento\Framework\EntityManager\MetadataPool">
|
||||
<arguments>
|
||||
<argument name="metadata" xsi:type="array">
|
||||
<item name="Magento\Customer\Api\Data\CustomerInterface" xsi:type="array">
|
||||
<item name="entityTableName" xsi:type="string">customer_entity</item>
|
||||
<item name="eavEntityType" xsi:type="string">customer</item>
|
||||
<item name="identifierField" xsi:type="string">entity_id</item>
|
||||
</item>
|
||||
<item name="Magento\Customer\Api\Data\AddressInterface" xsi:type="array">
|
||||
<item name="entityTableName" xsi:type="string">customer_address_entity</item>
|
||||
<item name="eavEntityType" xsi:type="string">customer_address</item>
|
||||
<item name="identifierField" xsi:type="string">entity_id</item>
|
||||
</item>
|
||||
<item name="Magento\TestModuleDefaultHydrator\Api\Data\ExtensionAttributeInterface" xsi:type="array">
|
||||
<item name="entityTableName" xsi:type="string">testmodule_default_hydrator_extension_attribute_entity</item>
|
||||
<item name="identifierField" xsi:type="string">entity_id</item>
|
||||
</item>
|
||||
</argument>
|
||||
</arguments>
|
||||
</type>
|
||||
<type name="Magento\Framework\EntityManager\Mapper">
|
||||
<arguments>
|
||||
<argument name="config" xsi:type="array">
|
||||
<item name="Magento\Customer\Api\Data\CustomerInterface" xsi:type="array">
|
||||
<item name="entity_id" xsi:type="string">id</item>
|
||||
</item>
|
||||
<item name="Magento\Customer\Api\Data\AddressInterface" xsi:type="array">
|
||||
<item name="parent_id" xsi:type="string">customer_id</item>
|
||||
</item>
|
||||
</argument>
|
||||
</arguments>
|
||||
</type>
|
||||
<virtualType name="customerAddressMapper" type="Magento\Framework\EntityManager\CompositeMapper">
|
||||
<arguments>
|
||||
<argument name="mappers" xsi:type="array">
|
||||
<item name="addressMapper" xsi:type="object">Magento\TestModuleDefaultHydrator\Model\Address\Mapper</item>
|
||||
</argument>
|
||||
</arguments>
|
||||
</virtualType>
|
||||
<type name="Magento\Framework\EntityManager\MapperPool">
|
||||
<arguments>
|
||||
<argument name="mappers" xsi:type="array">
|
||||
<item name="Magento\Customer\Api\Data\AddressInterface" xsi:type="string">customerAddressMapper</item>
|
||||
</argument>
|
||||
</arguments>
|
||||
</type>
|
||||
</config>
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
|
||||
<extension_attributes for="Magento\Customer\Api\Data\CustomerInterface">
|
||||
<attribute code="extension_attribute" type="Magento\TestModuleDefaultHydrator\Api\Data\ExtensionAttributeInterface" />
|
||||
</extension_attributes>
|
||||
</config>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
|
||||
<module name="Magento_TestModuleDefaultHydrator">
|
||||
</module>
|
||||
</config>
|
||||
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Webapi:etc/webapi.xsd">
|
||||
<route url="/V1/TestModuleDefaultHydrator" method="POST">
|
||||
<service class="Magento\TestModuleDefaultHydrator\Api\CustomerPersistenceInterface" method="save"/>
|
||||
<resources>
|
||||
<resource ref="anonymous"/>
|
||||
</resources>
|
||||
</route>
|
||||
<route url="/V1/TestModuleDefaultHydrator/:id" method="GET">
|
||||
<service class="Magento\TestModuleDefaultHydrator\Api\CustomerPersistenceInterface" method="getById"/>
|
||||
<resources>
|
||||
<resource ref="anonymous"/>
|
||||
</resources>
|
||||
</route>
|
||||
<route url="/V1/TestModuleDefaultHydrator/:id" method="DELETE">
|
||||
<service class="Magento\TestModuleDefaultHydrator\Api\CustomerPersistenceInterface" method="delete"/>
|
||||
<resources>
|
||||
<resource ref="anonymous"/>
|
||||
</resources>
|
||||
</route>
|
||||
<route url="/V1/TestModuleDefaultHydrator/:id" method="PUT">
|
||||
<service class="Magento\TestModuleDefaultHydrator\Api\CustomerPersistenceInterface" method="save"/>
|
||||
<resources>
|
||||
<resource ref="anonymous"/>
|
||||
</resources>
|
||||
</route>
|
||||
</routes>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
use Magento\Framework\Component\ComponentRegistrar;
|
||||
|
||||
$registrar = new ComponentRegistrar();
|
||||
if ($registrar->getPath(ComponentRegistrar::MODULE, 'Magento_TestModuleDefaultHydrator') === null) {
|
||||
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_TestModuleDefaultHydrator', __DIR__);
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Magento\TestModuleEmail\Model\Transport;
|
||||
|
||||
use Laminas\Mail;
|
||||
use Magento\Framework\App\Filesystem\DirectoryList;
|
||||
use Magento\Framework\Filesystem;
|
||||
use Magento\Framework\Serialize\Serializer\Json;
|
||||
|
||||
class File implements \Laminas\Mail\Transport\TransportInterface
|
||||
{
|
||||
private const CONFIG_FILE = 'mail-transport-config.json';
|
||||
|
||||
/**
|
||||
* @var Filesystem
|
||||
*/
|
||||
private Filesystem $filesystem;
|
||||
|
||||
/**
|
||||
* @var Json
|
||||
*/
|
||||
private Json $json;
|
||||
|
||||
/**
|
||||
* @param Filesystem $filesystem
|
||||
* @param Json $json
|
||||
*/
|
||||
public function __construct(
|
||||
Filesystem $filesystem,
|
||||
Json $json
|
||||
) {
|
||||
$this->filesystem = $filesystem;
|
||||
$this->json = $json;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function send(Mail\Message $message)
|
||||
{
|
||||
$directory = $this->filesystem->getDirectoryWrite(DirectoryList::VAR_DIR);
|
||||
$config = $this->json->unserialize($directory->readFile(self::CONFIG_FILE));
|
||||
$directory = $this->filesystem->getDirectoryWrite($config['directory']);
|
||||
$mail = $message->toString();
|
||||
foreach ($message->getTo() as $address) {
|
||||
$index = 1;
|
||||
$filename = preg_replace('/[^a-z0-9_]/', '__', strtolower($address->getEmail()));
|
||||
$basePath = $config['path']. DIRECTORY_SEPARATOR . $filename;
|
||||
$path = $basePath . '.eml';
|
||||
while ($directory->isExist($path)) {
|
||||
$path = $basePath . '_' . ($index++) . '.eml';
|
||||
}
|
||||
$directory->writeFile($path, $mail);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds whether "file" mail transport is enabled
|
||||
*
|
||||
* @return bool
|
||||
* @throws \Magento\Framework\Exception\FileSystemException
|
||||
*/
|
||||
public function isEnabled(): bool
|
||||
{
|
||||
$directory = $this->filesystem->getDirectoryWrite(DirectoryList::VAR_DIR);
|
||||
return $directory->isExist(self::CONFIG_FILE);
|
||||
}
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Magento\TestModuleEmail\Plugin;
|
||||
|
||||
use Laminas\Mail\Transport\TransportInterface;
|
||||
use Magento\Email\Model\Transport;
|
||||
use Magento\TestModuleEmail\Model\Transport\File;
|
||||
|
||||
class MockMailTransporter
|
||||
{
|
||||
/**
|
||||
* @var File
|
||||
*/
|
||||
private File $file;
|
||||
|
||||
/**
|
||||
* @param File $file
|
||||
*/
|
||||
public function __construct(
|
||||
File $file
|
||||
) {
|
||||
$this->file = $file;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Transport $subject
|
||||
* @param \Closure $proceed
|
||||
* @return TransportInterface
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
public function aroundGetTransport(
|
||||
Transport $subject,
|
||||
\Closure $proceed
|
||||
): TransportInterface {
|
||||
return $this->file->isEnabled() ? $this->file : $proceed();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
|
||||
<type name="Magento\Email\Model\Transport">
|
||||
<plugin name="mock_mail_transporter" type="Magento\TestModuleEmail\Plugin\MockMailTransporter"/>
|
||||
</type>
|
||||
</config>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
|
||||
<module name="Magento_TestModuleEmail" />
|
||||
</config>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use Magento\Framework\Component\ComponentRegistrar;
|
||||
|
||||
$registrar = new ComponentRegistrar();
|
||||
if ($registrar->getPath(ComponentRegistrar::MODULE, 'Magento_TestModuleEmail') === null) {
|
||||
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_TestModuleEmail', __DIR__);
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2023 Adobe
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Magento\TestModuleFedex\Model;
|
||||
|
||||
/**
|
||||
* Mock Fedex rest client factory
|
||||
*/
|
||||
class MockCurlClient extends \Magento\Framework\HTTP\Client\Curl
|
||||
{
|
||||
/**
|
||||
* @var MockResponseBodyLoader
|
||||
*/
|
||||
private $mockResponseBodyLoader;
|
||||
|
||||
/**
|
||||
* Oauth End point to get Access Token
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private const OAUTH_REQUEST_END_POINT = 'oauth/token';
|
||||
|
||||
/**
|
||||
* REST end point for Rate API
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private const RATE_REQUEST_END_POINT = 'rate/v1/rates/quotes';
|
||||
|
||||
/**
|
||||
* @param MockResponseBodyLoader $mockResponseBodyLoader
|
||||
*/
|
||||
public function __construct(
|
||||
MockResponseBodyLoader $mockResponseBodyLoader,
|
||||
) {
|
||||
$this->mockResponseBodyLoader = $mockResponseBodyLoader;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch mock Fedex rates
|
||||
*
|
||||
* @param string $url
|
||||
* @param array $request
|
||||
* @return void
|
||||
* @throws \Magento\Framework\Exception\NotFoundException
|
||||
*/
|
||||
public function post($url, $request): void
|
||||
{
|
||||
if (strpos($url, self::OAUTH_REQUEST_END_POINT) !== false) {
|
||||
$this->_responseBody = $this->mockResponseBodyLoader->loadForAuthRequest();
|
||||
}
|
||||
|
||||
if (strpos($url, self::RATE_REQUEST_END_POINT) !== false) {
|
||||
$this->_responseBody = $this->mockResponseBodyLoader->loadForRestRequest(json_decode($request, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2023 Adobe
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Magento\TestModuleFedex\Model;
|
||||
|
||||
use Magento\Framework\App\ObjectManager;
|
||||
|
||||
/**
|
||||
* Mock Fedex rest client factory
|
||||
*/
|
||||
class MockCurlFactory extends \Magento\Framework\HTTP\Client\CurlFactory
|
||||
{
|
||||
/**
|
||||
* Create instance of the mock curlClient
|
||||
*
|
||||
* @param array $data
|
||||
* @return \Magento\Framework\HTTP\Client\Curl
|
||||
*/
|
||||
public function create(array $data = []): \Magento\Framework\HTTP\Client\Curl
|
||||
{
|
||||
return ObjectManager::getInstance()->create(
|
||||
MockCurlClient::class,
|
||||
[
|
||||
'data' => $data
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Magento\TestModuleFedex\Model;
|
||||
|
||||
use Magento\Framework\Exception\NotFoundException;
|
||||
use Magento\Framework\HTTP\AsyncClient\Request;
|
||||
use Magento\Framework\Module\Dir;
|
||||
use Magento\Framework\Filesystem\Io\File;
|
||||
use Magento\Framework\Stdlib\ArrayManager;
|
||||
|
||||
/**
|
||||
* Load mock response body for Fedex rate request
|
||||
*/
|
||||
class MockResponseBodyLoader
|
||||
{
|
||||
private const REST_RESPONSE_FILE_PATTERN = '%s/_files/mock_rest_response_%s_%s.json';
|
||||
private const REST_PATH_COUNTRY = 'requestedShipment/recipient/address/countryCode';
|
||||
private const REST_PATH_SERVICE_TYPE = 'requestedShipment/serviceType';
|
||||
private const REST_AUTH_RESPONSE_FILE = '%s/_files/mock_rest_response_auth.json';
|
||||
|
||||
/**
|
||||
* @var Dir
|
||||
*/
|
||||
private $moduleDirectory;
|
||||
|
||||
/**
|
||||
* @var File
|
||||
*/
|
||||
private $fileIo;
|
||||
|
||||
/**
|
||||
* @var ArrayManager
|
||||
*/
|
||||
private $arrayManager;
|
||||
|
||||
/**
|
||||
* @param Dir $moduleDirectory
|
||||
* @param File $fileIo
|
||||
* @param ArrayManager
|
||||
*/
|
||||
public function __construct(
|
||||
Dir $moduleDirectory,
|
||||
File $fileIo,
|
||||
ArrayManager $arrayManager
|
||||
) {
|
||||
$this->moduleDirectory = $moduleDirectory;
|
||||
$this->fileIo = $fileIo;
|
||||
$this->arrayManager = $arrayManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads mock json response for a given request
|
||||
*
|
||||
* @param array $request
|
||||
* @return string
|
||||
* @throws NotFoundException
|
||||
*/
|
||||
public function loadForRestRequest(array $request): string
|
||||
{
|
||||
$moduleDir = $this->moduleDirectory->getDir('Magento_TestModuleFedex');
|
||||
|
||||
$type = strtolower($this->arrayManager->get(static::REST_PATH_SERVICE_TYPE, $request) ?? 'general');
|
||||
$country = strtolower($this->arrayManager->get(static::REST_PATH_COUNTRY, $request) ?? '');
|
||||
|
||||
$responsePath = sprintf(static::REST_RESPONSE_FILE_PATTERN, $moduleDir, $type, $country);
|
||||
|
||||
if (!$this->fileIo->fileExists($responsePath)) {
|
||||
throw new NotFoundException(
|
||||
__('"%1" is not a valid mock response type for country "%2".', $type, $country)
|
||||
);
|
||||
}
|
||||
return $this->fileIo->read($responsePath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load mock json response for a given request
|
||||
*/
|
||||
public function loadForAuthRequest()
|
||||
{
|
||||
$moduleDir = $this->moduleDirectory->getDir('Magento_TestModuleFedex');
|
||||
$responsePath = sprintf(static::REST_AUTH_RESPONSE_FILE, $moduleDir);
|
||||
|
||||
if (!$this->fileIo->fileExists($responsePath)) {
|
||||
throw new NotFoundException(
|
||||
__('No valid mock response found for Authentication.')
|
||||
);
|
||||
}
|
||||
return $this->fileIo->read($responsePath);
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"access_token": "TEST_ACCESS_TOKEN",
|
||||
"token_type": "bearer",
|
||||
"expires_in": 3599,
|
||||
"scope": "CXS-TP"
|
||||
}
|
||||
+529
@@ -0,0 +1,529 @@
|
||||
{
|
||||
"transactionId": "TEST-RESPONSE-GENERAL_CA-0de9-4f74-89ab-d23e63d743bf",
|
||||
"customerTransactionId": "customer test",
|
||||
"output": {
|
||||
"alerts": [
|
||||
{
|
||||
"code": "VIRTUAL.RESPONSE",
|
||||
"message": "This is a Virtual Response.",
|
||||
"alertType": "NOTE"
|
||||
}
|
||||
],
|
||||
"rateReplyDetails": [
|
||||
{
|
||||
"serviceType": "SMART_POST",
|
||||
"serviceName": "FedEx SmartPost®",
|
||||
"packagingType": "YOUR_PACKAGING",
|
||||
"ratedShipmentDetails": [
|
||||
{
|
||||
"rateType": "LIST",
|
||||
"ratedWeightMethod": "ACTUAL",
|
||||
"totalDiscounts": 0,
|
||||
"totalBaseCharge": 35.42,
|
||||
"totalNetCharge": 41.61,
|
||||
"totalNetFedExCharge": 41.61,
|
||||
"shipmentRateDetail": {
|
||||
"rateZone": "5",
|
||||
"dimDivisor": 139,
|
||||
"fuelSurchargePercent": 14.25,
|
||||
"totalSurcharges": 6.19,
|
||||
"totalFreightDiscount": 0,
|
||||
"surCharges": [
|
||||
{
|
||||
"type": "DELIVERY_CONFIRMATION",
|
||||
"description": "Delivery and Returns",
|
||||
"level": "PACKAGE",
|
||||
"amount": 1
|
||||
},
|
||||
{
|
||||
"type": "FUEL",
|
||||
"description": "Fuel Surcharge",
|
||||
"level": "PACKAGE",
|
||||
"amount": 5.19
|
||||
}
|
||||
],
|
||||
"totalBillingWeight": {
|
||||
"units": "LB",
|
||||
"value": 25
|
||||
},
|
||||
"dimDivisorType": "COUNTRY",
|
||||
"currency": "USD"
|
||||
},
|
||||
"ratedPackages": [
|
||||
{
|
||||
"groupNumber": 0,
|
||||
"effectiveNetDiscount": 0,
|
||||
"packageRateDetail": {
|
||||
"rateType": "PAYOR_LIST_PACKAGE",
|
||||
"ratedWeightMethod": "ACTUAL",
|
||||
"baseCharge": 35.42,
|
||||
"netFreight": 35.42,
|
||||
"totalSurcharges": 6.19,
|
||||
"netFedExCharge": 41.61,
|
||||
"totalTaxes": 0,
|
||||
"netCharge": 41.61,
|
||||
"totalRebates": 0,
|
||||
"billingWeight": {
|
||||
"units": "LB",
|
||||
"value": 25
|
||||
},
|
||||
"totalFreightDiscounts": 0,
|
||||
"surcharges": [
|
||||
{
|
||||
"type": "DELIVERY_CONFIRMATION",
|
||||
"description": "Delivery and Returns",
|
||||
"level": "PACKAGE",
|
||||
"amount": 1
|
||||
},
|
||||
{
|
||||
"type": "FUEL",
|
||||
"description": "Fuel Surcharge",
|
||||
"level": "PACKAGE",
|
||||
"amount": 5.19
|
||||
}
|
||||
],
|
||||
"currency": "USD"
|
||||
}
|
||||
}
|
||||
],
|
||||
"currency": "USD"
|
||||
}
|
||||
],
|
||||
"operationalDetail": {
|
||||
"ineligibleForMoneyBackGuarantee": false,
|
||||
"astraDescription": "SMART POST"
|
||||
},
|
||||
"signatureOptionType": "SERVICE_DEFAULT",
|
||||
"serviceDescription": {
|
||||
"serviceId": "EP1000000141",
|
||||
"serviceType": "SMART_POST",
|
||||
"names": [
|
||||
{
|
||||
"type": "long",
|
||||
"encoding": "utf-8",
|
||||
"value": "FedEx SmartPost®"
|
||||
},
|
||||
{
|
||||
"type": "long",
|
||||
"encoding": "ascii",
|
||||
"value": "FedEx SmartPost"
|
||||
},
|
||||
{
|
||||
"type": "medium",
|
||||
"encoding": "utf-8",
|
||||
"value": "SmartPost®"
|
||||
},
|
||||
{
|
||||
"type": "medium",
|
||||
"encoding": "ascii",
|
||||
"value": "SmartPost"
|
||||
},
|
||||
{
|
||||
"type": "short",
|
||||
"encoding": "utf-8",
|
||||
"value": "SP"
|
||||
},
|
||||
{
|
||||
"type": "short",
|
||||
"encoding": "ascii",
|
||||
"value": "SP"
|
||||
},
|
||||
{
|
||||
"type": "abbrv",
|
||||
"encoding": "ascii",
|
||||
"value": "SP"
|
||||
}
|
||||
],
|
||||
"description": "Smart Post",
|
||||
"astraDescription": "SMART POST"
|
||||
}
|
||||
},
|
||||
{
|
||||
"serviceType": "FEDEX_GROUND",
|
||||
"serviceName": "FedEx Ground",
|
||||
"packagingType": "YOUR_PACKAGING",
|
||||
"ratedShipmentDetails": [
|
||||
{
|
||||
"rateType": "LIST",
|
||||
"ratedWeightMethod": "ACTUAL",
|
||||
"totalDiscounts": 0,
|
||||
"totalBaseCharge": 35.42,
|
||||
"totalNetCharge": 41.61,
|
||||
"totalNetFedExCharge": 41.61,
|
||||
"shipmentRateDetail": {
|
||||
"rateZone": "5",
|
||||
"dimDivisor": 139,
|
||||
"fuelSurchargePercent": 14.25,
|
||||
"totalSurcharges": 6.19,
|
||||
"totalFreightDiscount": 0,
|
||||
"surCharges": [
|
||||
{
|
||||
"type": "DELIVERY_CONFIRMATION",
|
||||
"description": "Delivery and Returns",
|
||||
"level": "PACKAGE",
|
||||
"amount": 1
|
||||
},
|
||||
{
|
||||
"type": "FUEL",
|
||||
"description": "Fuel Surcharge",
|
||||
"level": "PACKAGE",
|
||||
"amount": 5.19
|
||||
}
|
||||
],
|
||||
"totalBillingWeight": {
|
||||
"units": "LB",
|
||||
"value": 25
|
||||
},
|
||||
"dimDivisorType": "COUNTRY",
|
||||
"currency": "USD"
|
||||
},
|
||||
"ratedPackages": [
|
||||
{
|
||||
"groupNumber": 0,
|
||||
"effectiveNetDiscount": 0,
|
||||
"packageRateDetail": {
|
||||
"rateType": "PAYOR_LIST_PACKAGE",
|
||||
"ratedWeightMethod": "ACTUAL",
|
||||
"baseCharge": 35.42,
|
||||
"netFreight": 35.42,
|
||||
"totalSurcharges": 6.19,
|
||||
"netFedExCharge": 41.61,
|
||||
"totalTaxes": 0,
|
||||
"netCharge": 41.61,
|
||||
"totalRebates": 0,
|
||||
"billingWeight": {
|
||||
"units": "LB",
|
||||
"value": 25
|
||||
},
|
||||
"totalFreightDiscounts": 0,
|
||||
"surcharges": [
|
||||
{
|
||||
"type": "DELIVERY_CONFIRMATION",
|
||||
"description": "Delivery and Returns",
|
||||
"level": "PACKAGE",
|
||||
"amount": 1
|
||||
},
|
||||
{
|
||||
"type": "FUEL",
|
||||
"description": "Fuel Surcharge",
|
||||
"level": "PACKAGE",
|
||||
"amount": 5.19
|
||||
}
|
||||
],
|
||||
"currency": "USD"
|
||||
}
|
||||
}
|
||||
],
|
||||
"currency": "USD"
|
||||
}
|
||||
],
|
||||
"operationalDetail": {
|
||||
"ineligibleForMoneyBackGuarantee": false,
|
||||
"astraDescription": "Ground"
|
||||
},
|
||||
"signatureOptionType": "SERVICE_DEFAULT",
|
||||
"serviceDescription": {
|
||||
"serviceId": "EP1000000141",
|
||||
"serviceType": "FEDEX_GROUND",
|
||||
"names": [
|
||||
{
|
||||
"type": "long",
|
||||
"encoding": "utf-8",
|
||||
"value": "FedEx Ground"
|
||||
},
|
||||
{
|
||||
"type": "long",
|
||||
"encoding": "ascii",
|
||||
"value": "FedEx Ground"
|
||||
},
|
||||
{
|
||||
"type": "medium",
|
||||
"encoding": "utf-8",
|
||||
"value": "SmartPost®"
|
||||
},
|
||||
{
|
||||
"type": "medium",
|
||||
"encoding": "ascii",
|
||||
"value": "SmartPost"
|
||||
},
|
||||
{
|
||||
"type": "short",
|
||||
"encoding": "utf-8",
|
||||
"value": "SP"
|
||||
},
|
||||
{
|
||||
"type": "short",
|
||||
"encoding": "ascii",
|
||||
"value": "SP"
|
||||
},
|
||||
{
|
||||
"type": "abbrv",
|
||||
"encoding": "ascii",
|
||||
"value": "SP"
|
||||
}
|
||||
],
|
||||
"description": "Ground",
|
||||
"astraDescription": "Ground"
|
||||
}
|
||||
},
|
||||
{
|
||||
"serviceType": "INTERNATIONAL_ECONOMY",
|
||||
"serviceName": "International Economy",
|
||||
"packagingType": "YOUR_PACKAGING",
|
||||
"ratedShipmentDetails": [
|
||||
{
|
||||
"rateType": "LIST",
|
||||
"ratedWeightMethod": "ACTUAL",
|
||||
"totalDiscounts": 0,
|
||||
"totalBaseCharge": 35.42,
|
||||
"totalNetCharge": 41.61,
|
||||
"totalNetFedExCharge": 41.61,
|
||||
"shipmentRateDetail": {
|
||||
"rateZone": "5",
|
||||
"dimDivisor": 139,
|
||||
"fuelSurchargePercent": 14.25,
|
||||
"totalSurcharges": 6.19,
|
||||
"totalFreightDiscount": 0,
|
||||
"surCharges": [
|
||||
{
|
||||
"type": "DELIVERY_CONFIRMATION",
|
||||
"description": "Delivery and Returns",
|
||||
"level": "PACKAGE",
|
||||
"amount": 1
|
||||
},
|
||||
{
|
||||
"type": "FUEL",
|
||||
"description": "Fuel Surcharge",
|
||||
"level": "PACKAGE",
|
||||
"amount": 5.19
|
||||
}
|
||||
],
|
||||
"totalBillingWeight": {
|
||||
"units": "LB",
|
||||
"value": 25
|
||||
},
|
||||
"dimDivisorType": "COUNTRY",
|
||||
"currency": "USD"
|
||||
},
|
||||
"ratedPackages": [
|
||||
{
|
||||
"groupNumber": 0,
|
||||
"effectiveNetDiscount": 0,
|
||||
"packageRateDetail": {
|
||||
"rateType": "PAYOR_LIST_PACKAGE",
|
||||
"ratedWeightMethod": "ACTUAL",
|
||||
"baseCharge": 35.42,
|
||||
"netFreight": 35.42,
|
||||
"totalSurcharges": 6.19,
|
||||
"netFedExCharge": 41.61,
|
||||
"totalTaxes": 0,
|
||||
"netCharge": 41.61,
|
||||
"totalRebates": 0,
|
||||
"billingWeight": {
|
||||
"units": "LB",
|
||||
"value": 25
|
||||
},
|
||||
"totalFreightDiscounts": 0,
|
||||
"surcharges": [
|
||||
{
|
||||
"type": "DELIVERY_CONFIRMATION",
|
||||
"description": "Delivery and Returns",
|
||||
"level": "PACKAGE",
|
||||
"amount": 1
|
||||
},
|
||||
{
|
||||
"type": "FUEL",
|
||||
"description": "Fuel Surcharge",
|
||||
"level": "PACKAGE",
|
||||
"amount": 5.19
|
||||
}
|
||||
],
|
||||
"currency": "USD"
|
||||
}
|
||||
}
|
||||
],
|
||||
"currency": "USD"
|
||||
}
|
||||
],
|
||||
"operationalDetail": {
|
||||
"ineligibleForMoneyBackGuarantee": false,
|
||||
"astraDescription": "Ground"
|
||||
},
|
||||
"signatureOptionType": "SERVICE_DEFAULT",
|
||||
"serviceDescription": {
|
||||
"serviceId": "EP1000000141",
|
||||
"serviceType": "INTERNATIONAL_ECONOMY",
|
||||
"names": [
|
||||
{
|
||||
"type": "long",
|
||||
"encoding": "utf-8",
|
||||
"value": "International Economy"
|
||||
},
|
||||
{
|
||||
"type": "long",
|
||||
"encoding": "ascii",
|
||||
"value": "International Economy"
|
||||
},
|
||||
{
|
||||
"type": "medium",
|
||||
"encoding": "utf-8",
|
||||
"value": "International Economy"
|
||||
},
|
||||
{
|
||||
"type": "medium",
|
||||
"encoding": "ascii",
|
||||
"value": "International Economy"
|
||||
},
|
||||
{
|
||||
"type": "short",
|
||||
"encoding": "utf-8",
|
||||
"value": "IE"
|
||||
},
|
||||
{
|
||||
"type": "short",
|
||||
"encoding": "ascii",
|
||||
"value": "SP"
|
||||
},
|
||||
{
|
||||
"type": "abbrv",
|
||||
"encoding": "ascii",
|
||||
"value": "IE"
|
||||
}
|
||||
],
|
||||
"description": "International Economy",
|
||||
"astraDescription": "International Economy"
|
||||
}
|
||||
},
|
||||
{
|
||||
"serviceType": "INTERNATIONAL_PRIORITY",
|
||||
"serviceName": "International Priority",
|
||||
"packagingType": "YOUR_PACKAGING",
|
||||
"ratedShipmentDetails": [
|
||||
{
|
||||
"rateType": "LIST",
|
||||
"ratedWeightMethod": "ACTUAL",
|
||||
"totalDiscounts": 0,
|
||||
"totalBaseCharge": 35.42,
|
||||
"totalNetCharge": 41.61,
|
||||
"totalNetFedExCharge": 41.61,
|
||||
"shipmentRateDetail": {
|
||||
"rateZone": "5",
|
||||
"dimDivisor": 139,
|
||||
"fuelSurchargePercent": 14.25,
|
||||
"totalSurcharges": 6.19,
|
||||
"totalFreightDiscount": 0,
|
||||
"surCharges": [
|
||||
{
|
||||
"type": "DELIVERY_CONFIRMATION",
|
||||
"description": "Delivery and Returns",
|
||||
"level": "PACKAGE",
|
||||
"amount": 1
|
||||
},
|
||||
{
|
||||
"type": "FUEL",
|
||||
"description": "Fuel Surcharge",
|
||||
"level": "PACKAGE",
|
||||
"amount": 5.19
|
||||
}
|
||||
],
|
||||
"totalBillingWeight": {
|
||||
"units": "LB",
|
||||
"value": 25
|
||||
},
|
||||
"dimDivisorType": "COUNTRY",
|
||||
"currency": "USD"
|
||||
},
|
||||
"ratedPackages": [
|
||||
{
|
||||
"groupNumber": 0,
|
||||
"effectiveNetDiscount": 0,
|
||||
"packageRateDetail": {
|
||||
"rateType": "PAYOR_LIST_PACKAGE",
|
||||
"ratedWeightMethod": "ACTUAL",
|
||||
"baseCharge": 35.42,
|
||||
"netFreight": 35.42,
|
||||
"totalSurcharges": 6.19,
|
||||
"netFedExCharge": 41.61,
|
||||
"totalTaxes": 0,
|
||||
"netCharge": 41.61,
|
||||
"totalRebates": 0,
|
||||
"billingWeight": {
|
||||
"units": "LB",
|
||||
"value": 25
|
||||
},
|
||||
"totalFreightDiscounts": 0,
|
||||
"surcharges": [
|
||||
{
|
||||
"type": "DELIVERY_CONFIRMATION",
|
||||
"description": "Delivery and Returns",
|
||||
"level": "PACKAGE",
|
||||
"amount": 1
|
||||
},
|
||||
{
|
||||
"type": "FUEL",
|
||||
"description": "Fuel Surcharge",
|
||||
"level": "PACKAGE",
|
||||
"amount": 5.19
|
||||
}
|
||||
],
|
||||
"currency": "USD"
|
||||
}
|
||||
}
|
||||
],
|
||||
"currency": "USD"
|
||||
}
|
||||
],
|
||||
"operationalDetail": {
|
||||
"ineligibleForMoneyBackGuarantee": false,
|
||||
"astraDescription": "Ground"
|
||||
},
|
||||
"signatureOptionType": "SERVICE_DEFAULT",
|
||||
"serviceDescription": {
|
||||
"serviceId": "EP1000000141",
|
||||
"serviceType": "INTERNATIONAL_PRIORITY",
|
||||
"names": [
|
||||
{
|
||||
"type": "long",
|
||||
"encoding": "utf-8",
|
||||
"value": "International Economy"
|
||||
},
|
||||
{
|
||||
"type": "long",
|
||||
"encoding": "ascii",
|
||||
"value": "International Priority"
|
||||
},
|
||||
{
|
||||
"type": "medium",
|
||||
"encoding": "utf-8",
|
||||
"value": "International Priority"
|
||||
},
|
||||
{
|
||||
"type": "medium",
|
||||
"encoding": "ascii",
|
||||
"value": "International Priority"
|
||||
},
|
||||
{
|
||||
"type": "short",
|
||||
"encoding": "utf-8",
|
||||
"value": "IP"
|
||||
},
|
||||
{
|
||||
"type": "short",
|
||||
"encoding": "ascii",
|
||||
"value": "IP"
|
||||
},
|
||||
{
|
||||
"type": "abbrv",
|
||||
"encoding": "ascii",
|
||||
"value": "IE"
|
||||
}
|
||||
],
|
||||
"description": "International Priority",
|
||||
"astraDescription": "International Priority"
|
||||
}
|
||||
}
|
||||
],
|
||||
"quoteDate": "2023-08-14",
|
||||
"encoded": false
|
||||
}
|
||||
}
|
||||
+657
@@ -0,0 +1,657 @@
|
||||
{
|
||||
"transactionId": "TEST-RESPONSE-GENERAL_US-0de9-4f74-89ab-d23e63d743bf",
|
||||
"customerTransactionId": "customer test",
|
||||
"output": {
|
||||
"alerts": [
|
||||
{
|
||||
"code": "VIRTUAL.RESPONSE",
|
||||
"message": "This is a Virtual Response.",
|
||||
"alertType": "NOTE"
|
||||
}
|
||||
],
|
||||
"rateReplyDetails": [
|
||||
{
|
||||
"serviceType": "FEDEX_GROUND",
|
||||
"serviceName": "Ground",
|
||||
"packagingType": "YOUR_PACKAGING",
|
||||
"ratedShipmentDetails": [
|
||||
{
|
||||
"rateType": "LIST",
|
||||
"ratedWeightMethod": "ACTUAL",
|
||||
"totalDiscounts": 0,
|
||||
"totalBaseCharge": 35.42,
|
||||
"totalNetCharge": 41.61,
|
||||
"totalNetFedExCharge": 41.61,
|
||||
"shipmentRateDetail": {
|
||||
"rateZone": "5",
|
||||
"dimDivisor": 139,
|
||||
"fuelSurchargePercent": 14.25,
|
||||
"totalSurcharges": 6.19,
|
||||
"totalFreightDiscount": 0,
|
||||
"surCharges": [
|
||||
{
|
||||
"type": "DELIVERY_CONFIRMATION",
|
||||
"description": "Delivery and Returns",
|
||||
"level": "PACKAGE",
|
||||
"amount": 1
|
||||
},
|
||||
{
|
||||
"type": "FUEL",
|
||||
"description": "Fuel Surcharge",
|
||||
"level": "PACKAGE",
|
||||
"amount": 5.19
|
||||
}
|
||||
],
|
||||
"totalBillingWeight": {
|
||||
"units": "LB",
|
||||
"value": 25
|
||||
},
|
||||
"dimDivisorType": "COUNTRY",
|
||||
"currency": "USD"
|
||||
},
|
||||
"ratedPackages": [
|
||||
{
|
||||
"groupNumber": 0,
|
||||
"effectiveNetDiscount": 0,
|
||||
"packageRateDetail": {
|
||||
"rateType": "PAYOR_LIST_PACKAGE",
|
||||
"ratedWeightMethod": "ACTUAL",
|
||||
"baseCharge": 35.42,
|
||||
"netFreight": 35.42,
|
||||
"totalSurcharges": 6.19,
|
||||
"netFedExCharge": 41.61,
|
||||
"totalTaxes": 0,
|
||||
"netCharge": 41.61,
|
||||
"totalRebates": 0,
|
||||
"billingWeight": {
|
||||
"units": "LB",
|
||||
"value": 25
|
||||
},
|
||||
"totalFreightDiscounts": 0,
|
||||
"surcharges": [
|
||||
{
|
||||
"type": "DELIVERY_CONFIRMATION",
|
||||
"description": "Delivery and Returns",
|
||||
"level": "PACKAGE",
|
||||
"amount": 1
|
||||
},
|
||||
{
|
||||
"type": "FUEL",
|
||||
"description": "Fuel Surcharge",
|
||||
"level": "PACKAGE",
|
||||
"amount": 5.19
|
||||
}
|
||||
],
|
||||
"currency": "USD"
|
||||
}
|
||||
}
|
||||
],
|
||||
"currency": "USD"
|
||||
}
|
||||
],
|
||||
"operationalDetail": {
|
||||
"ineligibleForMoneyBackGuarantee": false,
|
||||
"astraDescription": "Ground"
|
||||
},
|
||||
"signatureOptionType": "SERVICE_DEFAULT",
|
||||
"serviceDescription": {
|
||||
"serviceId": "EP1000000141",
|
||||
"serviceType": "FEDEX_GROUND",
|
||||
"names": [
|
||||
{
|
||||
"type": "long",
|
||||
"encoding": "utf-8",
|
||||
"value": "Fedex Ground"
|
||||
},
|
||||
{
|
||||
"type": "long",
|
||||
"encoding": "ascii",
|
||||
"value": "Fedex Ground"
|
||||
},
|
||||
{
|
||||
"type": "medium",
|
||||
"encoding": "utf-8",
|
||||
"value": "Ground"
|
||||
},
|
||||
{
|
||||
"type": "medium",
|
||||
"encoding": "ascii",
|
||||
"value": "Ground"
|
||||
},
|
||||
{
|
||||
"type": "short",
|
||||
"encoding": "utf-8",
|
||||
"value": "G"
|
||||
},
|
||||
{
|
||||
"type": "short",
|
||||
"encoding": "ascii",
|
||||
"value": "G"
|
||||
},
|
||||
{
|
||||
"type": "abbrv",
|
||||
"encoding": "ascii",
|
||||
"value": "G"
|
||||
}
|
||||
],
|
||||
"description": "FedEx Ground",
|
||||
"astraDescription": "FEDEX GROUND"
|
||||
}
|
||||
},
|
||||
{
|
||||
"serviceType": "FEDEX_EXPRESS_SAVER",
|
||||
"serviceName": "Express Saver",
|
||||
"packagingType": "YOUR_PACKAGING",
|
||||
"ratedShipmentDetails": [
|
||||
{
|
||||
"rateType": "LIST",
|
||||
"ratedWeightMethod": "ACTUAL",
|
||||
"totalDiscounts": 0,
|
||||
"totalBaseCharge": 35.42,
|
||||
"totalNetCharge": 41.61,
|
||||
"totalNetFedExCharge": 41.61,
|
||||
"shipmentRateDetail": {
|
||||
"rateZone": "5",
|
||||
"dimDivisor": 139,
|
||||
"fuelSurchargePercent": 14.25,
|
||||
"totalSurcharges": 6.19,
|
||||
"totalFreightDiscount": 0,
|
||||
"surCharges": [
|
||||
{
|
||||
"type": "DELIVERY_CONFIRMATION",
|
||||
"description": "Delivery and Returns",
|
||||
"level": "PACKAGE",
|
||||
"amount": 1
|
||||
},
|
||||
{
|
||||
"type": "FUEL",
|
||||
"description": "Fuel Surcharge",
|
||||
"level": "PACKAGE",
|
||||
"amount": 5.19
|
||||
}
|
||||
],
|
||||
"totalBillingWeight": {
|
||||
"units": "LB",
|
||||
"value": 25
|
||||
},
|
||||
"dimDivisorType": "COUNTRY",
|
||||
"currency": "USD"
|
||||
},
|
||||
"ratedPackages": [
|
||||
{
|
||||
"groupNumber": 0,
|
||||
"effectiveNetDiscount": 0,
|
||||
"packageRateDetail": {
|
||||
"rateType": "PAYOR_LIST_PACKAGE",
|
||||
"ratedWeightMethod": "ACTUAL",
|
||||
"baseCharge": 35.42,
|
||||
"netFreight": 35.42,
|
||||
"totalSurcharges": 6.19,
|
||||
"netFedExCharge": 41.61,
|
||||
"totalTaxes": 0,
|
||||
"netCharge": 41.61,
|
||||
"totalRebates": 0,
|
||||
"billingWeight": {
|
||||
"units": "LB",
|
||||
"value": 25
|
||||
},
|
||||
"totalFreightDiscounts": 0,
|
||||
"surcharges": [
|
||||
{
|
||||
"type": "DELIVERY_CONFIRMATION",
|
||||
"description": "Delivery and Returns",
|
||||
"level": "PACKAGE",
|
||||
"amount": 1
|
||||
},
|
||||
{
|
||||
"type": "FUEL",
|
||||
"description": "Fuel Surcharge",
|
||||
"level": "PACKAGE",
|
||||
"amount": 5.19
|
||||
}
|
||||
],
|
||||
"currency": "USD"
|
||||
}
|
||||
}
|
||||
],
|
||||
"currency": "USD"
|
||||
}
|
||||
],
|
||||
"operationalDetail": {
|
||||
"ineligibleForMoneyBackGuarantee": false,
|
||||
"astraDescription": "Ground"
|
||||
},
|
||||
"signatureOptionType": "SERVICE_DEFAULT",
|
||||
"serviceDescription": {
|
||||
"serviceId": "EP1000000141",
|
||||
"serviceType": "FEDEX_EXPRESS_SAVER",
|
||||
"names": [
|
||||
{
|
||||
"type": "long",
|
||||
"encoding": "utf-8",
|
||||
"value": "Express Saver"
|
||||
},
|
||||
{
|
||||
"type": "long",
|
||||
"encoding": "ascii",
|
||||
"value": "Express Saver"
|
||||
},
|
||||
{
|
||||
"type": "medium",
|
||||
"encoding": "utf-8",
|
||||
"value": "Express Saver"
|
||||
},
|
||||
{
|
||||
"type": "medium",
|
||||
"encoding": "ascii",
|
||||
"value": "Express Saver"
|
||||
},
|
||||
{
|
||||
"type": "short",
|
||||
"encoding": "utf-8",
|
||||
"value": "ES"
|
||||
},
|
||||
{
|
||||
"type": "short",
|
||||
"encoding": "ascii",
|
||||
"value": "ES"
|
||||
},
|
||||
{
|
||||
"type": "abbrv",
|
||||
"encoding": "ascii",
|
||||
"value": "ES"
|
||||
}
|
||||
],
|
||||
"description": "Express Saver",
|
||||
"astraDescription": "Express Saver"
|
||||
}
|
||||
},
|
||||
{
|
||||
"serviceType": "PRIORITY_OVERNIGHT",
|
||||
"serviceName": "Priority Overnight",
|
||||
"packagingType": "YOUR_PACKAGING",
|
||||
"ratedShipmentDetails": [
|
||||
{
|
||||
"rateType": "LIST",
|
||||
"ratedWeightMethod": "ACTUAL",
|
||||
"totalDiscounts": 0,
|
||||
"totalBaseCharge": 35.42,
|
||||
"totalNetCharge": 41.61,
|
||||
"totalNetFedExCharge": 41.61,
|
||||
"shipmentRateDetail": {
|
||||
"rateZone": "5",
|
||||
"dimDivisor": 139,
|
||||
"fuelSurchargePercent": 14.25,
|
||||
"totalSurcharges": 6.19,
|
||||
"totalFreightDiscount": 0,
|
||||
"surCharges": [
|
||||
{
|
||||
"type": "DELIVERY_CONFIRMATION",
|
||||
"description": "Delivery and Returns",
|
||||
"level": "PACKAGE",
|
||||
"amount": 1
|
||||
},
|
||||
{
|
||||
"type": "FUEL",
|
||||
"description": "Fuel Surcharge",
|
||||
"level": "PACKAGE",
|
||||
"amount": 5.19
|
||||
}
|
||||
],
|
||||
"totalBillingWeight": {
|
||||
"units": "LB",
|
||||
"value": 25
|
||||
},
|
||||
"dimDivisorType": "COUNTRY",
|
||||
"currency": "USD"
|
||||
},
|
||||
"ratedPackages": [
|
||||
{
|
||||
"groupNumber": 0,
|
||||
"effectiveNetDiscount": 0,
|
||||
"packageRateDetail": {
|
||||
"rateType": "PAYOR_LIST_PACKAGE",
|
||||
"ratedWeightMethod": "ACTUAL",
|
||||
"baseCharge": 35.42,
|
||||
"netFreight": 35.42,
|
||||
"totalSurcharges": 6.19,
|
||||
"netFedExCharge": 41.61,
|
||||
"totalTaxes": 0,
|
||||
"netCharge": 41.61,
|
||||
"totalRebates": 0,
|
||||
"billingWeight": {
|
||||
"units": "LB",
|
||||
"value": 25
|
||||
},
|
||||
"totalFreightDiscounts": 0,
|
||||
"surcharges": [
|
||||
{
|
||||
"type": "DELIVERY_CONFIRMATION",
|
||||
"description": "Delivery and Returns",
|
||||
"level": "PACKAGE",
|
||||
"amount": 1
|
||||
},
|
||||
{
|
||||
"type": "FUEL",
|
||||
"description": "Fuel Surcharge",
|
||||
"level": "PACKAGE",
|
||||
"amount": 5.19
|
||||
}
|
||||
],
|
||||
"currency": "USD"
|
||||
}
|
||||
}
|
||||
],
|
||||
"currency": "USD"
|
||||
}
|
||||
],
|
||||
"operationalDetail": {
|
||||
"ineligibleForMoneyBackGuarantee": false,
|
||||
"astraDescription": "Ground"
|
||||
},
|
||||
"signatureOptionType": "SERVICE_DEFAULT",
|
||||
"serviceDescription": {
|
||||
"serviceId": "EP1000000141",
|
||||
"serviceType": "PRIORITY_OVERNIGHT",
|
||||
"names": [
|
||||
{
|
||||
"type": "long",
|
||||
"encoding": "utf-8",
|
||||
"value": "Priority Overnight"
|
||||
},
|
||||
{
|
||||
"type": "long",
|
||||
"encoding": "ascii",
|
||||
"value": "Priority Overnight"
|
||||
},
|
||||
{
|
||||
"type": "medium",
|
||||
"encoding": "utf-8",
|
||||
"value": "Priority Overnight"
|
||||
},
|
||||
{
|
||||
"type": "medium",
|
||||
"encoding": "ascii",
|
||||
"value": "Priority Overnight"
|
||||
},
|
||||
{
|
||||
"type": "short",
|
||||
"encoding": "utf-8",
|
||||
"value": "PO"
|
||||
},
|
||||
{
|
||||
"type": "short",
|
||||
"encoding": "ascii",
|
||||
"value": "PO"
|
||||
},
|
||||
{
|
||||
"type": "abbrv",
|
||||
"encoding": "ascii",
|
||||
"value": "PO"
|
||||
}
|
||||
],
|
||||
"description": "Priority Overnight",
|
||||
"astraDescription": "Priority Overnight"
|
||||
}
|
||||
},
|
||||
{
|
||||
"serviceType": "FEDEX_2_DAY",
|
||||
"serviceName": "2 Day",
|
||||
"packagingType": "YOUR_PACKAGING",
|
||||
"ratedShipmentDetails": [
|
||||
{
|
||||
"rateType": "LIST",
|
||||
"ratedWeightMethod": "ACTUAL",
|
||||
"totalDiscounts": 0,
|
||||
"totalBaseCharge": 35.42,
|
||||
"totalNetCharge": 41.61,
|
||||
"totalNetFedExCharge": 41.61,
|
||||
"shipmentRateDetail": {
|
||||
"rateZone": "5",
|
||||
"dimDivisor": 139,
|
||||
"fuelSurchargePercent": 14.25,
|
||||
"totalSurcharges": 6.19,
|
||||
"totalFreightDiscount": 0,
|
||||
"surCharges": [
|
||||
{
|
||||
"type": "DELIVERY_CONFIRMATION",
|
||||
"description": "Delivery and Returns",
|
||||
"level": "PACKAGE",
|
||||
"amount": 1
|
||||
},
|
||||
{
|
||||
"type": "FUEL",
|
||||
"description": "Fuel Surcharge",
|
||||
"level": "PACKAGE",
|
||||
"amount": 5.19
|
||||
}
|
||||
],
|
||||
"totalBillingWeight": {
|
||||
"units": "LB",
|
||||
"value": 25
|
||||
},
|
||||
"dimDivisorType": "COUNTRY",
|
||||
"currency": "USD"
|
||||
},
|
||||
"ratedPackages": [
|
||||
{
|
||||
"groupNumber": 0,
|
||||
"effectiveNetDiscount": 0,
|
||||
"packageRateDetail": {
|
||||
"rateType": "PAYOR_LIST_PACKAGE",
|
||||
"ratedWeightMethod": "ACTUAL",
|
||||
"baseCharge": 35.42,
|
||||
"netFreight": 35.42,
|
||||
"totalSurcharges": 6.19,
|
||||
"netFedExCharge": 41.61,
|
||||
"totalTaxes": 0,
|
||||
"netCharge": 41.61,
|
||||
"totalRebates": 0,
|
||||
"billingWeight": {
|
||||
"units": "LB",
|
||||
"value": 25
|
||||
},
|
||||
"totalFreightDiscounts": 0,
|
||||
"surcharges": [
|
||||
{
|
||||
"type": "DELIVERY_CONFIRMATION",
|
||||
"description": "Delivery and Returns",
|
||||
"level": "PACKAGE",
|
||||
"amount": 1
|
||||
},
|
||||
{
|
||||
"type": "FUEL",
|
||||
"description": "Fuel Surcharge",
|
||||
"level": "PACKAGE",
|
||||
"amount": 5.19
|
||||
}
|
||||
],
|
||||
"currency": "USD"
|
||||
}
|
||||
}
|
||||
],
|
||||
"currency": "USD"
|
||||
}
|
||||
],
|
||||
"operationalDetail": {
|
||||
"ineligibleForMoneyBackGuarantee": false,
|
||||
"astraDescription": "Ground"
|
||||
},
|
||||
"signatureOptionType": "SERVICE_DEFAULT",
|
||||
"serviceDescription": {
|
||||
"serviceId": "EP1000000141",
|
||||
"serviceType": "FEDEX_2_DAY",
|
||||
"names": [
|
||||
{
|
||||
"type": "long",
|
||||
"encoding": "utf-8",
|
||||
"value": "2 Day"
|
||||
},
|
||||
{
|
||||
"type": "long",
|
||||
"encoding": "ascii",
|
||||
"value": "2 Day"
|
||||
},
|
||||
{
|
||||
"type": "medium",
|
||||
"encoding": "utf-8",
|
||||
"value": "2 Day"
|
||||
},
|
||||
{
|
||||
"type": "medium",
|
||||
"encoding": "ascii",
|
||||
"value": "2 Day"
|
||||
},
|
||||
{
|
||||
"type": "short",
|
||||
"encoding": "utf-8",
|
||||
"value": "2D"
|
||||
},
|
||||
{
|
||||
"type": "short",
|
||||
"encoding": "ascii",
|
||||
"value": "2D"
|
||||
},
|
||||
{
|
||||
"type": "abbrv",
|
||||
"encoding": "ascii",
|
||||
"value": "2D"
|
||||
}
|
||||
],
|
||||
"description": "2 Day",
|
||||
"astraDescription": "2 Day"
|
||||
}
|
||||
},
|
||||
{
|
||||
"serviceType": "FIRST_OVERNIGHT",
|
||||
"serviceName": "First Overnight",
|
||||
"packagingType": "YOUR_PACKAGING",
|
||||
"ratedShipmentDetails": [
|
||||
{
|
||||
"rateType": "LIST",
|
||||
"ratedWeightMethod": "ACTUAL",
|
||||
"totalDiscounts": 0,
|
||||
"totalBaseCharge": 35.42,
|
||||
"totalNetCharge": 41.61,
|
||||
"totalNetFedExCharge": 41.61,
|
||||
"shipmentRateDetail": {
|
||||
"rateZone": "5",
|
||||
"dimDivisor": 139,
|
||||
"fuelSurchargePercent": 14.25,
|
||||
"totalSurcharges": 6.19,
|
||||
"totalFreightDiscount": 0,
|
||||
"surCharges": [
|
||||
{
|
||||
"type": "DELIVERY_CONFIRMATION",
|
||||
"description": "Delivery and Returns",
|
||||
"level": "PACKAGE",
|
||||
"amount": 1
|
||||
},
|
||||
{
|
||||
"type": "FUEL",
|
||||
"description": "Fuel Surcharge",
|
||||
"level": "PACKAGE",
|
||||
"amount": 5.19
|
||||
}
|
||||
],
|
||||
"totalBillingWeight": {
|
||||
"units": "LB",
|
||||
"value": 25
|
||||
},
|
||||
"dimDivisorType": "COUNTRY",
|
||||
"currency": "USD"
|
||||
},
|
||||
"ratedPackages": [
|
||||
{
|
||||
"groupNumber": 0,
|
||||
"effectiveNetDiscount": 0,
|
||||
"packageRateDetail": {
|
||||
"rateType": "PAYOR_LIST_PACKAGE",
|
||||
"ratedWeightMethod": "ACTUAL",
|
||||
"baseCharge": 35.42,
|
||||
"netFreight": 35.42,
|
||||
"totalSurcharges": 6.19,
|
||||
"netFedExCharge": 41.61,
|
||||
"totalTaxes": 0,
|
||||
"netCharge": 41.61,
|
||||
"totalRebates": 0,
|
||||
"billingWeight": {
|
||||
"units": "LB",
|
||||
"value": 25
|
||||
},
|
||||
"totalFreightDiscounts": 0,
|
||||
"surcharges": [
|
||||
{
|
||||
"type": "DELIVERY_CONFIRMATION",
|
||||
"description": "Delivery and Returns",
|
||||
"level": "PACKAGE",
|
||||
"amount": 1
|
||||
},
|
||||
{
|
||||
"type": "FUEL",
|
||||
"description": "Fuel Surcharge",
|
||||
"level": "PACKAGE",
|
||||
"amount": 5.19
|
||||
}
|
||||
],
|
||||
"currency": "USD"
|
||||
}
|
||||
}
|
||||
],
|
||||
"currency": "USD"
|
||||
}
|
||||
],
|
||||
"operationalDetail": {
|
||||
"ineligibleForMoneyBackGuarantee": false,
|
||||
"astraDescription": "Ground"
|
||||
},
|
||||
"signatureOptionType": "SERVICE_DEFAULT",
|
||||
"serviceDescription": {
|
||||
"serviceId": "EP1000000141",
|
||||
"serviceType": "FIRST_OVERNIGHT",
|
||||
"names": [
|
||||
{
|
||||
"type": "long",
|
||||
"encoding": "utf-8",
|
||||
"value": "First Overnight"
|
||||
},
|
||||
{
|
||||
"type": "long",
|
||||
"encoding": "ascii",
|
||||
"value": "First Overnight"
|
||||
},
|
||||
{
|
||||
"type": "medium",
|
||||
"encoding": "utf-8",
|
||||
"value": "First Overnight"
|
||||
},
|
||||
{
|
||||
"type": "medium",
|
||||
"encoding": "ascii",
|
||||
"value": "First Overnight"
|
||||
},
|
||||
{
|
||||
"type": "short",
|
||||
"encoding": "utf-8",
|
||||
"value": "FO"
|
||||
},
|
||||
{
|
||||
"type": "short",
|
||||
"encoding": "ascii",
|
||||
"value": "FO"
|
||||
},
|
||||
{
|
||||
"type": "abbrv",
|
||||
"encoding": "ascii",
|
||||
"value": "FO"
|
||||
}
|
||||
],
|
||||
"description": "First Overnight",
|
||||
"astraDescription": "First Overnight"
|
||||
}
|
||||
}
|
||||
],
|
||||
"quoteDate": "2023-08-14",
|
||||
"encoded": false
|
||||
}
|
||||
}
|
||||
+145
@@ -0,0 +1,145 @@
|
||||
{
|
||||
"transactionId": "TEST-RESPONSE-SMART-POST-CA-0de9-4f74-89ab-d23e63d743bf",
|
||||
"customerTransactionId": "customer test",
|
||||
"output": {
|
||||
"alerts": [
|
||||
{
|
||||
"code": "VIRTUAL.RESPONSE",
|
||||
"message": "This is a Virtual Response.",
|
||||
"alertType": "NOTE"
|
||||
}
|
||||
],
|
||||
"rateReplyDetails": [
|
||||
{
|
||||
"serviceType": "SMART_POST",
|
||||
"serviceName": "FedEx SmartPost®",
|
||||
"packagingType": "YOUR_PACKAGING",
|
||||
"ratedShipmentDetails": [
|
||||
{
|
||||
"rateType": "LIST",
|
||||
"ratedWeightMethod": "ACTUAL",
|
||||
"totalDiscounts": 0.0,
|
||||
"totalBaseCharge": 35.42,
|
||||
"totalNetCharge": 41.61,
|
||||
"totalNetFedExCharge": 41.61,
|
||||
"shipmentRateDetail": {
|
||||
"rateZone": "5",
|
||||
"dimDivisor": 139,
|
||||
"fuelSurchargePercent": 14.25,
|
||||
"totalSurcharges": 6.19,
|
||||
"totalFreightDiscount": 0.0,
|
||||
"surCharges": [
|
||||
{
|
||||
"type": "DELIVERY_CONFIRMATION",
|
||||
"description": "Delivery and Returns",
|
||||
"level": "PACKAGE",
|
||||
"amount": 1.0
|
||||
},
|
||||
{
|
||||
"type": "FUEL",
|
||||
"description": "Fuel Surcharge",
|
||||
"level": "PACKAGE",
|
||||
"amount": 5.19
|
||||
}
|
||||
],
|
||||
"totalBillingWeight": {
|
||||
"units": "LB",
|
||||
"value": 25.0
|
||||
},
|
||||
"dimDivisorType": "COUNTRY",
|
||||
"currency": "USD"
|
||||
},
|
||||
"ratedPackages": [
|
||||
{
|
||||
"groupNumber": 0,
|
||||
"effectiveNetDiscount": 0.0,
|
||||
"packageRateDetail": {
|
||||
"rateType": "PAYOR_LIST_PACKAGE",
|
||||
"ratedWeightMethod": "ACTUAL",
|
||||
"baseCharge": 35.42,
|
||||
"netFreight": 35.42,
|
||||
"totalSurcharges": 6.19,
|
||||
"netFedExCharge": 41.61,
|
||||
"totalTaxes": 0.0,
|
||||
"netCharge": 41.61,
|
||||
"totalRebates": 0.0,
|
||||
"billingWeight": {
|
||||
"units": "LB",
|
||||
"value": 25.0
|
||||
},
|
||||
"totalFreightDiscounts": 0.0,
|
||||
"surcharges": [
|
||||
{
|
||||
"type": "DELIVERY_CONFIRMATION",
|
||||
"description": "Delivery and Returns",
|
||||
"level": "PACKAGE",
|
||||
"amount": 1.0
|
||||
},
|
||||
{
|
||||
"type": "FUEL",
|
||||
"description": "Fuel Surcharge",
|
||||
"level": "PACKAGE",
|
||||
"amount": 5.19
|
||||
}
|
||||
],
|
||||
"currency": "USD"
|
||||
}
|
||||
}
|
||||
],
|
||||
"currency": "USD"
|
||||
}
|
||||
],
|
||||
"operationalDetail": {
|
||||
"ineligibleForMoneyBackGuarantee": false,
|
||||
"astraDescription": "SMART POST"
|
||||
},
|
||||
"signatureOptionType": "SERVICE_DEFAULT",
|
||||
"serviceDescription": {
|
||||
"serviceId": "EP1000000141",
|
||||
"serviceType": "SMART_POST",
|
||||
"names": [
|
||||
{
|
||||
"type": "long",
|
||||
"encoding": "utf-8",
|
||||
"value": "FedEx SmartPost®"
|
||||
},
|
||||
{
|
||||
"type": "long",
|
||||
"encoding": "ascii",
|
||||
"value": "FedEx SmartPost"
|
||||
},
|
||||
{
|
||||
"type": "medium",
|
||||
"encoding": "utf-8",
|
||||
"value": "SmartPost®"
|
||||
},
|
||||
{
|
||||
"type": "medium",
|
||||
"encoding": "ascii",
|
||||
"value": "SmartPost"
|
||||
},
|
||||
{
|
||||
"type": "short",
|
||||
"encoding": "utf-8",
|
||||
"value": "SP"
|
||||
},
|
||||
{
|
||||
"type": "short",
|
||||
"encoding": "ascii",
|
||||
"value": "SP"
|
||||
},
|
||||
{
|
||||
"type": "abbrv",
|
||||
"encoding": "ascii",
|
||||
"value": "SP"
|
||||
}
|
||||
],
|
||||
"description": "Smart Post",
|
||||
"astraDescription": "SMART POST"
|
||||
}
|
||||
}
|
||||
],
|
||||
"quoteDate": "2023-08-14",
|
||||
"encoded": false
|
||||
}
|
||||
}
|
||||
+145
@@ -0,0 +1,145 @@
|
||||
{
|
||||
"transactionId": "TEST-RESPONSE-SMART-POST-US-0de9-4f74-89ab-d23e63d743bf",
|
||||
"customerTransactionId": "customer test",
|
||||
"output": {
|
||||
"alerts": [
|
||||
{
|
||||
"code": "VIRTUAL.RESPONSE",
|
||||
"message": "This is a Virtual Response.",
|
||||
"alertType": "NOTE"
|
||||
}
|
||||
],
|
||||
"rateReplyDetails": [
|
||||
{
|
||||
"serviceType": "SMART_POST",
|
||||
"serviceName": "FedEx SmartPost®",
|
||||
"packagingType": "YOUR_PACKAGING",
|
||||
"ratedShipmentDetails": [
|
||||
{
|
||||
"rateType": "LIST",
|
||||
"ratedWeightMethod": "ACTUAL",
|
||||
"totalDiscounts": 0.0,
|
||||
"totalBaseCharge": 35.42,
|
||||
"totalNetCharge": 41.61,
|
||||
"totalNetFedExCharge": 41.61,
|
||||
"shipmentRateDetail": {
|
||||
"rateZone": "5",
|
||||
"dimDivisor": 139,
|
||||
"fuelSurchargePercent": 14.25,
|
||||
"totalSurcharges": 6.19,
|
||||
"totalFreightDiscount": 0.0,
|
||||
"surCharges": [
|
||||
{
|
||||
"type": "DELIVERY_CONFIRMATION",
|
||||
"description": "Delivery and Returns",
|
||||
"level": "PACKAGE",
|
||||
"amount": 1.0
|
||||
},
|
||||
{
|
||||
"type": "FUEL",
|
||||
"description": "Fuel Surcharge",
|
||||
"level": "PACKAGE",
|
||||
"amount": 5.19
|
||||
}
|
||||
],
|
||||
"totalBillingWeight": {
|
||||
"units": "LB",
|
||||
"value": 25.0
|
||||
},
|
||||
"dimDivisorType": "COUNTRY",
|
||||
"currency": "USD"
|
||||
},
|
||||
"ratedPackages": [
|
||||
{
|
||||
"groupNumber": 0,
|
||||
"effectiveNetDiscount": 0.0,
|
||||
"packageRateDetail": {
|
||||
"rateType": "PAYOR_LIST_PACKAGE",
|
||||
"ratedWeightMethod": "ACTUAL",
|
||||
"baseCharge": 35.42,
|
||||
"netFreight": 35.42,
|
||||
"totalSurcharges": 6.19,
|
||||
"netFedExCharge": 41.61,
|
||||
"totalTaxes": 0.0,
|
||||
"netCharge": 41.61,
|
||||
"totalRebates": 0.0,
|
||||
"billingWeight": {
|
||||
"units": "LB",
|
||||
"value": 25.0
|
||||
},
|
||||
"totalFreightDiscounts": 0.0,
|
||||
"surcharges": [
|
||||
{
|
||||
"type": "DELIVERY_CONFIRMATION",
|
||||
"description": "Delivery and Returns",
|
||||
"level": "PACKAGE",
|
||||
"amount": 1.0
|
||||
},
|
||||
{
|
||||
"type": "FUEL",
|
||||
"description": "Fuel Surcharge",
|
||||
"level": "PACKAGE",
|
||||
"amount": 5.19
|
||||
}
|
||||
],
|
||||
"currency": "USD"
|
||||
}
|
||||
}
|
||||
],
|
||||
"currency": "USD"
|
||||
}
|
||||
],
|
||||
"operationalDetail": {
|
||||
"ineligibleForMoneyBackGuarantee": false,
|
||||
"astraDescription": "SMART POST"
|
||||
},
|
||||
"signatureOptionType": "SERVICE_DEFAULT",
|
||||
"serviceDescription": {
|
||||
"serviceId": "EP1000000141",
|
||||
"serviceType": "SMART_POST",
|
||||
"names": [
|
||||
{
|
||||
"type": "long",
|
||||
"encoding": "utf-8",
|
||||
"value": "FedEx SmartPost®"
|
||||
},
|
||||
{
|
||||
"type": "long",
|
||||
"encoding": "ascii",
|
||||
"value": "FedEx SmartPost"
|
||||
},
|
||||
{
|
||||
"type": "medium",
|
||||
"encoding": "utf-8",
|
||||
"value": "SmartPost®"
|
||||
},
|
||||
{
|
||||
"type": "medium",
|
||||
"encoding": "ascii",
|
||||
"value": "SmartPost"
|
||||
},
|
||||
{
|
||||
"type": "short",
|
||||
"encoding": "utf-8",
|
||||
"value": "SP"
|
||||
},
|
||||
{
|
||||
"type": "short",
|
||||
"encoding": "ascii",
|
||||
"value": "SP"
|
||||
},
|
||||
{
|
||||
"type": "abbrv",
|
||||
"encoding": "ascii",
|
||||
"value": "SP"
|
||||
}
|
||||
],
|
||||
"description": "Smart Post",
|
||||
"astraDescription": "SMART POST"
|
||||
}
|
||||
}
|
||||
],
|
||||
"quoteDate": "2023-08-14",
|
||||
"encoded": false
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
|
||||
<type name="Magento\Fedex\Model\Carrier">
|
||||
<arguments>
|
||||
<argument name="curlFactory" xsi:type="object">Magento\TestModuleFedex\Model\MockCurlFactory</argument>
|
||||
</arguments>
|
||||
</type>
|
||||
</config>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
|
||||
<module name="Magento_TestModuleFedex" />
|
||||
</config>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use Magento\Framework\Component\ComponentRegistrar;
|
||||
|
||||
$registrar = new ComponentRegistrar();
|
||||
if ($registrar->getPath(ComponentRegistrar::MODULE, 'Magento_TestModuleFedex') === null) {
|
||||
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_TestModuleFedex', __DIR__);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user