|
|
@@ -25,19 +25,19 @@ class OrderUpdateController
|
|
|
v::key('company_id', v::intType()->positive())
|
|
|
->key('order_id', v::intType()->positive())
|
|
|
->key('status_status', v::stringType()->notEmpty()->in(['Aberta', 'Finalizada', 'Cancelada']), true)
|
|
|
- ->optional(v::key('order_flag', v::stringType()->notEmpty()->in(['Dinheiro', 'PIX', 'Cartão de Crédito', 'Cartão de Débito']), true))
|
|
|
+ ->optional(v::key('order_flag', v::stringType()->notEmpty()->in(['Dinheiro', 'PIX', 'Cartão de Crédito', 'Cartão de Débito', 'p', 'a']), true))
|
|
|
->assert($body);
|
|
|
} catch (ValidationException $e) {
|
|
|
- return ResponseLib::sendFail("Validation failed: " . $e->getFullMessage(), [], "E_VALIDATE")->withStatus(401);
|
|
|
+ return ResponseLib::sendFail("Validation failed: " . $e->getFullMessage(), [], "E_VALIDATE")->withStatus(400);
|
|
|
}
|
|
|
|
|
|
$companyId = (int) $body['company_id'];
|
|
|
$orderId = (int) $body['order_id'];
|
|
|
$statusStatus = $body['status_status'];
|
|
|
- $orderFlag = $body['order_flag'] ?? null;
|
|
|
+ $orderFlag = $body['order_flag'] ?? '';
|
|
|
|
|
|
$statusId = $this->model->getStatusIdByName($statusStatus);
|
|
|
- if ($statusId === null) {
|
|
|
+ if ($statusId === '') {
|
|
|
return ResponseLib::sendFail("Invalid status_status Provided: '{$statusStatus}'", [], "E_VALIDATE")->withStatus(400);
|
|
|
}
|
|
|
|