ltsecurityinc安防产品在线商城代码

This commit is contained in:
2026-09-14 17:47:10 +08:00
parent 57d8444c15
commit 6a3c9c5bd8
14539 changed files with 1775310 additions and 0 deletions
@@ -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;
}
}
@@ -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;
}
}
@@ -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;
}
}
@@ -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;
}
}
@@ -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');
}
}
@@ -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());
}
}
@@ -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);
}
}
@@ -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);
}
}
@@ -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());
}
}
@@ -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
);
}
@@ -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);
}
}
@@ -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);
}
}
@@ -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);
}
}
@@ -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);
}
@@ -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;
}
}
@@ -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
);
}
@@ -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);
}
}
@@ -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');
}
}
@@ -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);
}
@@ -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__);
}
@@ -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);
}
@@ -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);
}
@@ -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;
}
}
@@ -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;
}
}
@@ -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);
}
}
@@ -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;
}
}
@@ -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;
}
}
@@ -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;
}
}
@@ -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>
@@ -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>
@@ -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,79 @@
<?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 RESPONSE_FILE_PATTERN = '%s/_files/mock_response_%s_%s.json';
private const PATH_COUNTRY = 'RequestedShipment/Recipient/Address/CountryCode';
private const PATH_SERVICE_TYPE = 'RequestedShipment/ServiceType';
/**
* @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 response xml for a given request
*
* @param array $request
* @return string
* @throws NotFoundException
*/
public function loadForRequest(array $request): string
{
$moduleDir = $this->moduleDirectory->getDir('Magento_TestModuleFedex');
$type = strtolower($this->arrayManager->get(static::PATH_SERVICE_TYPE, $request) ?? 'general');
$country = strtolower($this->arrayManager->get(static::PATH_COUNTRY, $request) ?? '');
$responsePath = sprintf(static::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);
}
}
@@ -0,0 +1,47 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\TestModuleFedex\Model;
/**
* Mock Fedex soap client factory
*/
class MockSoapClient extends \SoapClient
{
/**
* @var MockResponseBodyLoader
*/
private $mockResponseBodyLoader;
/**
* @param string $wsdl
* @param MockResponseBodyLoader $mockResponseBodyLoader
* @param array|null $options
*/
public function __construct(
string $wsdl,
MockResponseBodyLoader $mockResponseBodyLoader,
array $options = null
) {
parent::__construct($wsdl, $options);
$this->mockResponseBodyLoader = $mockResponseBodyLoader;
}
/**
* Fetch mock Fedex rates
*
* @param array $rateRequest
* @return \stdClass
* @throws \Magento\Framework\Exception\NotFoundException
*/
public function getRates(array $rateRequest): \stdClass
{
$response = $this->mockResponseBodyLoader->loadForRequest($rateRequest);
return json_decode($response);
}
}
@@ -0,0 +1,34 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\TestModuleFedex\Model;
use Magento\Framework\App\ObjectManager;
/**
* Mock Fedex soap client factory
*/
class MockSoapClientFactory extends \Magento\Framework\Webapi\Soap\ClientFactory
{
/**
* Create instance of the mock SoapClient
*
* @param string $wsdl
* @param array $options
* @return \SoapClient
*/
public function create($wsdl, array $options = []): \SoapClient
{
return ObjectManager::getInstance()->create(
MockSoapClient::class,
[
'wsdl' => $wsdl,
'options' => $options,
]
);
}
}
@@ -0,0 +1,912 @@
{
"HighestSeverity": "NOTE",
"Notifications": [
{
"Severity": "NOTE",
"Source": "crs",
"Code": "886",
"Message": "Money Back Guarantee is not eligible for this pick up\/delivery postal\/zip code. FDXG",
"LocalizedMessage": "Money Back Guarantee is not eligible for this pick up\/delivery postal\/zip code. FDXG",
"MessageParameters": {
"Id": "OPERATING_COMPANY",
"Value": "FDXG"
}
},
{
"Severity": "NOTE",
"Source": "crs",
"Code": "819",
"Message": "The origin state\/province code has been changed. ",
"LocalizedMessage": "The origin state\/province code has been changed. "
},
{
"Severity": "NOTE",
"Source": "crs",
"Code": "820",
"Message": "The destination state\/province code has been changed. ",
"LocalizedMessage": "The destination state\/province code has been changed. "
}
],
"Version": {
"ServiceId": "crs",
"Major": 10,
"Intermediate": 0,
"Minor": 0
},
"RateReplyDetails": [
{
"ServiceType": "INTERNATIONAL_PRIORITY",
"PackagingType": "YOUR_PACKAGING",
"DestinationAirportId": "YYZ",
"IneligibleForMoneyBackGuarantee": false,
"OriginServiceArea": "A1",
"DestinationServiceArea": "AM",
"SignatureOption": "SERVICE_DEFAULT",
"ActualRateType": "PAYOR_ACCOUNT_SHIPMENT",
"RatedShipmentDetails": [
{
"EffectiveNetDiscount": {
"Currency": "USD",
"Amount": "0.0"
},
"ShipmentRateDetail": {
"RateType": "PAYOR_ACCOUNT_SHIPMENT",
"RateScale": "0000000",
"RateZone": "US001O",
"PricingCode": "ACTUAL",
"RatedWeightMethod": "ACTUAL",
"CurrencyExchangeRate": {
"FromCurrency": "USD",
"IntoCurrency": "USD",
"Rate": "1.0"
},
"DimDivisor": 0,
"FuelSurchargePercent": "5.0",
"TotalBillingWeight": {
"Units": "LB",
"Value": "2.0"
},
"TotalBaseCharge": {
"Currency": "USD",
"Amount": "92.99"
},
"TotalFreightDiscounts": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetFreight": {
"Currency": "USD",
"Amount": "92.99"
},
"TotalSurcharges": {
"Currency": "USD",
"Amount": "4.65"
},
"TotalNetFedExCharge": {
"Currency": "USD",
"Amount": "97.64"
},
"TotalTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetCharge": {
"Currency": "USD",
"Amount": "97.64"
},
"TotalRebates": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalDutiesAndTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetChargeWithDutiesAndTaxes": {
"Currency": "USD",
"Amount": "97.64"
},
"Surcharges": {
"SurchargeType": "FUEL",
"Description": "Fuel",
"Amount": {
"Currency": "USD",
"Amount": "4.65"
}
}
}
},
{
"EffectiveNetDiscount": {
"Currency": "USD",
"Amount": "0.0"
},
"ShipmentRateDetail": {
"RateType": "RATED_ACCOUNT_SHIPMENT",
"RateScale": "0000000",
"RateZone": "US001O",
"PricingCode": "ACTUAL",
"RatedWeightMethod": "ACTUAL",
"CurrencyExchangeRate": {
"FromCurrency": "USD",
"IntoCurrency": "USD",
"Rate": "1.0"
},
"DimDivisor": 0,
"FuelSurchargePercent": "5.0",
"TotalBillingWeight": {
"Units": "LB",
"Value": "2.0"
},
"TotalBaseCharge": {
"Currency": "USD",
"Amount": "92.99"
},
"TotalFreightDiscounts": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetFreight": {
"Currency": "USD",
"Amount": "92.99"
},
"TotalSurcharges": {
"Currency": "USD",
"Amount": "4.65"
},
"TotalNetFedExCharge": {
"Currency": "USD",
"Amount": "97.64"
},
"TotalTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetCharge": {
"Currency": "USD",
"Amount": "97.64"
},
"TotalRebates": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalDutiesAndTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetChargeWithDutiesAndTaxes": {
"Currency": "USD",
"Amount": "97.64"
},
"Surcharges": {
"SurchargeType": "FUEL",
"Description": "Fuel",
"Amount": {
"Currency": "USD",
"Amount": "4.65"
}
}
}
},
{
"ShipmentRateDetail": {
"RateType": "PAYOR_LIST_SHIPMENT",
"RateScale": "0000000",
"RateZone": "US001O",
"PricingCode": "ACTUAL",
"RatedWeightMethod": "ACTUAL",
"CurrencyExchangeRate": {
"FromCurrency": "USD",
"IntoCurrency": "USD",
"Rate": "1.0"
},
"DimDivisor": 0,
"FuelSurchargePercent": "5.0",
"TotalBillingWeight": {
"Units": "LB",
"Value": "2.0"
},
"TotalBaseCharge": {
"Currency": "USD",
"Amount": "92.99"
},
"TotalFreightDiscounts": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetFreight": {
"Currency": "USD",
"Amount": "92.99"
},
"TotalSurcharges": {
"Currency": "USD",
"Amount": "4.65"
},
"TotalNetFedExCharge": {
"Currency": "USD",
"Amount": "97.64"
},
"TotalTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetCharge": {
"Currency": "USD",
"Amount": "97.64"
},
"TotalRebates": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalDutiesAndTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetChargeWithDutiesAndTaxes": {
"Currency": "USD",
"Amount": "97.64"
},
"Surcharges": {
"SurchargeType": "FUEL",
"Description": "Fuel",
"Amount": {
"Currency": "USD",
"Amount": "4.65"
}
}
}
},
{
"ShipmentRateDetail": {
"RateType": "RATED_LIST_SHIPMENT",
"RateScale": "0000000",
"RateZone": "US001O",
"PricingCode": "ACTUAL",
"RatedWeightMethod": "ACTUAL",
"CurrencyExchangeRate": {
"FromCurrency": "USD",
"IntoCurrency": "USD",
"Rate": "1.0"
},
"DimDivisor": 0,
"FuelSurchargePercent": "5.0",
"TotalBillingWeight": {
"Units": "LB",
"Value": "2.0"
},
"TotalBaseCharge": {
"Currency": "USD",
"Amount": "92.99"
},
"TotalFreightDiscounts": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetFreight": {
"Currency": "USD",
"Amount": "92.99"
},
"TotalSurcharges": {
"Currency": "USD",
"Amount": "4.65"
},
"TotalNetFedExCharge": {
"Currency": "USD",
"Amount": "97.64"
},
"TotalTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetCharge": {
"Currency": "USD",
"Amount": "97.64"
},
"TotalRebates": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalDutiesAndTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetChargeWithDutiesAndTaxes": {
"Currency": "USD",
"Amount": "97.64"
},
"Surcharges": {
"SurchargeType": "FUEL",
"Description": "Fuel",
"Amount": {
"Currency": "USD",
"Amount": "4.65"
}
}
}
}
]
},
{
"ServiceType": "INTERNATIONAL_ECONOMY",
"PackagingType": "YOUR_PACKAGING",
"DestinationAirportId": "YYZ",
"IneligibleForMoneyBackGuarantee": false,
"OriginServiceArea": "A1",
"DestinationServiceArea": "AM",
"SignatureOption": "SERVICE_DEFAULT",
"ActualRateType": "PAYOR_ACCOUNT_SHIPMENT",
"RatedShipmentDetails": [
{
"EffectiveNetDiscount": {
"Currency": "USD",
"Amount": "0.0"
},
"ShipmentRateDetail": {
"RateType": "PAYOR_ACCOUNT_SHIPMENT",
"RateScale": "0000000",
"RateZone": "US001O",
"PricingCode": "ACTUAL",
"RatedWeightMethod": "ACTUAL",
"CurrencyExchangeRate": {
"FromCurrency": "USD",
"IntoCurrency": "USD",
"Rate": "1.0"
},
"DimDivisor": 0,
"FuelSurchargePercent": "5.0",
"TotalBillingWeight": {
"Units": "LB",
"Value": "2.0"
},
"TotalBaseCharge": {
"Currency": "USD",
"Amount": "83.18"
},
"TotalFreightDiscounts": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetFreight": {
"Currency": "USD",
"Amount": "83.18"
},
"TotalSurcharges": {
"Currency": "USD",
"Amount": "4.16"
},
"TotalNetFedExCharge": {
"Currency": "USD",
"Amount": "87.34"
},
"TotalTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetCharge": {
"Currency": "USD",
"Amount": "87.34"
},
"TotalRebates": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalDutiesAndTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetChargeWithDutiesAndTaxes": {
"Currency": "USD",
"Amount": "87.34"
},
"Surcharges": {
"SurchargeType": "FUEL",
"Description": "Fuel",
"Amount": {
"Currency": "USD",
"Amount": "4.16"
}
}
}
},
{
"EffectiveNetDiscount": {
"Currency": "USD",
"Amount": "0.0"
},
"ShipmentRateDetail": {
"RateType": "RATED_ACCOUNT_SHIPMENT",
"RateScale": "0000000",
"RateZone": "US001O",
"PricingCode": "ACTUAL",
"RatedWeightMethod": "ACTUAL",
"CurrencyExchangeRate": {
"FromCurrency": "USD",
"IntoCurrency": "USD",
"Rate": "1.0"
},
"DimDivisor": 0,
"FuelSurchargePercent": "5.0",
"TotalBillingWeight": {
"Units": "LB",
"Value": "2.0"
},
"TotalBaseCharge": {
"Currency": "USD",
"Amount": "83.18"
},
"TotalFreightDiscounts": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetFreight": {
"Currency": "USD",
"Amount": "83.18"
},
"TotalSurcharges": {
"Currency": "USD",
"Amount": "4.16"
},
"TotalNetFedExCharge": {
"Currency": "USD",
"Amount": "87.34"
},
"TotalTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetCharge": {
"Currency": "USD",
"Amount": "87.34"
},
"TotalRebates": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalDutiesAndTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetChargeWithDutiesAndTaxes": {
"Currency": "USD",
"Amount": "87.34"
},
"Surcharges": {
"SurchargeType": "FUEL",
"Description": "Fuel",
"Amount": {
"Currency": "USD",
"Amount": "4.16"
}
}
}
},
{
"ShipmentRateDetail": {
"RateType": "PAYOR_LIST_SHIPMENT",
"RateScale": "0000000",
"RateZone": "US001O",
"PricingCode": "ACTUAL",
"RatedWeightMethod": "ACTUAL",
"CurrencyExchangeRate": {
"FromCurrency": "USD",
"IntoCurrency": "USD",
"Rate": "1.0"
},
"DimDivisor": 0,
"FuelSurchargePercent": "5.0",
"TotalBillingWeight": {
"Units": "LB",
"Value": "2.0"
},
"TotalBaseCharge": {
"Currency": "USD",
"Amount": "83.18"
},
"TotalFreightDiscounts": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetFreight": {
"Currency": "USD",
"Amount": "83.18"
},
"TotalSurcharges": {
"Currency": "USD",
"Amount": "4.16"
},
"TotalNetFedExCharge": {
"Currency": "USD",
"Amount": "87.34"
},
"TotalTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetCharge": {
"Currency": "USD",
"Amount": "87.34"
},
"TotalRebates": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalDutiesAndTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetChargeWithDutiesAndTaxes": {
"Currency": "USD",
"Amount": "87.34"
},
"Surcharges": {
"SurchargeType": "FUEL",
"Description": "Fuel",
"Amount": {
"Currency": "USD",
"Amount": "4.16"
}
}
}
},
{
"ShipmentRateDetail": {
"RateType": "RATED_LIST_SHIPMENT",
"RateScale": "0000000",
"RateZone": "US001O",
"PricingCode": "ACTUAL",
"RatedWeightMethod": "ACTUAL",
"CurrencyExchangeRate": {
"FromCurrency": "USD",
"IntoCurrency": "USD",
"Rate": "1.0"
},
"DimDivisor": 0,
"FuelSurchargePercent": "5.0",
"TotalBillingWeight": {
"Units": "LB",
"Value": "2.0"
},
"TotalBaseCharge": {
"Currency": "USD",
"Amount": "83.18"
},
"TotalFreightDiscounts": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetFreight": {
"Currency": "USD",
"Amount": "83.18"
},
"TotalSurcharges": {
"Currency": "USD",
"Amount": "4.16"
},
"TotalNetFedExCharge": {
"Currency": "USD",
"Amount": "87.34"
},
"TotalTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetCharge": {
"Currency": "USD",
"Amount": "87.34"
},
"TotalRebates": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalDutiesAndTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetChargeWithDutiesAndTaxes": {
"Currency": "USD",
"Amount": "87.34"
},
"Surcharges": {
"SurchargeType": "FUEL",
"Description": "Fuel",
"Amount": {
"Currency": "USD",
"Amount": "4.16"
}
}
}
}
]
},
{
"ServiceType": "FEDEX_GROUND",
"PackagingType": "YOUR_PACKAGING",
"DestinationAirportId": "YYZ",
"IneligibleForMoneyBackGuarantee": true,
"SignatureOption": "SERVICE_DEFAULT",
"ActualRateType": "PAYOR_ACCOUNT_PACKAGE",
"RatedShipmentDetails": [
{
"EffectiveNetDiscount": {
"Currency": "USD",
"Amount": "0.0"
},
"ShipmentRateDetail": {
"RateType": "PAYOR_ACCOUNT_PACKAGE",
"RateZone": "51",
"RatedWeightMethod": "ACTUAL",
"DimDivisor": 0,
"FuelSurchargePercent": "7.0",
"TotalBillingWeight": {
"Units": "LB",
"Value": "2.0"
},
"TotalBaseCharge": {
"Currency": "USD",
"Amount": "22.73"
},
"TotalFreightDiscounts": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetFreight": {
"Currency": "USD",
"Amount": "22.73"
},
"TotalSurcharges": {
"Currency": "USD",
"Amount": "1.59"
},
"TotalNetFedExCharge": {
"Currency": "USD",
"Amount": "24.32"
},
"TotalTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetCharge": {
"Currency": "USD",
"Amount": "24.32"
},
"TotalRebates": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalDutiesAndTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetChargeWithDutiesAndTaxes": {
"Currency": "USD",
"Amount": "24.32"
},
"Surcharges": [
{
"SurchargeType": "INSURED_VALUE",
"Level": "PACKAGE",
"Description": "Insured value",
"Amount": {
"Currency": "USD",
"Amount": "0.0"
}
},
{
"SurchargeType": "FUEL",
"Level": "PACKAGE",
"Description": "FedEx Ground Fuel",
"Amount": {
"Currency": "USD",
"Amount": "1.59"
}
}
]
},
"RatedPackages": {
"GroupNumber": 0,
"EffectiveNetDiscount": {
"Currency": "USD",
"Amount": "0.0"
},
"PackageRateDetail": {
"RateType": "PAYOR_ACCOUNT_PACKAGE",
"RatedWeightMethod": "ACTUAL",
"BillingWeight": {
"Units": "LB",
"Value": "2.0"
},
"BaseCharge": {
"Currency": "USD",
"Amount": "22.73"
},
"TotalFreightDiscounts": {
"Currency": "USD",
"Amount": "0.0"
},
"NetFreight": {
"Currency": "USD",
"Amount": "22.73"
},
"TotalSurcharges": {
"Currency": "USD",
"Amount": "1.59"
},
"NetFedExCharge": {
"Currency": "USD",
"Amount": "24.32"
},
"TotalTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"NetCharge": {
"Currency": "USD",
"Amount": "24.32"
},
"TotalRebates": {
"Currency": "USD",
"Amount": "0.0"
},
"Surcharges": [
{
"SurchargeType": "INSURED_VALUE",
"Level": "PACKAGE",
"Description": "Insured value",
"Amount": {
"Currency": "USD",
"Amount": "0.0"
}
},
{
"SurchargeType": "FUEL",
"Level": "PACKAGE",
"Description": "FedEx Ground Fuel",
"Amount": {
"Currency": "USD",
"Amount": "1.59"
}
}
]
}
}
},
{
"ShipmentRateDetail": {
"RateType": "PAYOR_LIST_PACKAGE",
"RateZone": "51",
"RatedWeightMethod": "ACTUAL",
"DimDivisor": 0,
"FuelSurchargePercent": "7.0",
"TotalBillingWeight": {
"Units": "LB",
"Value": "2.0"
},
"TotalBaseCharge": {
"Currency": "USD",
"Amount": "22.73"
},
"TotalFreightDiscounts": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetFreight": {
"Currency": "USD",
"Amount": "22.73"
},
"TotalSurcharges": {
"Currency": "USD",
"Amount": "1.59"
},
"TotalNetFedExCharge": {
"Currency": "USD",
"Amount": "24.32"
},
"TotalTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetCharge": {
"Currency": "USD",
"Amount": "24.32"
},
"TotalRebates": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalDutiesAndTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetChargeWithDutiesAndTaxes": {
"Currency": "USD",
"Amount": "24.32"
},
"Surcharges": [
{
"SurchargeType": "INSURED_VALUE",
"Level": "PACKAGE",
"Description": "Insured value",
"Amount": {
"Currency": "USD",
"Amount": "0.0"
}
},
{
"SurchargeType": "FUEL",
"Level": "PACKAGE",
"Description": "FedEx Ground Fuel",
"Amount": {
"Currency": "USD",
"Amount": "1.59"
}
}
]
},
"RatedPackages": {
"GroupNumber": 0,
"PackageRateDetail": {
"RateType": "PAYOR_LIST_PACKAGE",
"RatedWeightMethod": "ACTUAL",
"BillingWeight": {
"Units": "LB",
"Value": "2.0"
},
"BaseCharge": {
"Currency": "USD",
"Amount": "22.73"
},
"TotalFreightDiscounts": {
"Currency": "USD",
"Amount": "0.0"
},
"NetFreight": {
"Currency": "USD",
"Amount": "22.73"
},
"TotalSurcharges": {
"Currency": "USD",
"Amount": "1.59"
},
"NetFedExCharge": {
"Currency": "USD",
"Amount": "24.32"
},
"TotalTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"NetCharge": {
"Currency": "USD",
"Amount": "24.32"
},
"TotalRebates": {
"Currency": "USD",
"Amount": "0.0"
},
"Surcharges": [
{
"SurchargeType": "INSURED_VALUE",
"Level": "PACKAGE",
"Description": "Insured value",
"Amount": {
"Currency": "USD",
"Amount": "0.0"
}
},
{
"SurchargeType": "FUEL",
"Level": "PACKAGE",
"Description": "FedEx Ground Fuel",
"Amount": {
"Currency": "USD",
"Amount": "1.59"
}
}
]
}
}
}
]
}
]
}
@@ -0,0 +1,912 @@
{
"HighestSeverity": "NOTE",
"Notifications": [
{
"Severity": "NOTE",
"Source": "crs",
"Code": "886",
"Message": "Money Back Guarantee is not eligible for this pick up\/delivery postal\/zip code. FDXG",
"LocalizedMessage": "Money Back Guarantee is not eligible for this pick up\/delivery postal\/zip code. FDXG",
"MessageParameters": {
"Id": "OPERATING_COMPANY",
"Value": "FDXG"
}
},
{
"Severity": "NOTE",
"Source": "crs",
"Code": "819",
"Message": "The origin state\/province code has been changed. ",
"LocalizedMessage": "The origin state\/province code has been changed. "
},
{
"Severity": "NOTE",
"Source": "crs",
"Code": "820",
"Message": "The destination state\/province code has been changed. ",
"LocalizedMessage": "The destination state\/province code has been changed. "
}
],
"Version": {
"ServiceId": "crs",
"Major": 10,
"Intermediate": 0,
"Minor": 0
},
"RateReplyDetails": [
{
"ServiceType": "INTERNATIONAL_PRIORITY",
"PackagingType": "YOUR_PACKAGING",
"DestinationAirportId": "YYZ",
"IneligibleForMoneyBackGuarantee": false,
"OriginServiceArea": "A1",
"DestinationServiceArea": "AM",
"SignatureOption": "SERVICE_DEFAULT",
"ActualRateType": "PAYOR_ACCOUNT_SHIPMENT",
"RatedShipmentDetails": [
{
"EffectiveNetDiscount": {
"Currency": "USD",
"Amount": "0.0"
},
"ShipmentRateDetail": {
"RateType": "PAYOR_ACCOUNT_SHIPMENT",
"RateScale": "0000000",
"RateZone": "US001O",
"PricingCode": "ACTUAL",
"RatedWeightMethod": "ACTUAL",
"CurrencyExchangeRate": {
"FromCurrency": "USD",
"IntoCurrency": "USD",
"Rate": "1.0"
},
"DimDivisor": 0,
"FuelSurchargePercent": "5.0",
"TotalBillingWeight": {
"Units": "LB",
"Value": "2.0"
},
"TotalBaseCharge": {
"Currency": "USD",
"Amount": "92.99"
},
"TotalFreightDiscounts": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetFreight": {
"Currency": "USD",
"Amount": "92.99"
},
"TotalSurcharges": {
"Currency": "USD",
"Amount": "4.65"
},
"TotalNetFedExCharge": {
"Currency": "USD",
"Amount": "97.64"
},
"TotalTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetCharge": {
"Currency": "USD",
"Amount": "97.64"
},
"TotalRebates": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalDutiesAndTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetChargeWithDutiesAndTaxes": {
"Currency": "USD",
"Amount": "97.64"
},
"Surcharges": {
"SurchargeType": "FUEL",
"Description": "Fuel",
"Amount": {
"Currency": "USD",
"Amount": "4.65"
}
}
}
},
{
"EffectiveNetDiscount": {
"Currency": "USD",
"Amount": "0.0"
},
"ShipmentRateDetail": {
"RateType": "RATED_ACCOUNT_SHIPMENT",
"RateScale": "0000000",
"RateZone": "US001O",
"PricingCode": "ACTUAL",
"RatedWeightMethod": "ACTUAL",
"CurrencyExchangeRate": {
"FromCurrency": "USD",
"IntoCurrency": "USD",
"Rate": "1.0"
},
"DimDivisor": 0,
"FuelSurchargePercent": "5.0",
"TotalBillingWeight": {
"Units": "LB",
"Value": "2.0"
},
"TotalBaseCharge": {
"Currency": "USD",
"Amount": "92.99"
},
"TotalFreightDiscounts": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetFreight": {
"Currency": "USD",
"Amount": "92.99"
},
"TotalSurcharges": {
"Currency": "USD",
"Amount": "4.65"
},
"TotalNetFedExCharge": {
"Currency": "USD",
"Amount": "97.64"
},
"TotalTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetCharge": {
"Currency": "USD",
"Amount": "97.64"
},
"TotalRebates": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalDutiesAndTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetChargeWithDutiesAndTaxes": {
"Currency": "USD",
"Amount": "97.64"
},
"Surcharges": {
"SurchargeType": "FUEL",
"Description": "Fuel",
"Amount": {
"Currency": "USD",
"Amount": "4.65"
}
}
}
},
{
"ShipmentRateDetail": {
"RateType": "PAYOR_LIST_SHIPMENT",
"RateScale": "0000000",
"RateZone": "US001O",
"PricingCode": "ACTUAL",
"RatedWeightMethod": "ACTUAL",
"CurrencyExchangeRate": {
"FromCurrency": "USD",
"IntoCurrency": "USD",
"Rate": "1.0"
},
"DimDivisor": 0,
"FuelSurchargePercent": "5.0",
"TotalBillingWeight": {
"Units": "LB",
"Value": "2.0"
},
"TotalBaseCharge": {
"Currency": "USD",
"Amount": "92.99"
},
"TotalFreightDiscounts": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetFreight": {
"Currency": "USD",
"Amount": "92.99"
},
"TotalSurcharges": {
"Currency": "USD",
"Amount": "4.65"
},
"TotalNetFedExCharge": {
"Currency": "USD",
"Amount": "97.64"
},
"TotalTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetCharge": {
"Currency": "USD",
"Amount": "97.64"
},
"TotalRebates": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalDutiesAndTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetChargeWithDutiesAndTaxes": {
"Currency": "USD",
"Amount": "97.64"
},
"Surcharges": {
"SurchargeType": "FUEL",
"Description": "Fuel",
"Amount": {
"Currency": "USD",
"Amount": "4.65"
}
}
}
},
{
"ShipmentRateDetail": {
"RateType": "RATED_LIST_SHIPMENT",
"RateScale": "0000000",
"RateZone": "US001O",
"PricingCode": "ACTUAL",
"RatedWeightMethod": "ACTUAL",
"CurrencyExchangeRate": {
"FromCurrency": "USD",
"IntoCurrency": "USD",
"Rate": "1.0"
},
"DimDivisor": 0,
"FuelSurchargePercent": "5.0",
"TotalBillingWeight": {
"Units": "LB",
"Value": "2.0"
},
"TotalBaseCharge": {
"Currency": "USD",
"Amount": "92.99"
},
"TotalFreightDiscounts": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetFreight": {
"Currency": "USD",
"Amount": "92.99"
},
"TotalSurcharges": {
"Currency": "USD",
"Amount": "4.65"
},
"TotalNetFedExCharge": {
"Currency": "USD",
"Amount": "97.64"
},
"TotalTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetCharge": {
"Currency": "USD",
"Amount": "97.64"
},
"TotalRebates": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalDutiesAndTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetChargeWithDutiesAndTaxes": {
"Currency": "USD",
"Amount": "97.64"
},
"Surcharges": {
"SurchargeType": "FUEL",
"Description": "Fuel",
"Amount": {
"Currency": "USD",
"Amount": "4.65"
}
}
}
}
]
},
{
"ServiceType": "INTERNATIONAL_ECONOMY",
"PackagingType": "YOUR_PACKAGING",
"DestinationAirportId": "YYZ",
"IneligibleForMoneyBackGuarantee": false,
"OriginServiceArea": "A1",
"DestinationServiceArea": "AM",
"SignatureOption": "SERVICE_DEFAULT",
"ActualRateType": "PAYOR_ACCOUNT_SHIPMENT",
"RatedShipmentDetails": [
{
"EffectiveNetDiscount": {
"Currency": "USD",
"Amount": "0.0"
},
"ShipmentRateDetail": {
"RateType": "PAYOR_ACCOUNT_SHIPMENT",
"RateScale": "0000000",
"RateZone": "US001O",
"PricingCode": "ACTUAL",
"RatedWeightMethod": "ACTUAL",
"CurrencyExchangeRate": {
"FromCurrency": "USD",
"IntoCurrency": "USD",
"Rate": "1.0"
},
"DimDivisor": 0,
"FuelSurchargePercent": "5.0",
"TotalBillingWeight": {
"Units": "LB",
"Value": "2.0"
},
"TotalBaseCharge": {
"Currency": "USD",
"Amount": "83.18"
},
"TotalFreightDiscounts": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetFreight": {
"Currency": "USD",
"Amount": "83.18"
},
"TotalSurcharges": {
"Currency": "USD",
"Amount": "4.16"
},
"TotalNetFedExCharge": {
"Currency": "USD",
"Amount": "87.34"
},
"TotalTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetCharge": {
"Currency": "USD",
"Amount": "87.34"
},
"TotalRebates": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalDutiesAndTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetChargeWithDutiesAndTaxes": {
"Currency": "USD",
"Amount": "87.34"
},
"Surcharges": {
"SurchargeType": "FUEL",
"Description": "Fuel",
"Amount": {
"Currency": "USD",
"Amount": "4.16"
}
}
}
},
{
"EffectiveNetDiscount": {
"Currency": "USD",
"Amount": "0.0"
},
"ShipmentRateDetail": {
"RateType": "RATED_ACCOUNT_SHIPMENT",
"RateScale": "0000000",
"RateZone": "US001O",
"PricingCode": "ACTUAL",
"RatedWeightMethod": "ACTUAL",
"CurrencyExchangeRate": {
"FromCurrency": "USD",
"IntoCurrency": "USD",
"Rate": "1.0"
},
"DimDivisor": 0,
"FuelSurchargePercent": "5.0",
"TotalBillingWeight": {
"Units": "LB",
"Value": "2.0"
},
"TotalBaseCharge": {
"Currency": "USD",
"Amount": "83.18"
},
"TotalFreightDiscounts": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetFreight": {
"Currency": "USD",
"Amount": "83.18"
},
"TotalSurcharges": {
"Currency": "USD",
"Amount": "4.16"
},
"TotalNetFedExCharge": {
"Currency": "USD",
"Amount": "87.34"
},
"TotalTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetCharge": {
"Currency": "USD",
"Amount": "87.34"
},
"TotalRebates": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalDutiesAndTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetChargeWithDutiesAndTaxes": {
"Currency": "USD",
"Amount": "87.34"
},
"Surcharges": {
"SurchargeType": "FUEL",
"Description": "Fuel",
"Amount": {
"Currency": "USD",
"Amount": "4.16"
}
}
}
},
{
"ShipmentRateDetail": {
"RateType": "PAYOR_LIST_SHIPMENT",
"RateScale": "0000000",
"RateZone": "US001O",
"PricingCode": "ACTUAL",
"RatedWeightMethod": "ACTUAL",
"CurrencyExchangeRate": {
"FromCurrency": "USD",
"IntoCurrency": "USD",
"Rate": "1.0"
},
"DimDivisor": 0,
"FuelSurchargePercent": "5.0",
"TotalBillingWeight": {
"Units": "LB",
"Value": "2.0"
},
"TotalBaseCharge": {
"Currency": "USD",
"Amount": "83.18"
},
"TotalFreightDiscounts": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetFreight": {
"Currency": "USD",
"Amount": "83.18"
},
"TotalSurcharges": {
"Currency": "USD",
"Amount": "4.16"
},
"TotalNetFedExCharge": {
"Currency": "USD",
"Amount": "87.34"
},
"TotalTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetCharge": {
"Currency": "USD",
"Amount": "87.34"
},
"TotalRebates": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalDutiesAndTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetChargeWithDutiesAndTaxes": {
"Currency": "USD",
"Amount": "87.34"
},
"Surcharges": {
"SurchargeType": "FUEL",
"Description": "Fuel",
"Amount": {
"Currency": "USD",
"Amount": "4.16"
}
}
}
},
{
"ShipmentRateDetail": {
"RateType": "RATED_LIST_SHIPMENT",
"RateScale": "0000000",
"RateZone": "US001O",
"PricingCode": "ACTUAL",
"RatedWeightMethod": "ACTUAL",
"CurrencyExchangeRate": {
"FromCurrency": "USD",
"IntoCurrency": "USD",
"Rate": "1.0"
},
"DimDivisor": 0,
"FuelSurchargePercent": "5.0",
"TotalBillingWeight": {
"Units": "LB",
"Value": "2.0"
},
"TotalBaseCharge": {
"Currency": "USD",
"Amount": "83.18"
},
"TotalFreightDiscounts": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetFreight": {
"Currency": "USD",
"Amount": "83.18"
},
"TotalSurcharges": {
"Currency": "USD",
"Amount": "4.16"
},
"TotalNetFedExCharge": {
"Currency": "USD",
"Amount": "87.34"
},
"TotalTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetCharge": {
"Currency": "USD",
"Amount": "87.34"
},
"TotalRebates": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalDutiesAndTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetChargeWithDutiesAndTaxes": {
"Currency": "USD",
"Amount": "87.34"
},
"Surcharges": {
"SurchargeType": "FUEL",
"Description": "Fuel",
"Amount": {
"Currency": "USD",
"Amount": "4.16"
}
}
}
}
]
},
{
"ServiceType": "FEDEX_GROUND",
"PackagingType": "YOUR_PACKAGING",
"DestinationAirportId": "YYZ",
"IneligibleForMoneyBackGuarantee": true,
"SignatureOption": "SERVICE_DEFAULT",
"ActualRateType": "PAYOR_ACCOUNT_PACKAGE",
"RatedShipmentDetails": [
{
"EffectiveNetDiscount": {
"Currency": "USD",
"Amount": "0.0"
},
"ShipmentRateDetail": {
"RateType": "PAYOR_ACCOUNT_PACKAGE",
"RateZone": "51",
"RatedWeightMethod": "ACTUAL",
"DimDivisor": 0,
"FuelSurchargePercent": "7.0",
"TotalBillingWeight": {
"Units": "LB",
"Value": "2.0"
},
"TotalBaseCharge": {
"Currency": "USD",
"Amount": "22.73"
},
"TotalFreightDiscounts": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetFreight": {
"Currency": "USD",
"Amount": "22.73"
},
"TotalSurcharges": {
"Currency": "USD",
"Amount": "1.59"
},
"TotalNetFedExCharge": {
"Currency": "USD",
"Amount": "24.32"
},
"TotalTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetCharge": {
"Currency": "USD",
"Amount": "24.32"
},
"TotalRebates": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalDutiesAndTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetChargeWithDutiesAndTaxes": {
"Currency": "USD",
"Amount": "24.32"
},
"Surcharges": [
{
"SurchargeType": "INSURED_VALUE",
"Level": "PACKAGE",
"Description": "Insured value",
"Amount": {
"Currency": "USD",
"Amount": "0.0"
}
},
{
"SurchargeType": "FUEL",
"Level": "PACKAGE",
"Description": "FedEx Ground Fuel",
"Amount": {
"Currency": "USD",
"Amount": "1.59"
}
}
]
},
"RatedPackages": {
"GroupNumber": 0,
"EffectiveNetDiscount": {
"Currency": "USD",
"Amount": "0.0"
},
"PackageRateDetail": {
"RateType": "PAYOR_ACCOUNT_PACKAGE",
"RatedWeightMethod": "ACTUAL",
"BillingWeight": {
"Units": "LB",
"Value": "2.0"
},
"BaseCharge": {
"Currency": "USD",
"Amount": "22.73"
},
"TotalFreightDiscounts": {
"Currency": "USD",
"Amount": "0.0"
},
"NetFreight": {
"Currency": "USD",
"Amount": "22.73"
},
"TotalSurcharges": {
"Currency": "USD",
"Amount": "1.59"
},
"NetFedExCharge": {
"Currency": "USD",
"Amount": "24.32"
},
"TotalTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"NetCharge": {
"Currency": "USD",
"Amount": "24.32"
},
"TotalRebates": {
"Currency": "USD",
"Amount": "0.0"
},
"Surcharges": [
{
"SurchargeType": "INSURED_VALUE",
"Level": "PACKAGE",
"Description": "Insured value",
"Amount": {
"Currency": "USD",
"Amount": "0.0"
}
},
{
"SurchargeType": "FUEL",
"Level": "PACKAGE",
"Description": "FedEx Ground Fuel",
"Amount": {
"Currency": "USD",
"Amount": "1.59"
}
}
]
}
}
},
{
"ShipmentRateDetail": {
"RateType": "PAYOR_LIST_PACKAGE",
"RateZone": "51",
"RatedWeightMethod": "ACTUAL",
"DimDivisor": 0,
"FuelSurchargePercent": "7.0",
"TotalBillingWeight": {
"Units": "LB",
"Value": "2.0"
},
"TotalBaseCharge": {
"Currency": "USD",
"Amount": "22.73"
},
"TotalFreightDiscounts": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetFreight": {
"Currency": "USD",
"Amount": "22.73"
},
"TotalSurcharges": {
"Currency": "USD",
"Amount": "1.59"
},
"TotalNetFedExCharge": {
"Currency": "USD",
"Amount": "24.32"
},
"TotalTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetCharge": {
"Currency": "USD",
"Amount": "24.32"
},
"TotalRebates": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalDutiesAndTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetChargeWithDutiesAndTaxes": {
"Currency": "USD",
"Amount": "24.32"
},
"Surcharges": [
{
"SurchargeType": "INSURED_VALUE",
"Level": "PACKAGE",
"Description": "Insured value",
"Amount": {
"Currency": "USD",
"Amount": "0.0"
}
},
{
"SurchargeType": "FUEL",
"Level": "PACKAGE",
"Description": "FedEx Ground Fuel",
"Amount": {
"Currency": "USD",
"Amount": "1.59"
}
}
]
},
"RatedPackages": {
"GroupNumber": 0,
"PackageRateDetail": {
"RateType": "PAYOR_LIST_PACKAGE",
"RatedWeightMethod": "ACTUAL",
"BillingWeight": {
"Units": "LB",
"Value": "2.0"
},
"BaseCharge": {
"Currency": "USD",
"Amount": "22.73"
},
"TotalFreightDiscounts": {
"Currency": "USD",
"Amount": "0.0"
},
"NetFreight": {
"Currency": "USD",
"Amount": "22.73"
},
"TotalSurcharges": {
"Currency": "USD",
"Amount": "1.59"
},
"NetFedExCharge": {
"Currency": "USD",
"Amount": "24.32"
},
"TotalTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"NetCharge": {
"Currency": "USD",
"Amount": "24.32"
},
"TotalRebates": {
"Currency": "USD",
"Amount": "0.0"
},
"Surcharges": [
{
"SurchargeType": "INSURED_VALUE",
"Level": "PACKAGE",
"Description": "Insured value",
"Amount": {
"Currency": "USD",
"Amount": "0.0"
}
},
{
"SurchargeType": "FUEL",
"Level": "PACKAGE",
"Description": "FedEx Ground Fuel",
"Amount": {
"Currency": "USD",
"Amount": "1.59"
}
}
]
}
}
}
]
}
]
}
@@ -0,0 +1,305 @@
{
"HighestSeverity": "SUCCESS",
"Notifications": {
"Severity": "SUCCESS",
"Source": "crs",
"Code": "0",
"Message": "Request was successfully processed. ",
"LocalizedMessage": "Request was successfully processed. "
},
"Version": {
"ServiceId": "crs",
"Major": 10,
"Intermediate": 0,
"Minor": 0
},
"RateReplyDetails": {
"ServiceType": "SMART_POST",
"PackagingType": "YOUR_PACKAGING",
"IneligibleForMoneyBackGuarantee": false,
"SignatureOption": "SERVICE_DEFAULT",
"ActualRateType": "PAYOR_ACCOUNT_PACKAGE",
"RatedShipmentDetails": [
{
"EffectiveNetDiscount": {
"Currency": "USD",
"Amount": "1.91"
},
"ShipmentRateDetail": {
"RateType": "PAYOR_ACCOUNT_PACKAGE",
"RateZone": "6",
"RatedWeightMethod": "ACTUAL",
"DimDivisor": 0,
"FuelSurchargePercent": "7.0",
"TotalBillingWeight": {
"Units": "LB",
"Value": "2.0"
},
"TotalBaseCharge": {
"Currency": "USD",
"Amount": "9.49"
},
"TotalFreightDiscounts": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetFreight": {
"Currency": "USD",
"Amount": "9.49"
},
"TotalSurcharges": {
"Currency": "USD",
"Amount": "2.27"
},
"TotalNetFedExCharge": {
"Currency": "USD",
"Amount": "11.76"
},
"TotalTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetCharge": {
"Currency": "USD",
"Amount": "11.76"
},
"TotalRebates": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalDutiesAndTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetChargeWithDutiesAndTaxes": {
"Currency": "USD",
"Amount": "11.76"
},
"Surcharges": [
{
"SurchargeType": "DELIVERY_AREA",
"Level": "PACKAGE",
"Description": "Delivery Area Surcharge Extended",
"Amount": {
"Currency": "USD",
"Amount": "1.5"
}
},
{
"SurchargeType": "FUEL",
"Level": "PACKAGE",
"Description": "SmartPost Fuel",
"Amount": {
"Currency": "USD",
"Amount": "0.77"
}
}
]
},
"RatedPackages": {
"GroupNumber": 0,
"EffectiveNetDiscount": {
"Currency": "USD",
"Amount": "1.91"
},
"PackageRateDetail": {
"RateType": "PAYOR_ACCOUNT_PACKAGE",
"RatedWeightMethod": "ACTUAL",
"BillingWeight": {
"Units": "LB",
"Value": "2.0"
},
"BaseCharge": {
"Currency": "USD",
"Amount": "9.49"
},
"TotalFreightDiscounts": {
"Currency": "USD",
"Amount": "0.0"
},
"NetFreight": {
"Currency": "USD",
"Amount": "9.49"
},
"TotalSurcharges": {
"Currency": "USD",
"Amount": "2.27"
},
"NetFedExCharge": {
"Currency": "USD",
"Amount": "11.76"
},
"TotalTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"NetCharge": {
"Currency": "USD",
"Amount": "11.76"
},
"TotalRebates": {
"Currency": "USD",
"Amount": "0.0"
},
"Surcharges": [
{
"SurchargeType": "DELIVERY_AREA",
"Level": "PACKAGE",
"Description": "Delivery Area Surcharge Extended",
"Amount": {
"Currency": "USD",
"Amount": "1.5"
}
},
{
"SurchargeType": "FUEL",
"Level": "PACKAGE",
"Description": "SmartPost Fuel",
"Amount": {
"Currency": "USD",
"Amount": "0.77"
}
}
]
}
}
},
{
"ShipmentRateDetail": {
"RateType": "PAYOR_LIST_PACKAGE",
"RateZone": "6",
"RatedWeightMethod": "ACTUAL",
"DimDivisor": 0,
"FuelSurchargePercent": "7.0",
"TotalBillingWeight": {
"Units": "LB",
"Value": "2.0"
},
"TotalBaseCharge": {
"Currency": "USD",
"Amount": "10.82"
},
"TotalFreightDiscounts": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetFreight": {
"Currency": "USD",
"Amount": "10.82"
},
"TotalSurcharges": {
"Currency": "USD",
"Amount": "2.85"
},
"TotalNetFedExCharge": {
"Currency": "USD",
"Amount": "13.67"
},
"TotalTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetCharge": {
"Currency": "USD",
"Amount": "13.67"
},
"TotalRebates": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalDutiesAndTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"TotalNetChargeWithDutiesAndTaxes": {
"Currency": "USD",
"Amount": "13.67"
},
"Surcharges": [
{
"SurchargeType": "DELIVERY_AREA",
"Level": "PACKAGE",
"Description": "Delivery Area Surcharge Extended",
"Amount": {
"Currency": "USD",
"Amount": "1.95"
}
},
{
"SurchargeType": "FUEL",
"Level": "PACKAGE",
"Description": "SmartPost Fuel",
"Amount": {
"Currency": "USD",
"Amount": "0.9"
}
}
]
},
"RatedPackages": {
"GroupNumber": 0,
"PackageRateDetail": {
"RateType": "PAYOR_LIST_PACKAGE",
"RatedWeightMethod": "ACTUAL",
"BillingWeight": {
"Units": "LB",
"Value": "2.0"
},
"BaseCharge": {
"Currency": "USD",
"Amount": "10.82"
},
"TotalFreightDiscounts": {
"Currency": "USD",
"Amount": "0.0"
},
"NetFreight": {
"Currency": "USD",
"Amount": "10.82"
},
"TotalSurcharges": {
"Currency": "USD",
"Amount": "2.85"
},
"NetFedExCharge": {
"Currency": "USD",
"Amount": "13.67"
},
"TotalTaxes": {
"Currency": "USD",
"Amount": "0.0"
},
"NetCharge": {
"Currency": "USD",
"Amount": "13.67"
},
"TotalRebates": {
"Currency": "USD",
"Amount": "0.0"
},
"Surcharges": [
{
"SurchargeType": "DELIVERY_AREA",
"Level": "PACKAGE",
"Description": "Delivery Area Surcharge Extended",
"Amount": {
"Currency": "USD",
"Amount": "1.95"
}
},
{
"SurchargeType": "FUEL",
"Level": "PACKAGE",
"Description": "SmartPost Fuel",
"Amount": {
"Currency": "USD",
"Amount": "0.9"
}
}
]
}
}
}
]
}
}
@@ -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="soapClientFactory" xsi:type="object">Magento\TestModuleFedex\Model\MockSoapClientFactory</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__);
}
@@ -0,0 +1,41 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\TestModuleGraphQlQuery\Model\Resolver;
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
use Magento\Framework\GraphQl\Config\Element\Field;
use Magento\Framework\GraphQl\Query\ResolverInterface;
/**
* Resolver for Item
*/
class Item implements ResolverInterface
{
/**
* @inheritdoc
*/
public function resolve(
Field $field,
$context,
ResolveInfo $info,
array $value = null,
array $args = null
) {
$id = 0;
foreach ($args as $key => $argValue) {
if ($key === "id") {
$id = (int)$argValue;
}
}
$itemData = [
'item_id' => $id,
'name' => "itemName"
];
return $itemData;
}
}
@@ -0,0 +1,34 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\TestModuleGraphQlQuery\Model\Resolver;
use Magento\Framework\GraphQl\Config\Element\Field;
use Magento\Framework\GraphQl\Query\ResolverInterface;
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
/**
* Resolver for Union type TestUnion
*/
class TestUnion implements ResolverInterface
{
/**
* @inheritDoc
*/
public function resolve(
Field $field,
$context,
ResolveInfo $info,
array $value = null,
array $args = null
) {
return [
'custom_name1' => 'custom_name1_value',
'custom_name2' => 'custom_name2_value',
];
}
}
@@ -0,0 +1,27 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\TestModuleGraphQlQuery\Model\Resolver;
use Magento\Framework\GraphQl\Query\Resolver\TypeResolverInterface;
/**
* Type Resolver for union
*/
class UnionTypeResolver implements TypeResolverInterface
{
/**
* @inheritDoc
*/
public function resolveType(array $data): string
{
if (!empty($data)) {
return 'TypeCustom1';
}
return '';
}
}
@@ -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\TestModuleGraphQlQuery\Model\Entity\ItemInterface" type="Magento\TestModuleGraphQlQuery\Model\Entity\Item"/>
</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_TestModuleGraphQlQuery" />
</config>
@@ -0,0 +1,44 @@
# Copyright © Magento, Inc. All rights reserved.
# See COPYING.txt for license details.
type Query {
testItem(id: Int!) : TestItemOutput @resolver(class: "Magento\\TestModuleGraphQlQuery\\Model\\Resolver\\Item")
testUnion: TestUnion @resolver(class: "Magento\\TestModuleGraphQlQuery\\Model\\Resolver\\TestUnion")
testQueryWithNestedMandatoryInputArguments(input: TestInputQueryWithMandatoryArgumentsInput): TestItemOutput
testQueryWithTopLevelMandatoryInputArguments(topLevelArgument: String!): TestItemOutput
}
type Mutation {
testItem(id: Int!) : MutationItemOutput @resolver(class: "Magento\\TestModuleGraphQlQuery\\Model\\Resolver\\Item")
}
type TestItemOutput {
item_id: Int
name: String
}
type MutationItemOutput {
item_id: Int
name: String
}
union TestUnion @doc(description: "some kind of union") @typeResolver(class: "Magento\\TestModuleGraphQlQuery\\Model\\Resolver\\UnionTypeResolver") =
TypeCustom1 | TypeCustom2
type TypeCustom1 {
custom_name1: String
}
type TypeCustom2 {
custom_name2: String
}
input TestInputQueryWithMandatoryArgumentsInput {
query_id: String!
query_items: [QueryWithMandatoryArgumentsInput!]!
}
input QueryWithMandatoryArgumentsInput {
query_item_id: Int!
quantity: Float
}

Some files were not shown because too many files have changed in this diff Show More