44 "TRADE_BINDING" => array(
48 "OPTIONS" => self::getTradePlatformList()
61 protected static function getTradePlatformList()
65 $dbRes = Sale\TradingPlatformTable::getList([
'select' => [
'CODE',
'CLASS']]);
66 while ($data = $dbRes->fetch())
69 $platformClassName = $data[
'CLASS'];
71 if (!empty($platformClassName) && class_exists($platformClassName))
73 $platform = $platformClassName::getInstanceByCode($data[
'CODE']);
75 && $platform instanceof
Sale\TradingPlatform\Landing\Landing
78 $result[$platform->getId()] = $platform->getRealName();
95 protected static function extractParams(
Sale\Internals\Entity $entity)
99 $order = static::getOrder($entity);
106 $collection = $order->getTradeBindingCollection();
109 foreach ($collection as $entity)
111 $tradeBinding = $entity->getTradePlatform();
114 && !in_array($tradeBinding->getId(), $result)
117 $result[] = $tradeBinding->getId();
128 protected static function getOrder(
Sale\Internals\Entity $entity)
130 if ($entity instanceof
Sale\Shipment)
133 $collection = $entity->getCollection();
136 return $collection->getOrder();
138 elseif ($entity instanceof
Sale\Order)
153 public static function check($params, array $restrictionParams, $serviceId = 0)
155 if (is_array($restrictionParams) && isset($restrictionParams[
'TRADE_BINDING']))
157 $diff = array_diff($params, $restrictionParams[
'TRADE_BINDING']);
174 return count(static::getTradePlatformList()) > 0;
static loadMessages($file)
static getMessage($code, $replace=null, $language=null)