post(self::RESOURCE_INVOICES, [ 'socid' => $idUser ]); } public function addInvoiceLine(int $idInvoice, int $idProduct) { $productArray = $this->getProduct($idProduct); return $this->post(self::RESOURCE_INVOICES . '/' . $idInvoice . '/lines', [ 'fk_product' => $idProduct, 'subprice' => $productArray['price'], 'qty' => 1, 'desc' => $productArray['description'] ]); } public function validateInvoice(int $idInvoice) { return $this->post(self::RESOURCE_INVOICES . '/' . $idInvoice . '/validate', [], false); } public function generateInvoicePdf(string $reference) { return $this->put(self::RESOURCE_DOCUMENTS . '/builddoc', [ 'modulepart' => 'invoice', 'doctemplate' => 'crabe', 'langcode' => 'fr_FR', 'original_file' => $reference.'/'.$reference.'.pdf' ]); } public function getProduct(int $idProduct) { return $this->get(self::RESOURCE_PRODUCTS . '/' . $idProduct); } }