Exemplo n.º 1
0
 public function process($data)
 {
     if (!is_array($data)) {
         throw new SystemException("Data must be an array! " . __METHOD__);
     }
     foreach ($data as $order) {
         try {
             if (intval($this->processOrder($order)) > 0) {
                 Ebay::log(Logger::LOG_LEVEL_INFO, "EBAY_DATA_PROCESSOR_ORDER_PROCESSED", $order["OrderID"], Loc::getMessage("SALE_TP_EBAY_FDPO_ORDER_PROCESSED", array("#ORDER_ID" => $order["OrderID"])), $this->siteId);
             } else {
                 Ebay::log(Logger::LOG_LEVEL_ERROR, "EBAY_DATA_PROCESSOR_ORDER_ERROR", $order["OrderID"], Loc::getMessage("SALE_TP_EBAY_FDPO_ORDER_ERROR", array("#ORDER_ID" => $order["OrderID"])), $this->siteId);
             }
         } catch (SystemException $e) {
             Ebay::log(Logger::LOG_LEVEL_ERROR, "EBAY_DATA_PROCESSOR_ORDER_ERROR", $order["OrderID"], Loc::getMessage("SALE_TP_EBAY_FDPO_ORDER_ERROR", array("#ORDER_ID" => $order["OrderID"])) . "." . $e->getMessage(), $this->siteId);
         }
     }
     \Bitrix\Sale\TradingPlatform\Ebay\Agent::add('ORDER_ACK', $this->siteId, 1, true);
     return true;
 }
Exemplo n.º 2
0
 public function sendData()
 {
     $xmlFile = $this->flushData();
     if (!$xmlFile) {
         return false;
     }
     $tmpFile = $this->packData($xmlFile);
     $zipFile = new \Bitrix\Main\IO\File($tmpFile);
     $zipFile->rename($this->path . "/zip/" . $this->feedType . "_" . $this->fileNameSalt . ".zip");
     $this->sendDataSftp();
     $checkResultsInterval = 5;
     //min.
     \Bitrix\Sale\TradingPlatform\Ebay\Agent::add('RESULTS', $this->siteId, $checkResultsInterval, true);
     return true;
 }
Exemplo n.º 3
0
 public static function onAfterUpdateShipment(\Bitrix\Main\Event $event, array $additional)
 {
     $data = array();
     $ebay = self::getInstance();
     $settings = $ebay->getSettings();
     $deliveryName = "Other";
     if (!empty($settings[$additional["SITE_ID"]]["MAPS"]["SHIPMENT"]) && is_array($settings[$additional["SITE_ID"]]["MAPS"]["SHIPMENT"])) {
         $map = array_flip($settings[$additional["SITE_ID"]]["MAPS"]["SHIPMENT"]);
         if (isset($map[$additional['DELIVERY_ID']])) {
             $deliveryName = $map[$additional['DELIVERY_ID']];
             if (substr($deliveryName, 0, 3) == "RU_") {
                 $deliveryName = substr($deliveryName, 3);
             }
         }
     }
     if (!empty($additional["PARAMS"]["ORDER_LINES"]) && is_array($additional["PARAMS"]["ORDER_LINES"]) && !empty($additional["PARAMS"]["ORDER_ID"])) {
         foreach ($additional["PARAMS"]["ORDER_LINES"] as $lineId) {
             $data[] = array("ORDER_ID" => $additional["PARAMS"]["ORDER_ID"], "ORDER_LINE_ITEM_ID" => $lineId, "DELIVERY_NAME" => $deliveryName, "TRACKING_NUMBER" => $additional['TRACKING_NUMBER']);
         }
     }
     if (!empty($data)) {
         $ebayFeed = \Bitrix\Sale\TradingPlatform\Ebay\Feed\Manager::createFeed("SHIPMENT", $additional["SITE_ID"]);
         $ebayFeed->setSourceData(array($data));
         $ebayFeed->processData();
         \Bitrix\Sale\TradingPlatform\Ebay\Agent::add('SHIPMENT', $additional["SITE_ID"], 1, true);
     }
 }