Exemple #1
0
 public function getItemsList()
 {
     static $result = null;
     if ($result === null) {
         $result = \Bitrix\Sale\TradingPlatform\Xml2Array::convert($this->getItems());
     }
     return $result;
 }
Exemple #2
0
 public function convert($data)
 {
     if (!isset($data["RESULT_ID"])) {
         throw new ArgumentNullException("data[\"RESULT_ID\"]");
     }
     if (!isset($data["CONTENT"])) {
         throw new ArgumentNullException("data[\"CONTENT\"]");
     }
     $result["ARRAY"] = \Bitrix\Sale\TradingPlatform\Xml2Array::convert($data["CONTENT"]);
     $result["RESULT_ID"] = $data["RESULT_ID"];
     $result["XML"] = $data["CONTENT"];
     return $result;
 }
Exemple #3
0
    protected function requestData()
    {
        $data = '<?xml version="1.0" encoding="utf-8"?>
			<GeteBayDetailsRequest xmlns="urn:ebay:apis:eBLBaseComponents">
			<RequesterCredentials>
			<eBayAuthToken>' . $this->authToken . '</eBayAuthToken>
			</RequesterCredentials>
		</GeteBayDetailsRequest>';
        $dataXml = $this->apiCaller->sendRequest("GeteBayDetails", $data);
        if (strtolower(SITE_CHARSET) != 'utf-8') {
            $dataXml = Encoding::convertEncoding($dataXml, 'UTF-8', SITE_CHARSET);
        }
        $result = Xml2Array::convert($dataXml);
        return $result;
    }
Exemple #4
0
    protected function getItems(array $params = array())
    {
        $data = '<?xml version="1.0" encoding="utf-8"?>
			<GetCategoriesRequest xmlns="urn:ebay:apis:eBLBaseComponents">
			<RequesterCredentials>
			<eBayAuthToken>' . $this->authToken . '</eBayAuthToken>
			</RequesterCredentials>
			<CategorySiteID>' . $this->ebaySiteId . '</CategorySiteID>
			<WarningLevel>' . $this->warningLevel . '</WarningLevel>' . "\n";
        $data .= $this->array2Tags($params);
        $data .= '</GetCategoriesRequest>?';
        $categoriesXml = $this->apiCaller->sendRequest("GetCategories", $data);
        if (strtolower(SITE_CHARSET) != 'utf-8') {
            $categoriesXml = Encoding::convertEncoding($categoriesXml, 'UTF-8', SITE_CHARSET);
        }
        $result = Xml2Array::convert($categoriesXml);
        return $result;
    }
Exemple #5
0
        protected static function getUserInfo($siteId, array $ebaySettings)
        {
            if (strlen($siteId) <= 0 || empty($ebaySettings)) {
                return array();
            }
            if (empty($ebaySettings[$siteId]["API"]["AUTH_TOKEN"])) {
                return array();
            }
            $userId = self::getUserId($siteId, $ebaySettings);
            if (strlen($userId) <= 0) {
                return array();
            }
            $cacheManager = \Bitrix\Main\Application::getInstance()->getManagedCache();
            $ttl = 86400;
            $cacheId = __FILE__ . ":USER_INFO";
            if (self::$useCache && $cacheManager->read($ttl, $cacheId)) {
                $result = $cacheManager->get($cacheId);
            } else {
                if (!self::$useCache) {
                    $cacheManager->clean($cacheId);
                }
                $ebay = \Bitrix\Sale\TradingPlatform\Ebay\Ebay::getInstance();
                $settings = $ebay->getSettings();
                if (empty($settings[$siteId]["API"]["AUTH_TOKEN"])) {
                    return array();
                }
                $data = '<?xml version="1.0" encoding="utf-8"?>
					<GetUserRequest xmlns="urn:ebay:apis:eBLBaseComponents">
					<RequesterCredentials>
						<eBayAuthToken>' . $settings[$siteId]["API"]["AUTH_TOKEN"] . '</eBayAuthToken>
					</RequesterCredentials>
					<UserID>' . $userId . '</UserID>
					</GetUserRequest>';
                $caller = new Caller(array("URL" => \Bitrix\Sale\TradingPlatform\Ebay\Ebay::getApiUrl()));
                $xmpRes = $caller->sendRequest("GetUser", $data);
                $result = Xml2Array::convert($xmpRes);
                $cacheManager->set($cacheId, $result);
            }
            return $result;
        }
Exemple #6
0
 public function convert($data)
 {
     $result = Xml2Array::convert($data, false);
     return Xml2Array::normalize($result["Order"]);
 }
Exemple #7
0
    ?>
			</td>
		</tr>
		<tr>
			<td><?php 
    echo Loc::getMessage("SALE_EBAY_FEED_LAST_EXCAHGE_RES");
    ?>
:</td>
			<td >
				<?php 
    $feedResMess = "";
    $feedResErrDescr = "";
    if (empty($results[$smallFeedType]["RESULTS"])) {
        $feedResMess = "-";
    } else {
        $tmp = Xml2Array::convert($results[$smallFeedType]["RESULTS"]);
        if (strpos($results[$smallFeedType]["RESULTS"], "<Errors>") !== false) {
            $feedResMess = '<span style="color: red; font-weight: bold;">' . Loc::getMessage("SALE_EBAY_RES_ERROR") . '</span>';
            if (isset($tmp["ProductResult"])) {
                $productResults = Xml2Array::normalize($tmp["ProductResult"]);
                foreach ($productResults as $productResult) {
                    if (isset($productResult["Errors"]["Error"])) {
                        $errors = Xml2Array::normalize($productResult["Errors"]["Error"]);
                        foreach ($errors as $error) {
                            $feedResErrDescr .= Loc::getMessage("SALE_EBAY_ERROR") . ": " . $error["Message"] . " " . Loc::getMessage("SALE_EBAY_CODE") . ": " . $error["Code"] . "<br>\n";
                        }
                    }
                }
            }
        }
        if (strpos($results[$smallFeedType]["RESULTS"], "<Warnings>") !== false) {