Add external ID generation and update user route actions
Introduce methods to generate and retrieve unique external IDs for collected order invoices, ensuring UUID-based uniqueness. Update user route actions to include new functionalities for editing user roles and passwords.
This commit is contained in:
@@ -19,6 +19,36 @@ class collected_order_invoices_o extends db
|
||||
public object_property $created_at;
|
||||
public object_property $updated_at;
|
||||
public object_property $closed_at;
|
||||
public array $processors = [
|
||||
1 => 'E-conomic',
|
||||
2 => 'Stripe',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the external id of the invoice collection
|
||||
* @throws Exception If the request was not successful
|
||||
* @throws Exception If the UUID could not be generated
|
||||
* @throws Exception If the external id is not unique
|
||||
*/
|
||||
public function getExternalId(): string
|
||||
{
|
||||
if (empty($this->external_id->value())) {
|
||||
$this->external_id->set(self::generateExternalId());
|
||||
}
|
||||
return $this->external_id->value();
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a unique external id (UUID)
|
||||
* @return string The generated UUID
|
||||
* @throws Exception If the UUID could not be generated
|
||||
* @throws Exception If the request was not successful
|
||||
*/
|
||||
public static function generateExternalId(): string
|
||||
{
|
||||
$uuid = bin2hex(random_bytes(16));
|
||||
return substr($uuid, 0, 8) . '-' . substr($uuid, 8, 4) . '-' . substr($uuid, 12, 4) . '-' . substr($uuid, 16, 4) . '-' . substr($uuid, 20);
|
||||
}
|
||||
|
||||
public function structure(): void
|
||||
{
|
||||
|
||||
@@ -174,7 +174,9 @@ class usersRoute
|
||||
}
|
||||
},
|
||||
[
|
||||
'edit_user' => 'Edit a user'
|
||||
'edit_user' => 'Edit a user',
|
||||
'edit_user_role' => 'Edit a user\'s role',
|
||||
'edit_user_password' => 'Edit a user\'s password'
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user