Files
api/services/nginx/app/modules/xlvask/helpers/xlvask_create_customer.php
T
Jeppe B 2a6a86c9c3 Resolve backend Qodana critical and high findings (#314)
Resolve recommended-profile Critical and High findings, retain narrow analyzer exceptions, and update the edge-broker WebSocket dependency to a non-vulnerable release.
2026-07-17 05:44:16 +02:00

37 lines
1.2 KiB
PHP

<?php
namespace helpers;
use classes\xlvask;
use Exception;
use objects\users_o;
class xlvask_create_customer extends xlvask_helper
{
/**
* Creates a customer in the XLVask system based on the provided user object.
*
* @param users_o $user The user object containing customer information.
* @throws Exception If the user does not have a customer number or if the customer already exists.
*/
public static function createCustomer(users_o $user): never
{
// Validate user object
$user->requireSelected();
if (empty((int)$user->customer_number->value())) {
throw new Exception('User does not have a customer number');
}
// Get the XL Vask object
$xlvask = new xlvask();
$xlvask->requireModuleEnabled();
// Check if the customer already exists
if ($user->hasXLVaskCustomerAccount()) {
throw new Exception('User already has an XLVask customer account');
}
// TODO: FINISH THE CUSTOMER CREATION, ONCE THE XLVASK API IS READY
throw new Exception('Customer creation is not implemented yet, delayed until the XLVask API is ready');
}
}