/** * * Инициализирует свойства объекта DDeliveryOrder из stdClass полученный из * запроса БД SQLite * * @param DDeliveryOrder $currentOrder * @param \stdClass $item */ public function _initOrderInfo($currentOrder, $item) { $currentOrder->type = $item->type; $currentOrder->paymentVariant = $item->payment_variant; $currentOrder->localId = $item->id; $currentOrder->city = $item->to_city; $currentOrder->localStatus = $item->local_status; $currentOrder->ddStatus = $item->dd_status; $currentOrder->shopRefnum = $item->shop_refnum; $currentOrder->ddeliveryID = $item->ddeliveryorder_id; $currentOrder->pointID = $item->point_id; $currentOrder->companyId = $item->delivery_company; $currentOrder->amount = $currentOrder->getAmount(); $currentOrder->setPoint(json_decode($item->point, true)); $currentOrder->addField1 = $item->add_field1; $currentOrder->addField2 = $item->add_field2; $currentOrder->addField3 = $item->add_field3; $orderInfo = json_decode($item->order_info, true); $currentOrder->confirmed = $orderInfo['confirmed']; $currentOrder->firstName = $orderInfo['firstName']; $currentOrder->secondName = $orderInfo['secondName']; $currentOrder->toPhone = $orderInfo['to_phone']; $currentOrder->declaredPrice = $orderInfo['declaredPrice']; $currentOrder->paymentPrice = $orderInfo['paymentPrice']; $currentOrder->toStreet = $orderInfo['toStreet']; $currentOrder->toHouse = $orderInfo['toHouse']; $currentOrder->toFlat = $orderInfo['toFlat']; $currentOrder->comment = $orderInfo['comment']; $currentOrder->cityName = $orderInfo['city_name']; $currentOrder->toHousing = $orderInfo['toHousing']; $currentOrder->toEmail = $orderInfo['toEmail']; $currentOrder->toIndex = $orderInfo['toIndex']; }
/** * Возвращает оценочную цену для товаров в послыке * * @param \DDelivery\Order\DDeliveryOrder $order * * @return float */ public function getDeclaredPrice($order) { return $order->getAmount() / 100 * $this->getDeclaredPercent(); }