diff --git a/services/nginx/app/objects/collected_order_invoices_o.php b/services/nginx/app/objects/collected_order_invoices_o.php index e1564c07..d4716b28 100644 --- a/services/nginx/app/objects/collected_order_invoices_o.php +++ b/services/nginx/app/objects/collected_order_invoices_o.php @@ -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 { diff --git a/services/nginx/app/routes/usersRoute.php b/services/nginx/app/routes/usersRoute.php index d712dc1f..3df700b8 100644 --- a/services/nginx/app/routes/usersRoute.php +++ b/services/nginx/app/routes/usersRoute.php @@ -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' ] );