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:
Jeppe Bundgaard
2026-02-03 12:19:42 +01:00
parent ab93866295
commit 5aa575268f
4 changed files with 375 additions and 0 deletions
+12
View File
@@ -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));
}
}