diff --git a/catalyst/api-bundle/Command/TestAPICommand.php b/catalyst/api-bundle/Command/TestAPICommand.php index a8a2be2a..952b98b6 100644 --- a/catalyst/api-bundle/Command/TestAPICommand.php +++ b/catalyst/api-bundle/Command/TestAPICommand.php @@ -142,7 +142,8 @@ class TestAPICommand extends Command // get warranties given list of serial numbers $serial_list = [ 'AJ34LJADR12134LKJM4', - 'AJ34LJADR12134LKJL5', + 'AJ34LJADR12134LKJL5', + 'test', ]; $params = [ diff --git a/src/Controller/CAPI/WarrantyController.php b/src/Controller/CAPI/WarrantyController.php index 114f3c8c..affdb892 100644 --- a/src/Controller/CAPI/WarrantyController.php +++ b/src/Controller/CAPI/WarrantyController.php @@ -523,20 +523,22 @@ class WarrantyController extends APIController return new APIResponse(false, 'Empty serial numbers list.'); $warranty_list = []; + $warr_not_found_list = []; foreach ($serial_list as $serial) { $clean_serial = $this->cleanSerial($serial); $warr = $em->getRepository(Warranty::class)->findOneBy(['serial' => $clean_serial]); if ($warr == null) - return new APIResponse(false, 'No warranty found with that serial number.', null, 404); - - $warranty_list[] = $this->generateWarrantyData($warr); + $warr_not_found_list[] = 'Warranty not found for ' . $clean_serial; + else + $warranty_list[] = $this->generateWarrantyData($warr); } $data = [ - 'warranties' => $warranty_list, + 'warranties_found' => $warranty_list, + 'warranties_not_found' => $warr_not_found_list, ]; return new APIResponse(true, 'Warranties found.', $data);