mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-21 21:43:57 +00:00
Merge branch 'dillon/90-e-invoice-f-2' into vapor/development
This commit is contained in:
@@ -43,17 +43,16 @@ class ListBookingsSalesInvoiceLogic extends AbstractControllerLogic
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
// $this->canListBookings->passes(); //cief todo: 90 - apipub
|
||||
$filters = $request->input('filters');
|
||||
|
||||
// Decode JSON if sent as string
|
||||
$filters = $request->input('filters');
|
||||
if (is_string($filters)) {
|
||||
$filters = json_decode($filters, true);
|
||||
}
|
||||
|
||||
if (!is_array($filters)) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Invalid filters format. Expected JSON object.'
|
||||
'message' => 'Invalid filters format. Expected JSON object.',
|
||||
'payload' => new \stdClass(),
|
||||
], 400);
|
||||
}
|
||||
|
||||
@@ -63,8 +62,8 @@ class ListBookingsSalesInvoiceLogic extends AbstractControllerLogic
|
||||
$extra = array_diff(array_keys($filters), $allowedKeys);
|
||||
if (!empty($extra)) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Invalid filter(s) provided: ' . implode(', ', $extra),
|
||||
'payload' => new \stdClass(),
|
||||
], 400);
|
||||
}
|
||||
|
||||
@@ -74,16 +73,23 @@ class ListBookingsSalesInvoiceLogic extends AbstractControllerLogic
|
||||
$missing = array_diff($alwaysRequired, array_keys($filters));
|
||||
if (!empty($missing)) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Missing required filter(s): ' . implode(', ', $missing),
|
||||
'payload' => new \stdClass(),
|
||||
], 400);
|
||||
}
|
||||
|
||||
if ((int) $filters['status'] !== 3) {
|
||||
return response()->json([
|
||||
'message' => 'Invalid status value.',
|
||||
'payload' => new \stdClass(),
|
||||
], 400);
|
||||
}
|
||||
|
||||
// Required at least one of: date_range or date_range_no_data
|
||||
if (!isset($filters['date_range']) && !isset($filters['date_range_no_data'])) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Either "date_range" or "date_range_no_data" filter is required.',
|
||||
'payload' => new \stdClass(),
|
||||
], 400);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user