| Current Path : /home/rtorresani/www/app/code/Torresani/FidelityChain/Model/Api/ |
| Current File : //home/rtorresani/www/app/code/Torresani/FidelityChain/Model/Api/RegistryRepository.php |
<?php
namespace Torresani\FidelityChain\Model\Api;
use Torresani\FidelityChain\Api\RegistryRepositoryInterface;
use Torresani\FidelityChain\Api\RequestItemInterfaceFactory;
use Torresani\FidelityChain\Api\ResponseItemInterfaceFactory;
use Magento\Catalog\Api\Data\ProductInterface;
use Magento\Catalog\Model\ResourceModel\Product\Action;
use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Store\Model\StoreManagerInterface;
/**
* Class RegistryRepository
*/
class RegistryRepository implements RegistryRepositoryInterface
{
/**
* @var Action
*/
private $productAction;
/**
* @var CollectionFactory
*/
private $productCollectionFactory;
/**
* @var RequestItemInterfaceFactory
*/
private $requestItemFactory;
/**
* @var ResponseItemInterfaceFactory
*/
private $responseItemFactory;
/**
* @var StoreManagerInterface
*/
private $storeManager;
/**
* @param Action $productAction
* @param CollectionFactory $productCollectionFactory
* @param RequestItemInterfaceFactory $requestItemFactory
* @param ResponseItemInterfaceFactory $responseItemFactory
* @param StoreManagerInterface $storeManager
*/
public function __construct(
Action $productAction,
CollectionFactory $productCollectionFactory,
RequestItemInterfaceFactory $requestItemFactory,
ResponseItemInterfaceFactory $responseItemFactory,
StoreManagerInterface $storeManager
) {
$this->productAction = $productAction;
$this->productCollectionFactory = $productCollectionFactory;
$this->requestItemFactory = $requestItemFactory;
$this->responseItemFactory = $responseItemFactory;
$this->storeManager = $storeManager;
}
/**
* @inheritDoc
*
* @param string[] $walletAddresses
* @return \Torresani\FidelityChain\Api\ResponseItemInterface
* @throws \Magento\Framework\Exception\NoSuchEntityException
*/
public function getRegistry($walletAddresses) : mixed
{
$account['0xC3675843A73F7A850382e14F2528D1654368C6b6'] = [
'accountID' => '1000',
'description' => 'INDACO-TESORERIA',
'entita_ID' => '1000',
'tipoEntita' => 'indaco',
'walletAddress' => '0xC3675843A73F7A850382e14F2528D1654368C6b6',
'walletID' => '0xC3675843A73F7A850382e14F2528D1654368C6b6',
'codiceEan' => ''
];
$account['0x4899eA425A8dfa136dF353119c40D43D6413236f'] = [
'accountID' => '2000',
'description' => 'INDACO-TEST-DIM-1',
'entita_ID' => '2000',
'tipoEntita' => 'indaco',
'walletAddress' => '0x4899eA425A8dfa136dF353119c40D43D6413236f',
'walletID' => '0x4899eA425A8dfa136dF353119c40D43D6413236f',
'codiceEan' => ''
];
$account['0x99846f5FF165D66cC2BDEc067F989A3422365895'] = [
'accountID' => '3000',
'description' => 'INDACO-TEST-DIM-2',
'entita_ID' => '3000',
'tipoEntita' => 'indaco',
'walletAddress' => '0x99846f5FF165D66cC2BDEc067F989A3422365895',
'walletID' => '0x99846f5FF165D66cC2BDEc067F989A3422365895',
'codiceEan' => ''
];
$result = [];
foreach ($walletAddresses as $walletAddress) {
$result[] = $account[$walletAddress];
}
return $result;
}
}