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']; }
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; }