public function createProductReport(YousticeShopProduct $product, $code)
 {
     $data = $product->toArray();
     $now = new Datetime();
     $request_data = array('orderNumber' => $code, 'itemDescription' => $data['description'], 'itemName' => $data['name'], 'itemCurrency' => $data['currency'], 'itemPrice' => $data['price'], 'itemCode' => $data['id'], 'deliveryDate' => $data['deliveryDate'], 'orderDate' => $data['orderDate'] ? $data['orderDate'] : $now->format(Datetime::ISO8601), 'shopType' => $this->shop_software_type, 'image' => $data['image'], 'other' => $data['other']);
     $url = $this->generateUrl('services/Api/addTransaction');
     $this->post($url, $request_data);
     $response = $this->responseToArray();
     return $response['redirect_link'];
 }
Ejemplo n.º 2
0
 protected function createShopProduct(array $product, $order_id)
 {
     $shop_product = YousticeShopProduct::create();
     $shop_product->setName($product['product_name']);
     $shop_product->setId($product['id_order_detail']);
     $shop_product->setPrice((double) $product['unit_price_tax_incl']);
     $shop_product->setDescription('');
     $shop_product->setOtherInfo('');
     //add image if exists
     if (count($product['image']) > 0) {
         //todo get image_format from $product['image'] ... $product['image']->image_format
         $image_path = _PS_PROD_IMG_DIR_ . $product['image']->getExistingImgPath() . '.jpg';
         $shop_product->setImagePath($image_path);
     }
     $shop_product->setOrderId($order_id);
     $shop_product->setHref($this->createProductReportHref($order_id, $product['id_order_detail']));
     return $shop_product;
 }
Ejemplo n.º 3
0
 private function createProductReportExecute(YousticeShopProduct $product)
 {
     $report = new YousticeReportsProductReport($product->toArray());
     $new_code = $this->local->createReport($report->getCode(), $this->user_id);
     $redirect_link = $this->remote->createProductReport($product, $new_code);
     if ($redirect_link == null) {
         throw new YousticeFailedRemoteConnectionException();
     }
     $this->setOftenUpdates();
     return $redirect_link;
 }