Introduce Economic customer helper class and customer route

Added a helper class `economic_customer` to standardize customer data handling within the Economic API. Introduced a new route, `/modules/economic/customer`, for retrieving customers using their customer number. Updated `economic` class to integrate the helper and support streamlined customer operations.
This commit is contained in:
Jepp9350
2025-02-19 11:58:58 +01:00
parent 156f036d4c
commit 143b024f78
5 changed files with 203 additions and 1 deletions
+19
View File
@@ -8,15 +8,18 @@ require_once WD . '/modules/economic/endpoints/economic_departments_endpoint.php
require_once WD . '/modules/economic/endpoints/economic_layouts_endpoint.php';
require_once WD . '/modules/economic/endpoints/economic_customers_endpoint.php';
require_once WD . '/modules/economic/endpoints/economic_products_endpoint.php';
require_once WD . '/modules/economic/economic_helpers.php';
use economic_c;
use economic_helpers;
use endpoints\economic_customers_endpoint;
use endpoints\economic_departments_endpoint;
use endpoints\economic_invoices_endpoint;
use endpoints\economic_layouts_endpoint;
use endpoints\economic_orders_endpoint;
use endpoints\economic_products_endpoint;
use helpers\economic_customer;
use interfaces\economic_i;
class economic implements economic_i
@@ -56,6 +59,11 @@ class economic implements economic_i
* @var economic_products_endpoint
*/
public economic_products_endpoint $products;
/**
* Helper classes
* @var economic_helpers
*/
protected economic_helpers $helpers;
public function __construct()
@@ -67,5 +75,16 @@ class economic implements economic_i
$this->layouts = new economic_layouts_endpoint();
$this->customers = new economic_customers_endpoint();
$this->products = new economic_products_endpoint();
$this->helpers = new economic_helpers();
}
/**
* Get a customer by their customer number
* @param int $customer_number The Economic customer number
* @return economic_customer
*/
public function getCustomer(int $customer_number): economic_customer
{
return new $this->helpers->economic_customer($customer_number);
}
}