/** * Create a new Quotaion to a specific Debtor * * @param integer $debtorNumber * @param Closure $callback * @return object * @throws Exception */ public function create($debtorNumber, Closure $callback) { $debtor = new Debtor($this->client_raw); $debtorHandle = $debtor->getHandle($debtorNumber); $invoiceHandle = $this->client->CurrentInvoice_Create(['debtorHandle' => $debtorHandle])->CurrentInvoice_CreateResult; if (!$invoiceHandle->Id) { throw new Exception("Error: creating Invoice."); } $this->lines = new Line($this->client_raw, $invoiceHandle); call_user_func($callback, $this->lines); return $this->client->CurrentInvoice_GetDataArray(['entityHandles' => ['CurrentInvoiceHandle' => $invoiceHandle]])->CurrentInvoice_GetDataArrayResult; }