Add booked invoice helper and retrieval methods
- Introduce `economic_invoice_booked` helper for normalizing booked invoice data. - Add `getFromId` method to fetch booked invoice details by ID. - Extend `economic` class with `getInvoiceBookedFromExternalId` for external ID-based retrieval. - Update imports and economic helper class registrations to include booked invoice functionality.
This commit is contained in:
@@ -23,6 +23,7 @@ use endpoints\economic_payment_terms_endpoint;
|
||||
use endpoints\economic_products_endpoint;
|
||||
use helpers\economic_customer;
|
||||
use helpers\economic_invoice_draft;
|
||||
use helpers\economic_invoice_booked;
|
||||
use helpers\economic_tasks;
|
||||
use interfaces\economic_i;
|
||||
|
||||
@@ -141,4 +142,15 @@ class economic implements economic_i
|
||||
|
||||
return new $this->helpers->economic_customer($customer_number);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getInvoiceBookedFromExternalId(string $external_id): economic_invoice_booked
|
||||
{
|
||||
$bookedId = $this->invoices->booked->get_from_external_id($external_id);
|
||||
$raw = $this->invoices->booked->getFromId($bookedId);
|
||||
// Return the booked invoice helper
|
||||
return (new economic_invoice_booked($raw));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user