Resolve recommended-profile Critical and High findings, retain narrow analyzer exceptions, and update the edge-broker WebSocket dependency to a non-vulnerable release.
37 lines
1.2 KiB
PHP
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');
|
|
}
|
|
|
|
}
|