/** * this function prepares list of orders with information about: * * id - playment id * payment_name - payment name * payment_price - payment price incl. VAT * payment_price_without_vat - payment price ex. VAT * * The list can be implemented under a condition from actually used orders Payment IDs, this list is available as a $paymentIds field. * If you decide not to use the list of ids of payments found in orders, the export can be slower and more data-demanding, in case of larger amount of payments. * * @param array $paymentIds * @return PaymentList */ public function getPayments($paymentIds) { $result = $this->getPaymentsItems($paymentIds); $data = new PaymentList(); foreach ($result as $item) { $data->addBean(new PaymentBean($item)); } return $data; }
/** * * @param OrderBean $order */ private function showShopOrder($order) { $shopOrder = new ShopOrderEntity(); // basic order section $shopOrder->addItem(new ShopIdEntity($this->model->getEshopId())); $shopOrder->addItem(new ShopNameEntity($this->model->getEshopName())); $shopOrder->addItem(new IdOrderEntity($order->id)); $shopOrder->addItem(new DateCreatedEntity($order->date_created)); $shopOrder->addItem(new DateUpdatedEntity($order->date_updated)); $shopOrder->addItem(new CurrencyIdEntity($order->currency_id)); $shopOrder->addItem(new CurrencyEntity($order->currency)); $shopOrder->addItem(new PriceEntity($order->price)); $shopOrder->addItem(new PriceWithoutVatEntity($order->price_without_vat)); // order status section $orderStatusBean = $this->orderStatusBean->getBeanById($order->order_status_id); $shopOrder->addItem(new OrderStatusIdEntity($order->order_status_id)); $shopOrder->addItem(new OrderStatusNameEntity($orderStatusBean->order_status_name)); // payment section $payment = $this->payment->getBeanById($order->payment_id); $shopOrder->addItem(new PaymentIdEntity($order->payment_id)); $shopOrder->addItem(new PaymentNameEntity($payment->payment_name)); $shopOrder->addItem(new PaymentPriceEntity($payment->payment_price)); $shopOrder->addItem(new PaymentPriceWithoutVatEntity($payment->payment_price_without_vat)); // shipping section if ($shipping = $this->shipping->getBeanById($order->shipping_id)) { $shopOrder->addItem(new ShippingIdEntity($order->shipping_id)); $shopOrder->addItem(new ShippingNameEntity($shipping->shipping_name)); $shopOrder->addItem(new ShippingPriceEntity($shipping->shipping_price)); $shopOrder->addItem(new ShippingPriceWithoutVatEntity($shipping->shipping_price_without_vat)); $shopOrder->addItem(new NoteEntity($order->note)); } // customer section if ($customerBean = $this->customerBean->getBeanById($order->customer_id)) { $customer = new CustomerEntity(); $customer->addItem(new CustomerCityEntity($customerBean->customer_city)); $customer->addItem(new CustomerCountryEntity($customerBean->customer_country)); $customer->addItem(new CustomerZipCodeEntity($customerBean->customer_zip_code)); $customer->addItem(new CustomerEmailEntity($customerBean->customer_email)); $customer->addItem(new CustomerFirstnameEntity($customerBean->customer_firstname)); $customer->addItem(new CustomerRegistrationEntity($customerBean->customer_registration)); $customer->addItem(new CustomerTypeEntity($customerBean->customer_type)); $customer->addItem(new CustomerVatStatusEntity($customerBean->customer_vat_status)); $customer->addItem(new CustomerIdEntity($customerBean->id)); $shopOrder->addItem($customer); } // product section if ($orderProductBean = $this->orderProductBean->getBeanById($order->id)) { $orderProducts = new OrderProductsEntity(); $productList = $orderProductBean->getProduct_list(); foreach ($productList as $productBean) { $product = new ProductEntity(); $product->addItem(new ProductIdEntity($productBean->id)); $product->addItem(new ProductNameEntity($productBean->product_name)); $product->addItem(new ProductPriceEntity($productBean->product_price)); $product->addItem(new ProductPriceWithoutVatEntity($productBean->product_price_without_vat)); $product->addItem(new ProductPurchasePriceEntity($productBean->product_purchase_price)); $product->addItem(new ProductCountEntity($productBean->product_count)); $orderProducts->addItem($product); // categories section if ($productCategoryBean = $this->model->getCategories($this->categoriesList, $productBean->category_id, $productBean->id)->getBeanById($productBean->id)) { $productCategories = new CategoryTreeEntity(); $categoriesList = $productCategoryBean->getCategoryList(); foreach ($categoriesList as $categoryBean) { $category = new CategoryEntity(); $category->addItem(new CategoryIdEntity($categoryBean->id)); $category->addItem(new CategoryNameEntity($categoryBean->category_name)); $category->addItem(new CategoryLevelEntity($categoryBean->category_level)); $productCategories->addItem($category); } $product->addItem($productCategories); } } $shopOrder->addItem($orderProducts); } echo $shopOrder; }