Add custom routes, subscription features, and refactor orders
Introduced a new POST route for collected vehicle subscription invoices and enhanced responses with wash subscription transactions. Refactored order handling by adding department-based pricing logic and simplifying reusable methods. Various minor improvements include exception handling, input validation, and updated permissions.
This commit is contained in:
@@ -4,6 +4,7 @@ namespace traits;
|
||||
|
||||
use classes\authentication;
|
||||
use classes\recaptcha;
|
||||
use classes\response;
|
||||
use objects\logs_o;
|
||||
|
||||
trait route_t
|
||||
@@ -162,6 +163,21 @@ trait route_t
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Require the max value of the given value
|
||||
* @param int $value - The value to check
|
||||
* @param int $max - The max value
|
||||
*/
|
||||
public function requireMaxValue(int $value, int $max): void
|
||||
{
|
||||
global
|
||||
/** @var response $response */
|
||||
$response;
|
||||
if ($value > $max) {
|
||||
$response->error('Parameter must be at most ' . $max, 400);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Require department access
|
||||
* @note This checks if the user has access to the department by checking if the user has the permission department_access_{department} (_{permission} if provided)
|
||||
|
||||
Reference in New Issue
Block a user