/** * Create a new Quotation to a specific Debtor * * @param integer $debtorNumber * @param Closure $callback * @return mixed * @throws Exception */ public function create($debtorNumber, Closure $callback) { $debtor = new Debtor($this->client_raw); $debtorHandle = $debtor->getHandle($debtorNumber); $quotationHandle = $this->client->Quotation_Create(['debtorHandle' => $debtorHandle])->Quotation_CreateResult; if (!$quotationHandle->Id) { throw new Exception("Error: creating Quotation."); } $this->lines = new QuotationLines($this->client_raw, $quotationHandle); call_user_func($callback, $this->lines); return $this->get($quotationHandle); }