/** * @param integer $id * @return array * @throws Delivery\ParseException */ public function getData($id) { $result = array(); $params = array('cid' => $id); $response = $this->delivery->api('getclientdata', $params); if ($response->isSuccess()) { foreach ($response->getData() as $data) { $result = $data; } } return $result; }
/** * @return bool * @throws Delivery\ParseException */ public function send() { $params = array(); foreach ($this->params as $paramName) { $value = $this->{$paramName}; switch ($paramName) { case 'order': $items = array(); foreach ($this->items as $item) { $items[] = $this->orderFormatType == self::ORDER_JSON ? $item->toArray() : $item->toString(); } $value = $this->orderFormatType == self::ORDER_JSON ? json_encode($items) : implode(',', $items); break; case 'type': if ($value == 0) { continue 2; } break; default: } if ($value !== null) { $params[strtolower($paramName)] = $value; } } $address = $this->getAddress(); if ($address) { $params = array_merge($params, $address->toArray()); } $client = $this->getClient(); if ($client) { $params = array_merge($params, $client->toArray()); } $response = $this->delivery->api('neworder', $params); return $response->isSuccess(); }