From e98303c747aca6d07b5fbd0c5f800403a2a97dc7 Mon Sep 17 00:00:00 2001 From: Tom Fink Date: Sat, 14 Dec 2024 14:01:03 +0100 Subject: [PATCH 1/6] feat(MPDZB-877): Work on thinnedprocess typing --- zmsadmin/package-lock.json | 201 +----------------- zmscalldisplay/package-lock.json | 2 +- .../src/Zmscitizenapi/AppointmentGet.php | 2 +- .../src/Zmscitizenapi/AppointmentUpdate.php | 18 +- .../Zmscitizenapi/Helper/UtilityHelper.php | 4 +- .../Services/ZmsApiClientService.php | 31 +-- .../Services/ZmsApiFacadeService.php | 4 +- zmsentities/src/Zmsentities/Process.php | 95 +++++---- 8 files changed, 95 insertions(+), 262 deletions(-) diff --git a/zmsadmin/package-lock.json b/zmsadmin/package-lock.json index 4f081e326..fafdb39ed 100644 --- a/zmsadmin/package-lock.json +++ b/zmsadmin/package-lock.json @@ -2892,108 +2892,6 @@ "node": ">= 8" } }, - "node_modules/css-select": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/css-select/-/css-select-5.1.0.tgz", - "integrity": "sha512-nwoRF1rvRRnnCqqY7updORDsuqKzqYJ28+oSMaJMMgOauh3fvwHqMS7EZpIPqK8GL+g9mKxF1vP/ZjSeNjEVHg==", - "dev": true, - "license": "BSD-2-Clause", - "optional": true, - "peer": true, - "dependencies": { - "boolbase": "^1.0.0", - "css-what": "^6.1.0", - "domhandler": "^5.0.2", - "domutils": "^3.0.1", - "nth-check": "^2.0.1" - }, - "funding": { - "url": "https://github.com/sponsors/fb55" - } - }, - "node_modules/css-select/node_modules/dom-serializer": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz", - "integrity": "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==", - "dev": true, - "license": "MIT", - "optional": true, - "peer": true, - "dependencies": { - "domelementtype": "^2.3.0", - "domhandler": "^5.0.2", - "entities": "^4.2.0" - }, - "funding": { - "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1" - } - }, - "node_modules/css-select/node_modules/domhandler": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz", - "integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==", - "dev": true, - "license": "BSD-2-Clause", - "optional": true, - "peer": true, - "dependencies": { - "domelementtype": "^2.3.0" - }, - "engines": { - "node": ">= 4" - }, - "funding": { - "url": "https://github.com/fb55/domhandler?sponsor=1" - } - }, - "node_modules/css-select/node_modules/domutils": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-3.1.0.tgz", - "integrity": "sha512-H78uMmQtI2AhgDJjWeQmHwJJ2bLPD3GMmO7Zja/ZZh84wkm+4ut+IUnUdRa8uCGX88DiVx1j6FRe1XfxEgjEZA==", - "dev": true, - "license": "BSD-2-Clause", - "optional": true, - "peer": true, - "dependencies": { - "dom-serializer": "^2.0.0", - "domelementtype": "^2.3.0", - "domhandler": "^5.0.3" - }, - "funding": { - "url": "https://github.com/fb55/domutils?sponsor=1" - } - }, - "node_modules/css-select/node_modules/entities": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", - "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", - "dev": true, - "license": "BSD-2-Clause", - "optional": true, - "peer": true, - "engines": { - "node": ">=0.12" - }, - "funding": { - "url": "https://github.com/fb55/entities?sponsor=1" - } - }, - "node_modules/css-tree": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-2.3.1.tgz", - "integrity": "sha512-6Fv1DV/TYw//QF5IzQdqsNDjx/wc8TrMBZsqjL9eW01tWb7R7k/mq+/VXfJCl7SoD5emsJop9cOByJZfs8hYIw==", - "dev": true, - "license": "MIT", - "optional": true, - "peer": true, - "dependencies": { - "mdn-data": "2.0.30", - "source-map-js": "^1.0.1" - }, - "engines": { - "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0" - } - }, "node_modules/css-what": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/css-what/-/css-what-6.1.0.tgz", @@ -3007,48 +2905,6 @@ "url": "https://github.com/sponsors/fb55" } }, - "node_modules/csso": { - "version": "5.0.5", - "resolved": "https://registry.npmjs.org/csso/-/csso-5.0.5.tgz", - "integrity": "sha512-0LrrStPOdJj+SPCCrGhzryycLjwcgUSHBtxNA8aIDxf0GLsRh1cKYhB00Gd1lDOS4yGH69+SNn13+TWbVHETFQ==", - "dev": true, - "license": "MIT", - "optional": true, - "peer": true, - "dependencies": { - "css-tree": "~2.2.0" - }, - "engines": { - "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0", - "npm": ">=7.0.0" - } - }, - "node_modules/csso/node_modules/css-tree": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-2.2.1.tgz", - "integrity": "sha512-OA0mILzGc1kCOCSJerOeqDxDQ4HOh+G8NbOJFOTgOCzpw7fCBubk0fEyxp8AgOL/jvLgYA/uV0cMbe43ElF1JA==", - "dev": true, - "license": "MIT", - "optional": true, - "peer": true, - "dependencies": { - "mdn-data": "2.0.28", - "source-map-js": "^1.0.1" - }, - "engines": { - "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0", - "npm": ">=7.0.0" - } - }, - "node_modules/csso/node_modules/mdn-data": { - "version": "2.0.28", - "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.28.tgz", - "integrity": "sha512-aylIc7Z9y4yzHYAJNuESG3hfhC+0Ibp/MAMiaOZgNv4pmEdFyfZhhhny4MNiAfWdBQ1RQ2mfDWmM1x8SvGyp8g==", - "dev": true, - "license": "CC0-1.0", - "optional": true, - "peer": true - }, "node_modules/data-view-buffer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.1.tgz", @@ -4846,7 +4702,8 @@ "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true }, "node_modules/js-yaml": { "version": "3.14.1", @@ -5267,6 +5124,7 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "dev": true, "dependencies": { "js-tokens": "^3.0.0 || ^4.0.0" }, @@ -5282,15 +5140,6 @@ "node": ">= 0.8.0" } }, - "node_modules/mdn-data": { - "version": "2.0.30", - "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.30.tgz", - "integrity": "sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA==", - "dev": true, - "license": "CC0-1.0", - "optional": true, - "peer": true - }, "node_modules/micromatch": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", @@ -5845,6 +5694,7 @@ "version": "18.3.1", "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==", + "dev": true, "dependencies": { "loose-envify": "^1.1.0" }, @@ -6339,21 +6189,6 @@ "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", "dev": true }, - "node_modules/srcset": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/srcset/-/srcset-5.0.1.tgz", - "integrity": "sha512-/P1UYbGfJVlxZag7aABNRrulEXAwCSDo7fklafOQrantuPTDmYgijJMks2zusPCVzgW9+4P69mq7w6pYuZpgxw==", - "dev": true, - "license": "MIT", - "optional": true, - "peer": true, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/ssr-window": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/ssr-window/-/ssr-window-3.0.0.tgz", @@ -6544,34 +6379,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/svgo": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/svgo/-/svgo-3.3.2.tgz", - "integrity": "sha512-OoohrmuUlBs8B8o6MB2Aevn+pRIH9zDALSR+6hhqVfa6fRwG/Qw9VUMSMW9VNg2CFc/MTIfabtdOVl9ODIJjpw==", - "dev": true, - "license": "MIT", - "optional": true, - "peer": true, - "dependencies": { - "@trysound/sax": "0.2.0", - "commander": "^7.2.0", - "css-select": "^5.1.0", - "css-tree": "^2.3.1", - "css-what": "^6.1.0", - "csso": "^5.0.5", - "picocolors": "^1.0.0" - }, - "bin": { - "svgo": "bin/svgo" - }, - "engines": { - "node": ">=14.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/svgo" - } - }, "node_modules/swiper": { "version": "6.8.4", "resolved": "https://registry.npmjs.org/swiper/-/swiper-6.8.4.tgz", diff --git a/zmscalldisplay/package-lock.json b/zmscalldisplay/package-lock.json index 87a516364..79ee0a2b1 100644 --- a/zmscalldisplay/package-lock.json +++ b/zmscalldisplay/package-lock.json @@ -6485,4 +6485,4 @@ } } } -} \ No newline at end of file +} diff --git a/zmscitizenapi/src/Zmscitizenapi/AppointmentGet.php b/zmscitizenapi/src/Zmscitizenapi/AppointmentGet.php index 71e29dbd1..13c25042c 100644 --- a/zmscitizenapi/src/Zmscitizenapi/AppointmentGet.php +++ b/zmscitizenapi/src/Zmscitizenapi/AppointmentGet.php @@ -17,7 +17,7 @@ public function readResponse(RequestInterface $request, ResponseInterface $respo $result = ZmsApiFacadeService::getProcessById($processId, $authKey); - return $this->createJsonResponse($response, $result['data'] ?? $result, $result['status']); + return $this->createJsonResponse($response, $result ?? $result, $result['status']); } } diff --git a/zmscitizenapi/src/Zmscitizenapi/AppointmentUpdate.php b/zmscitizenapi/src/Zmscitizenapi/AppointmentUpdate.php index c779eab45..e8c28d7fc 100644 --- a/zmscitizenapi/src/Zmscitizenapi/AppointmentUpdate.php +++ b/zmscitizenapi/src/Zmscitizenapi/AppointmentUpdate.php @@ -38,12 +38,20 @@ public function readResponse(RequestInterface $request, ResponseInterface $respo return $this->createJsonResponse($response, $reservedProcess, 404); } - $reservedProcess['clients'][0]['familyName'] = $familyName; - $reservedProcess['clients'][0]['email'] = $email; - $reservedProcess['clients'][0]['telephone'] = $telephone; - $reservedProcess['customTextfield'] = $customTextfield; + error_log(json_encode($reservedProcess['data']['processId'])); + error_log(json_encode($reservedProcess['data']['email'])); + error_log(json_encode($reservedProcess['data']['familyName'])); - $updatedProcess = ZmsApiFacadeService::updateClientData(new Process($reservedProcess)); + + $reservedProcess['data']['familyName'] = $familyName; + $reservedProcess['data']['email'] = $email; + $reservedProcess['data']['telephone'] = $telephone; + $reservedProcess['data']['customTextfield'] = $customTextfield; + //$reservedProcess['data']['id'] = $processId; + + //error_log(json_encode($reservedProcess)); + + $updatedProcess = ZmsApiFacadeService::updateClientData(Process::create($reservedProcess['data'])); if (isset($updatedProcess['error']) && $updatedProcess['error'] === 'tooManyAppointmentsWithSameMail') { return $this->createJsonResponse($response, ExceptionService::tooManyAppointmentsWithSameMail(), 406); diff --git a/zmscitizenapi/src/Zmscitizenapi/Helper/UtilityHelper.php b/zmscitizenapi/src/Zmscitizenapi/Helper/UtilityHelper.php index 9a7a552c4..8f64cf485 100644 --- a/zmscitizenapi/src/Zmscitizenapi/Helper/UtilityHelper.php +++ b/zmscitizenapi/src/Zmscitizenapi/Helper/UtilityHelper.php @@ -43,7 +43,7 @@ public static function uniqueElementsFilter($value, $index, $self): bool return array_search($value, $self) === $index; } - public static function getThinnedProcessData(?Process $myProcess): array + public static function getThinnedProcessData(Process $myProcess): array { if (!$myProcess || !isset($myProcess->id)) { return []; @@ -75,7 +75,7 @@ public static function getThinnedProcessData(?Process $myProcess): array } return [ - 'processId' => $myProcess->id, + 'id' => $myProcess->id, 'timestamp' => isset($myProcess->appointments[0]) ? $myProcess->appointments[0]->date : null, 'authKey' => $myProcess->authKey ?? null, 'familyName' => isset($myProcess->clients[0]) ? $myProcess->clients[0]->familyName : null, diff --git a/zmscitizenapi/src/Zmscitizenapi/Services/ZmsApiClientService.php b/zmscitizenapi/src/Zmscitizenapi/Services/ZmsApiClientService.php index 9bbfc5306..f389e6ae3 100644 --- a/zmscitizenapi/src/Zmscitizenapi/Services/ZmsApiClientService.php +++ b/zmscitizenapi/src/Zmscitizenapi/Services/ZmsApiClientService.php @@ -141,24 +141,30 @@ public static function reserveTimeslot(Process $appointmentProcess, array $servi public static function submitClientData(Process $process): Process|array { + + error_log(json_encode($process)); + $processEntity = new Process(); - $processEntity->id = $process['data']['processId'] ?? null; - $processEntity->authKey = $process['data']['authKey'] ?? null; - $processEntity->appointments = $process['appointments'] ?? []; - $processEntity->clients = $process['clients'] ?? []; - $processEntity->scope = $process['data']['scope'] ?? null; - $processEntity->customTextfield = $process['customTextfield'] ?? null; - $processEntity->lastChange = $process['lastChange'] ?? time(); - - if (isset($process['queue'])) { - $processEntity->queue = $process['queue']; + $processEntity->id = $process->id ?? null; + $processEntity->authKey = $process->authKey ?? null; + $processEntity->appointments = $process->appointments ?? []; + $processEntity->clients = $process->clients ?? []; + $processEntity->scope = $process->scope ?? null; + $processEntity->customTextfield = $process->customTextfield ?? null; + $processEntity->lastChange = $process->lastChange ?? time(); + + if (isset($process->queue)) { + $processEntity->queue = $process->queue; } - + $processEntity->createIP = $_SERVER['REMOTE_ADDR'] ?? '127.0.0.1'; $processEntity->createTimestamp = time(); - + $url = "/process/{$processEntity->id}/{$processEntity->authKey}/"; + + error_log($url); + try { $result = \App::$http->readPostResult($url, $processEntity); return $result->getEntity(); @@ -174,6 +180,7 @@ public static function submitClientData(Process $process): Process|array } } } + public function preconfirmProcess(?Process $process): Process { diff --git a/zmscitizenapi/src/Zmscitizenapi/Services/ZmsApiFacadeService.php b/zmscitizenapi/src/Zmscitizenapi/Services/ZmsApiFacadeService.php index c2d53237c..a42562185 100644 --- a/zmscitizenapi/src/Zmscitizenapi/Services/ZmsApiFacadeService.php +++ b/zmscitizenapi/src/Zmscitizenapi/Services/ZmsApiFacadeService.php @@ -569,7 +569,7 @@ public static function reserveTimeslot(Process $appointmentProcess, array $servi return ZmsApiClientService::reserveTimeslot($appointmentProcess, $serviceIds, $serviceCounts); } - public static function getProcessById(?int $processId, ?string $authKey): array + public static function getProcessById(?int $processId, ?string $authKey): Process|array { $errors = ValidationService::validateGetProcessById($processId, $authKey); if (!empty($errors['errors'])) { @@ -586,6 +586,8 @@ public static function getProcessById(?int $processId, ?string $authKey): array } $responseData = UtilityHelper::getThinnedProcessData($process); + //$responseData = $process; + return ['data' => $responseData, 'status' => 200]; } catch (\Exception $e) { diff --git a/zmsentities/src/Zmsentities/Process.php b/zmsentities/src/Zmsentities/Process.php index ad187fc94..3d26e61a6 100644 --- a/zmsentities/src/Zmsentities/Process.php +++ b/zmsentities/src/Zmsentities/Process.php @@ -13,26 +13,45 @@ class Process extends Schema\Entity { const PRIMARY = 'id'; - public const STATUS_FREE = 'free'; - public const STATUS_RESERVED = 'reserved'; - public const STATUS_CONFIRMED = 'confirmed'; - public const STATUS_PRECONFIRMED = 'preconfirmed'; - public const STATUS_QUEUED = 'queued'; - public const STATUS_CALLED = 'called'; + public const STATUS_FREE = 'free'; + public const STATUS_RESERVED = 'reserved'; + public const STATUS_CONFIRMED = 'confirmed'; + public const STATUS_PRECONFIRMED = 'preconfirmed'; + public const STATUS_QUEUED = 'queued'; + public const STATUS_CALLED = 'called'; public const STATUS_PROCESSING = 'processing'; - public const STATUS_PENDING = 'pending'; - public const STATUS_PICKUP = 'pickup'; - public const STATUS_FINISHED = 'finished'; - public const STATUS_MISSED = 'missed'; - public const STATUS_PARKED = 'parked'; - public const STATUS_ARCHIVED = 'archived'; - public const STATUS_DELETED = 'deleted'; + public const STATUS_PENDING = 'pending'; + public const STATUS_PICKUP = 'pickup'; + public const STATUS_FINISHED = 'finished'; + public const STATUS_MISSED = 'missed'; + public const STATUS_PARKED = 'parked'; + public const STATUS_ARCHIVED = 'archived'; + public const STATUS_DELETED = 'deleted'; public const STATUS_ANONYMIZED = 'anonymized'; - public const STATUS_BLOCKED = 'blocked'; - public const STATUS_CONFLICT = 'conflict'; + public const STATUS_BLOCKED = 'blocked'; + public const STATUS_CONFLICT = 'conflict'; public static $schema = "process.json"; + public static function create(array $data = []): self + { + $instance = new self(); + foreach ($data as $key => $value) { + if (property_exists($instance, $key)) { + $instance->$key = $value; + } + } + + $defaults = $instance->getDefaults(); + foreach ($defaults as $key => $defaultValue) { + if (!isset($instance->$key)) { + $instance->$key = $defaultValue; + } + } + + return $instance; + } + public function getDefaults() { return [ @@ -114,7 +133,7 @@ public function addRequests($source, $requestCSV) { $requestList = $this->getRequests(); foreach (explode(',', $requestCSV) as $id) { - if (! $requestList->hasRequests($id)) { + if (!$requestList->hasRequests($id)) { $this->requests[] = new Request(array( 'source' => $source, 'id' => $id @@ -149,22 +168,22 @@ public function hasScopeAdmin() public function sendAdminMailOnConfirmation() { - return (bool)((int)$this->toProperty()->scope->preferences->client->adminMailOnAppointment->get()); + return (bool) ((int) $this->toProperty()->scope->preferences->client->adminMailOnAppointment->get()); } - + public function sendAdminMailOnDeleted() { - return (bool)((int)$this->toProperty()->scope->preferences->client->adminMailOnDeleted->get()); + return (bool) ((int) $this->toProperty()->scope->preferences->client->adminMailOnDeleted->get()); } public function sendAdminMailOnUpdated() { - return (bool)((int)$this->toProperty()->scope->preferences->client->adminMailOnUpdated->get()); + return (bool) ((int) $this->toProperty()->scope->preferences->client->adminMailOnUpdated->get()); } public function shouldSendAdminMailOnClerkMail() { - return (bool)((int)$this->toProperty()->scope->preferences->client->adminMailOnMailSent->get()); + return (bool) ((int) $this->toProperty()->scope->preferences->client->adminMailOnMailSent->get()); } public function withUpdatedData($requestData, \DateTimeInterface $dateTime, $scope = null, $notice = '') @@ -248,7 +267,7 @@ public function getAppointments() if (!$this['appointments'] instanceof Collection\AppointmentList) { $this['appointments'] = new Collection\AppointmentList($this['appointments']); foreach ($this['appointments'] as $index => $appointment) { - if (! $appointment instanceof Appointment) { + if (!$appointment instanceof Appointment) { $this['appointments'][$index] = new Appointment($appointment); } } @@ -265,7 +284,7 @@ public function getClients() if (!$this['clients'] instanceof Collection\ClientList) { $this['clients'] = new Collection\ClientList($this['clients']); foreach ($this['clients'] as $index => $client) { - if (! $client instanceof Client) { + if (!$client instanceof Client) { $this['clients'][$index] = new Client($client); } } @@ -488,7 +507,7 @@ public function withLessData(array $keepArray = []) { $entity = clone $this; - if (! in_array('availability', $keepArray)) { + if (!in_array('availability', $keepArray)) { foreach ($entity['appointments'] as $appointment) { if ($appointment->toProperty()->scope->isAvailable()) { $scopeId = $appointment['scope']['id']; @@ -513,36 +532,26 @@ public function withLessData(array $keepArray = []) if ($entity->status == 'free') { // delete keys - foreach ([ - 'authKey', - 'queue', - 'requests', - ] as $key) { - if (! in_array($key, $keepArray) && $entity->toProperty()->$key->isAvailable()) { + foreach (['authKey', 'queue', 'requests',] as $key) { + if (!in_array($key, $keepArray) && $entity->toProperty()->$key->isAvailable()) { unset($entity[$key]); } } // delete if empty - foreach ([ - 'amendment', - 'id', - 'authKey', - 'archiveId', - 'reminderTimestamp', - ] as $key) { - if (! in_array($key, $keepArray) && $entity->toProperty()->$key->isAvailable() && !$entity[$key]) { + foreach (['amendment', 'id', 'authKey', 'archiveId', 'reminderTimestamp',] as $key) { + if (!in_array($key, $keepArray) && $entity->toProperty()->$key->isAvailable() && !$entity[$key]) { unset($entity[$key]); } } - if (! in_array('provider', $keepArray) && $entity->toProperty()->scope->provider->data->isAvailable()) { + if (!in_array('provider', $keepArray) && $entity->toProperty()->scope->provider->data->isAvailable()) { unset($entity['scope']['provider']['data']); } } - if (! in_array('dayoff', $keepArray) && $entity->toProperty()->scope->dayoff->isAvailable()) { + if (!in_array('dayoff', $keepArray) && $entity->toProperty()->scope->dayoff->isAvailable()) { unset($entity['scope']['dayoff']); } - if (! in_array('scope', $keepArray) && $entity->toProperty()->scope->preferences->isAvailable()) { + if (!in_array('scope', $keepArray) && $entity->toProperty()->scope->preferences->isAvailable()) { unset($entity['scope']['preferences']); } return $entity; @@ -659,11 +668,11 @@ public function __toString() { $string = "process#"; $string .= $this->id ?: $this->archiveId; - $string .= ":".$this->authKey; + $string .= ":" . $this->authKey; $string .= " (" . $this->status . ")"; $string .= " " . $this->getFirstAppointment()->toDateTime()->format('c'); $string .= " " . ($this->isWithAppointment() ? "appoint" : "arrival:" . $this->getArrivalTime()->format('c')); - $string .= " " . $this->getFirstAppointment()->slotCount."slots"; + $string .= " " . $this->getFirstAppointment()->slotCount . "slots"; $string .= "*" . count($this->appointments); foreach ($this->getRequests() as $request) { $string .= " " . $request['source'] . "." . $request['id']; From b97212b34d1d9e6ecc31af24a6043c2fece6aa16 Mon Sep 17 00:00:00 2001 From: DDEV User Date: Mon, 16 Dec 2024 14:10:37 +0100 Subject: [PATCH 2/6] feat(MPDZB): Refactor part 1 --- .../src/Zmscitizenapi/AppointmentGet.php | 4 +- .../src/Zmscitizenapi/AppointmentUpdate.php | 39 ++-- .../Zmscitizenapi/Helper/UtilityHelper.php | 2 + .../src/Zmscitizenapi/Models/Appointment.php | 19 ++ .../Services/ValidationService.php | 4 +- .../Services/ZmsApiClientService.php | 25 +-- .../Zmscitizenapi/AppointmentGetTest.php | 18 +- .../Zmscitizenapi/AppointmentReserveTest.php | 2 +- .../Zmscitizenapi/AppointmentUpdateTest.php | 198 +++++++++--------- 9 files changed, 160 insertions(+), 151 deletions(-) create mode 100644 zmscitizenapi/src/Zmscitizenapi/Models/Appointment.php diff --git a/zmscitizenapi/src/Zmscitizenapi/AppointmentGet.php b/zmscitizenapi/src/Zmscitizenapi/AppointmentGet.php index 13c25042c..e93404f5f 100644 --- a/zmscitizenapi/src/Zmscitizenapi/AppointmentGet.php +++ b/zmscitizenapi/src/Zmscitizenapi/AppointmentGet.php @@ -12,12 +12,12 @@ class AppointmentGet extends BaseController public function readResponse(RequestInterface $request, ResponseInterface $response, array $args): ResponseInterface { $queryParams = $request->getQueryParams(); - $processId = isset($queryParams['processId']) && is_numeric($queryParams['processId']) ? (int)$queryParams['processId'] : null; + $processId = isset($queryParams['id']) && is_numeric($queryParams['id']) ? (int)$queryParams['id'] : null; $authKey = isset($queryParams['authKey']) && is_string($queryParams['authKey']) && trim($queryParams['authKey']) !== '' ? $queryParams['authKey'] : null; $result = ZmsApiFacadeService::getProcessById($processId, $authKey); - return $this->createJsonResponse($response, $result ?? $result, $result['status']); + return $this->createJsonResponse($response, $result['data'] ?? $result, $result['status']); } } diff --git a/zmscitizenapi/src/Zmscitizenapi/AppointmentUpdate.php b/zmscitizenapi/src/Zmscitizenapi/AppointmentUpdate.php index e8c28d7fc..967e0672f 100644 --- a/zmscitizenapi/src/Zmscitizenapi/AppointmentUpdate.php +++ b/zmscitizenapi/src/Zmscitizenapi/AppointmentUpdate.php @@ -7,6 +7,7 @@ use \BO\Zmscitizenapi\Services\ValidationService; use \BO\Zmscitizenapi\Helper\UtilityHelper; use BO\Zmscitizenapi\Services\ExceptionService; +use \BO\Zmsentities\Client; use \BO\Zmsentities\Process; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; @@ -19,39 +20,47 @@ public function readResponse(RequestInterface $request, ResponseInterface $respo $request = $request instanceof ServerRequestInterface ? $request : null; $body = $request->getParsedBody(); - $processId = $body['processId'] ?? null; + $processId = $body['id'] ?? null; $authKey = $body['authKey'] ?? null; $familyName = $body['familyName'] ?? null; $email = $body['email'] ?? null; $telephone = $body['telephone'] ?? null; $customTextfield = $body['customTextfield'] ?? null; - + $errors = ValidationService::validateUpdateAppointmentInputs($processId, $authKey, $familyName, $email, $telephone, $customTextfield); if (!empty($errors['errors'])) { return $this->createJsonResponse($response, $errors, 400); } try { - $reservedProcess = ZmsApiFacadeService::getProcessById($processId, $authKey); if (!empty($reservedProcess['errors'])) { return $this->createJsonResponse($response, $reservedProcess, 404); } - error_log(json_encode($reservedProcess['data']['processId'])); - error_log(json_encode($reservedProcess['data']['email'])); - error_log(json_encode($reservedProcess['data']['familyName'])); - + $processEntity = new Process(); + $processEntity->id = $reservedProcess['data']['id'] ?? null; + $processEntity->authKey = $reservedProcess['data']['authKey'] ?? null; + $processEntity->appointments = $reservedProcess['data']['appointments'] ?? []; + $processEntity->clients = []; + $client = new \stdClass(); + $client->familyName = $familyName ?? $reservedProcess['data']['familyName'] ?? null; + $client->email = $email ?? $reservedProcess['data']['email'] ?? null; + $client->telephone = $telephone ?? $reservedProcess['data']['telephone'] ?? null; + $client->customTextfield = $customTextfield ?? $reservedProcess['data']['customTextfield'] ?? null; + $processEntity->clients[0] = $client; + $processEntity->scope = $reservedProcess['data']['scope'] ?? null; + $processEntity->lastChange = $reservedProcess['data']['lastChange'] ?? time(); - $reservedProcess['data']['familyName'] = $familyName; - $reservedProcess['data']['email'] = $email; - $reservedProcess['data']['telephone'] = $telephone; - $reservedProcess['data']['customTextfield'] = $customTextfield; - //$reservedProcess['data']['id'] = $processId; - - //error_log(json_encode($reservedProcess)); + if (isset($reservedProcess['data']['queue'])) { + $processEntity->queue = $reservedProcess['data']['queue']; + } + + $processEntity->createIP = $_SERVER['REMOTE_ADDR'] ?? '127.0.0.1'; + $processEntity->createTimestamp = time(); - $updatedProcess = ZmsApiFacadeService::updateClientData(Process::create($reservedProcess['data'])); + + $updatedProcess = ZmsApiFacadeService::updateClientData($processEntity); if (isset($updatedProcess['error']) && $updatedProcess['error'] === 'tooManyAppointmentsWithSameMail') { return $this->createJsonResponse($response, ExceptionService::tooManyAppointmentsWithSameMail(), 406); diff --git a/zmscitizenapi/src/Zmscitizenapi/Helper/UtilityHelper.php b/zmscitizenapi/src/Zmscitizenapi/Helper/UtilityHelper.php index 8f64cf485..ea8df4df7 100644 --- a/zmscitizenapi/src/Zmscitizenapi/Helper/UtilityHelper.php +++ b/zmscitizenapi/src/Zmscitizenapi/Helper/UtilityHelper.php @@ -1,6 +1,8 @@ 400, 'errorCode' => 'invalidProcessId', - 'errorMessage' => 'processId should be a 32-bit integer.', + 'errorMessage' => 'id should be a 32-bit integer.', ]; } @@ -343,7 +343,7 @@ public static function validateUpdateAppointmentInputs(?int $processId, ?string $errors[] = [ 'status' => 400, 'errorCode' => 'invalidProcessId', - 'errorMessage' => 'processId should be a positive 32-bit integer.', + 'errorMessage' => 'id should be a positive 32-bit integer.', ]; } diff --git a/zmscitizenapi/src/Zmscitizenapi/Services/ZmsApiClientService.php b/zmscitizenapi/src/Zmscitizenapi/Services/ZmsApiClientService.php index f389e6ae3..0dde8f076 100644 --- a/zmscitizenapi/src/Zmscitizenapi/Services/ZmsApiClientService.php +++ b/zmscitizenapi/src/Zmscitizenapi/Services/ZmsApiClientService.php @@ -141,32 +141,11 @@ public static function reserveTimeslot(Process $appointmentProcess, array $servi public static function submitClientData(Process $process): Process|array { - - error_log(json_encode($process)); - - $processEntity = new Process(); - $processEntity->id = $process->id ?? null; - $processEntity->authKey = $process->authKey ?? null; - $processEntity->appointments = $process->appointments ?? []; - $processEntity->clients = $process->clients ?? []; - $processEntity->scope = $process->scope ?? null; - $processEntity->customTextfield = $process->customTextfield ?? null; - $processEntity->lastChange = $process->lastChange ?? time(); - - if (isset($process->queue)) { - $processEntity->queue = $process->queue; - } - $processEntity->createIP = $_SERVER['REMOTE_ADDR'] ?? '127.0.0.1'; - $processEntity->createTimestamp = time(); - - $url = "/process/{$processEntity->id}/{$processEntity->authKey}/"; - - - error_log($url); + $url = "/process/{$process->id}/{$process->authKey}/"; try { - $result = \App::$http->readPostResult($url, $processEntity); + $result = \App::$http->readPostResult($url, $process); return $result->getEntity(); } catch (\Exception $e) { $exceptionName = json_decode(json_encode($e), true)['template'] ?? null; diff --git a/zmscitizenapi/tests/Zmscitizenapi/AppointmentGetTest.php b/zmscitizenapi/tests/Zmscitizenapi/AppointmentGetTest.php index 2e4b60bd8..bf3771497 100644 --- a/zmscitizenapi/tests/Zmscitizenapi/AppointmentGetTest.php +++ b/zmscitizenapi/tests/Zmscitizenapi/AppointmentGetTest.php @@ -24,14 +24,14 @@ public function testRendering() ); $parameters = [ - 'processId' => '101002', + 'id' => '101002', 'authKey' => 'fb43', ]; $response = $this->render([], $parameters, []); $responseBody = json_decode((string) $response->getBody(), true); $expectedResponse = [ - 'processId' => '101002', + 'id' => '101002', 'timestamp' => 1724907600, 'authKey' => 'fb43', 'familyName' => 'Doe', @@ -171,7 +171,7 @@ public function testMissingProcessId() [ 'status' => 400, 'errorCode' => 'invalidProcessId', - 'errorMessage' => 'processId should be a 32-bit integer.' + 'errorMessage' => 'id should be a 32-bit integer.' ] ], 'status' => 400 @@ -183,7 +183,7 @@ public function testMissingProcessId() public function testMissingAuthKey() { $parameters = [ - 'processId' => '101002', + 'id' => '101002', ]; $response = $this->render([], $parameters, []); @@ -205,7 +205,7 @@ public function testMissingAuthKey() public function testInvalidProcessId() { $parameters = [ - 'processId' => 'invalid', + 'id' => 'invalid', 'authKey' => 'fb43', ]; @@ -216,7 +216,7 @@ public function testInvalidProcessId() [ 'status' => 400, 'errorCode' => 'invalidProcessId', - 'errorMessage' => 'processId should be a 32-bit integer.' + 'errorMessage' => 'id should be a 32-bit integer.' ] ], 'status' => 400 @@ -228,7 +228,7 @@ public function testInvalidProcessId() public function testInvalidAuthKey() { $parameters = [ - 'processId' => '101002', + 'id' => '101002', 'authKey' => 12345, ]; @@ -259,7 +259,7 @@ public function testBothParametersMissing() [ 'status' => 400, 'errorCode' => 'invalidProcessId', - 'errorMessage' => 'processId should be a 32-bit integer.', + 'errorMessage' => 'id should be a 32-bit integer.', ], [ 'status' => 400, @@ -290,7 +290,7 @@ public function testAppointmentNotFound() ); $parameters = [ - 'processId' => '101002', + 'id' => '101002', 'authKey' => 'fb43', ]; diff --git a/zmscitizenapi/tests/Zmscitizenapi/AppointmentReserveTest.php b/zmscitizenapi/tests/Zmscitizenapi/AppointmentReserveTest.php index fa0798672..914b85b86 100644 --- a/zmscitizenapi/tests/Zmscitizenapi/AppointmentReserveTest.php +++ b/zmscitizenapi/tests/Zmscitizenapi/AppointmentReserveTest.php @@ -44,7 +44,7 @@ public function testRendering() $response = $this->render([], $parameters, [], 'POST'); $responseBody = json_decode((string) $response->getBody(), true); $expectedResponse = [ - 'processId' => '101002', + 'id' => '101002', 'timestamp' => 32526616522, 'authKey' => 'fb43', 'familyName' => 'Smith', diff --git a/zmscitizenapi/tests/Zmscitizenapi/AppointmentUpdateTest.php b/zmscitizenapi/tests/Zmscitizenapi/AppointmentUpdateTest.php index 057f94b84..7368dbf2f 100644 --- a/zmscitizenapi/tests/Zmscitizenapi/AppointmentUpdateTest.php +++ b/zmscitizenapi/tests/Zmscitizenapi/AppointmentUpdateTest.php @@ -28,7 +28,7 @@ public function testRendering() ); $parameters = [ - 'processId' => '101002', + 'id' => '101002', 'authKey' => 'fb43', 'familyName' => 'Smith', 'email' => "default@example.com", @@ -39,7 +39,7 @@ public function testRendering() $response = $this->render([], $parameters, [], 'POST'); $responseBody = json_decode((string) $response->getBody(), true); $expectedResponse = [ - "processId" => "101002", + "id" => "101002", "timestamp" => 1727865900, "authKey" => "fb43", "familyName" => "Smith", @@ -88,7 +88,7 @@ public function testTooManyEmailsAtLocation() ); $parameters = [ - 'processId' => '101002', + 'id' => '101002', 'authKey' => 'fb43', 'familyName' => 'Smith', 'email' => "default@example.com", @@ -129,7 +129,7 @@ public function testAppointmentNotFound() ); $parameters = [ - 'processId' => '101003', + 'id' => '101003', 'authKey' => 'fb43', 'familyName' => 'Smith', 'email' => "default@example.com", @@ -156,7 +156,7 @@ public function testAppointmentNotFound() public function testInvalidProcessid_InvalidAuthkey_InvalidFamilyname_InvalidEmail_InvalidTelephone_InvalidCustomtextfield() { $parameters = [ - 'processId' => null, + 'id' => null, 'authKey' => '', 'familyName' => '', 'email' => 'invalid-email', @@ -168,7 +168,7 @@ public function testInvalidProcessid_InvalidAuthkey_InvalidFamilyname_InvalidEma $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidAuthKey', 'errorMessage' => 'authKey should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidFamilyName', 'errorMessage' => 'familyName should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidEmail', 'errorMessage' => 'email should be a valid email address.'], @@ -185,7 +185,7 @@ public function testInvalidProcessid_InvalidAuthkey_InvalidFamilyname_InvalidEma public function testInvalidProcessid_InvalidAuthkey_InvalidFamilyname_InvalidEmail_InvalidTelephone_ValidCustomtextfield() { $parameters = [ - 'processId' => null, + 'id' => null, 'authKey' => '', 'familyName' => '', 'email' => 'invalid-email', @@ -197,7 +197,7 @@ public function testInvalidProcessid_InvalidAuthkey_InvalidFamilyname_InvalidEma $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidAuthKey', 'errorMessage' => 'authKey should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidFamilyName', 'errorMessage' => 'familyName should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidEmail', 'errorMessage' => 'email should be a valid email address.'], @@ -213,7 +213,7 @@ public function testInvalidProcessid_InvalidAuthkey_InvalidFamilyname_InvalidEma public function testInvalidProcessid_InvalidAuthkey_InvalidFamilyname_InvalidEmail_ValidTelephone_InvalidCustomtextfield() { $parameters = [ - 'processId' => null, + 'id' => null, 'authKey' => '', 'familyName' => '', 'email' => 'invalid-email', @@ -225,7 +225,7 @@ public function testInvalidProcessid_InvalidAuthkey_InvalidFamilyname_InvalidEma $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidAuthKey', 'errorMessage' => 'authKey should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidFamilyName', 'errorMessage' => 'familyName should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidEmail', 'errorMessage' => 'email should be a valid email address.'], @@ -241,7 +241,7 @@ public function testInvalidProcessid_InvalidAuthkey_InvalidFamilyname_InvalidEma public function testInvalidProcessid_InvalidAuthkey_InvalidFamilyname_InvalidEmail_ValidTelephone_ValidCustomtextfield() { $parameters = [ - 'processId' => null, + 'id' => null, 'authKey' => '', 'familyName' => '', 'email' => 'invalid-email', @@ -253,7 +253,7 @@ public function testInvalidProcessid_InvalidAuthkey_InvalidFamilyname_InvalidEma $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidAuthKey', 'errorMessage' => 'authKey should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidFamilyName', 'errorMessage' => 'familyName should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidEmail', 'errorMessage' => 'email should be a valid email address.'] @@ -268,7 +268,7 @@ public function testInvalidProcessid_InvalidAuthkey_InvalidFamilyname_InvalidEma public function testInvalidProcessid_InvalidAuthkey_InvalidFamilyname_ValidEmail_InvalidTelephone_InvalidCustomtextfield() { $parameters = [ - 'processId' => null, + 'id' => null, 'authKey' => '', 'familyName' => '', 'email' => 'default@example.com', @@ -280,7 +280,7 @@ public function testInvalidProcessid_InvalidAuthkey_InvalidFamilyname_ValidEmail $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidAuthKey', 'errorMessage' => 'authKey should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidFamilyName', 'errorMessage' => 'familyName should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidTelephone', 'errorMessage' => 'telephone should be a numeric string between 7 and 15 digits.'], @@ -296,7 +296,7 @@ public function testInvalidProcessid_InvalidAuthkey_InvalidFamilyname_ValidEmail public function testInvalidProcessid_InvalidAuthkey_InvalidFamilyname_ValidEmail_InvalidTelephone_ValidCustomtextfield() { $parameters = [ - 'processId' => null, + 'id' => null, 'authKey' => '', 'familyName' => '', 'email' => 'default@example.com', @@ -308,7 +308,7 @@ public function testInvalidProcessid_InvalidAuthkey_InvalidFamilyname_ValidEmail $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidAuthKey', 'errorMessage' => 'authKey should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidFamilyName', 'errorMessage' => 'familyName should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidTelephone', 'errorMessage' => 'telephone should be a numeric string between 7 and 15 digits.'] @@ -323,7 +323,7 @@ public function testInvalidProcessid_InvalidAuthkey_InvalidFamilyname_ValidEmail public function testInvalidProcessid_InvalidAuthkey_InvalidFamilyname_ValidEmail_ValidTelephone_InvalidCustomtextfield() { $parameters = [ - 'processId' => null, + 'id' => null, 'authKey' => '', 'familyName' => '', 'email' => 'default@example.com', @@ -335,7 +335,7 @@ public function testInvalidProcessid_InvalidAuthkey_InvalidFamilyname_ValidEmail $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidAuthKey', 'errorMessage' => 'authKey should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidFamilyName', 'errorMessage' => 'familyName should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidCustomTextfield', 'errorMessage' => 'customTextfield should be a string.'] @@ -350,7 +350,7 @@ public function testInvalidProcessid_InvalidAuthkey_InvalidFamilyname_ValidEmail public function testInvalidProcessid_InvalidAuthkey_InvalidFamilyname_ValidEmail_ValidTelephone_ValidCustomtextfield() { $parameters = [ - 'processId' => null, + 'id' => null, 'authKey' => '', 'familyName' => '', 'email' => 'default@example.com', @@ -362,7 +362,7 @@ public function testInvalidProcessid_InvalidAuthkey_InvalidFamilyname_ValidEmail $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidAuthKey', 'errorMessage' => 'authKey should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidFamilyName', 'errorMessage' => 'familyName should be a non-empty string.'] ], @@ -376,7 +376,7 @@ public function testInvalidProcessid_InvalidAuthkey_InvalidFamilyname_ValidEmail public function testInvalidProcessid_InvalidAuthkey_ValidFamilyname_InvalidEmail_InvalidTelephone_InvalidCustomtextfield() { $parameters = [ - 'processId' => null, + 'id' => null, 'authKey' => '', 'familyName' => 'Smith', 'email' => 'invalid-email', @@ -388,7 +388,7 @@ public function testInvalidProcessid_InvalidAuthkey_ValidFamilyname_InvalidEmail $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidAuthKey', 'errorMessage' => 'authKey should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidEmail', 'errorMessage' => 'email should be a valid email address.'], ['status' => 400, 'errorCode' => 'invalidTelephone', 'errorMessage' => 'telephone should be a numeric string between 7 and 15 digits.'], @@ -404,7 +404,7 @@ public function testInvalidProcessid_InvalidAuthkey_ValidFamilyname_InvalidEmail public function testInvalidProcessid_InvalidAuthkey_ValidFamilyname_InvalidEmail_InvalidTelephone_ValidCustomtextfield() { $parameters = [ - 'processId' => null, + 'id' => null, 'authKey' => '', 'familyName' => 'Smith', 'email' => 'invalid-email', @@ -416,7 +416,7 @@ public function testInvalidProcessid_InvalidAuthkey_ValidFamilyname_InvalidEmail $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidAuthKey', 'errorMessage' => 'authKey should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidEmail', 'errorMessage' => 'email should be a valid email address.'], ['status' => 400, 'errorCode' => 'invalidTelephone', 'errorMessage' => 'telephone should be a numeric string between 7 and 15 digits.'] @@ -431,7 +431,7 @@ public function testInvalidProcessid_InvalidAuthkey_ValidFamilyname_InvalidEmail public function testInvalidProcessid_InvalidAuthkey_ValidFamilyname_InvalidEmail_ValidTelephone_InvalidCustomtextfield() { $parameters = [ - 'processId' => null, + 'id' => null, 'authKey' => '', 'familyName' => 'Smith', 'email' => 'invalid-email', @@ -443,7 +443,7 @@ public function testInvalidProcessid_InvalidAuthkey_ValidFamilyname_InvalidEmail $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidAuthKey', 'errorMessage' => 'authKey should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidEmail', 'errorMessage' => 'email should be a valid email address.'], ['status' => 400, 'errorCode' => 'invalidCustomTextfield', 'errorMessage' => 'customTextfield should be a string.'] @@ -458,7 +458,7 @@ public function testInvalidProcessid_InvalidAuthkey_ValidFamilyname_InvalidEmail public function testInvalidProcessid_InvalidAuthkey_ValidFamilyname_InvalidEmail_ValidTelephone_ValidCustomtextfield() { $parameters = [ - 'processId' => null, + 'id' => null, 'authKey' => '', 'familyName' => 'Smith', 'email' => 'invalid-email', @@ -470,7 +470,7 @@ public function testInvalidProcessid_InvalidAuthkey_ValidFamilyname_InvalidEmail $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidAuthKey', 'errorMessage' => 'authKey should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidEmail', 'errorMessage' => 'email should be a valid email address.'] ], @@ -484,7 +484,7 @@ public function testInvalidProcessid_InvalidAuthkey_ValidFamilyname_InvalidEmail public function testInvalidProcessid_InvalidAuthkey_ValidFamilyname_ValidEmail_InvalidTelephone_InvalidCustomtextfield() { $parameters = [ - 'processId' => null, + 'id' => null, 'authKey' => '', 'familyName' => 'Smith', 'email' => 'default@example.com', @@ -496,7 +496,7 @@ public function testInvalidProcessid_InvalidAuthkey_ValidFamilyname_ValidEmail_I $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidAuthKey', 'errorMessage' => 'authKey should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidTelephone', 'errorMessage' => 'telephone should be a numeric string between 7 and 15 digits.'], ['status' => 400, 'errorCode' => 'invalidCustomTextfield', 'errorMessage' => 'customTextfield should be a string.'] @@ -511,7 +511,7 @@ public function testInvalidProcessid_InvalidAuthkey_ValidFamilyname_ValidEmail_I public function testInvalidProcessid_InvalidAuthkey_ValidFamilyname_ValidEmail_InvalidTelephone_ValidCustomtextfield() { $parameters = [ - 'processId' => null, + 'id' => null, 'authKey' => '', 'familyName' => 'Smith', 'email' => 'default@example.com', @@ -523,7 +523,7 @@ public function testInvalidProcessid_InvalidAuthkey_ValidFamilyname_ValidEmail_I $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidAuthKey', 'errorMessage' => 'authKey should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidTelephone', 'errorMessage' => 'telephone should be a numeric string between 7 and 15 digits.'] ], @@ -537,7 +537,7 @@ public function testInvalidProcessid_InvalidAuthkey_ValidFamilyname_ValidEmail_I public function testInvalidProcessid_InvalidAuthkey_ValidFamilyname_ValidEmail_ValidTelephone_InvalidCustomtextfield() { $parameters = [ - 'processId' => null, + 'id' => null, 'authKey' => '', 'familyName' => 'Smith', 'email' => 'default@example.com', @@ -549,7 +549,7 @@ public function testInvalidProcessid_InvalidAuthkey_ValidFamilyname_ValidEmail_V $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidAuthKey', 'errorMessage' => 'authKey should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidCustomTextfield', 'errorMessage' => 'customTextfield should be a string.'] ], @@ -563,7 +563,7 @@ public function testInvalidProcessid_InvalidAuthkey_ValidFamilyname_ValidEmail_V public function testInvalidProcessid_InvalidAuthkey_ValidFamilyname_ValidEmail_ValidTelephone_ValidCustomtextfield() { $parameters = [ - 'processId' => null, + 'id' => null, 'authKey' => '', 'familyName' => 'Smith', 'email' => 'default@example.com', @@ -575,7 +575,7 @@ public function testInvalidProcessid_InvalidAuthkey_ValidFamilyname_ValidEmail_V $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidAuthKey', 'errorMessage' => 'authKey should be a non-empty string.'] ], 'status' => 400 @@ -588,7 +588,7 @@ public function testInvalidProcessid_InvalidAuthkey_ValidFamilyname_ValidEmail_V public function testInvalidProcessid_ValidAuthkey_InvalidFamilyname_InvalidEmail_InvalidTelephone_InvalidCustomtextfield() { $parameters = [ - 'processId' => null, + 'id' => null, 'authKey' => 'fb43', 'familyName' => '', 'email' => 'invalid-email', @@ -600,7 +600,7 @@ public function testInvalidProcessid_ValidAuthkey_InvalidFamilyname_InvalidEmail $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidFamilyName', 'errorMessage' => 'familyName should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidEmail', 'errorMessage' => 'email should be a valid email address.'], ['status' => 400, 'errorCode' => 'invalidTelephone', 'errorMessage' => 'telephone should be a numeric string between 7 and 15 digits.'], @@ -616,7 +616,7 @@ public function testInvalidProcessid_ValidAuthkey_InvalidFamilyname_InvalidEmail public function testInvalidProcessid_ValidAuthkey_InvalidFamilyname_InvalidEmail_InvalidTelephone_ValidCustomtextfield() { $parameters = [ - 'processId' => null, + 'id' => null, 'authKey' => 'fb43', 'familyName' => '', 'email' => 'invalid-email', @@ -628,7 +628,7 @@ public function testInvalidProcessid_ValidAuthkey_InvalidFamilyname_InvalidEmail $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidFamilyName', 'errorMessage' => 'familyName should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidEmail', 'errorMessage' => 'email should be a valid email address.'], ['status' => 400, 'errorCode' => 'invalidTelephone', 'errorMessage' => 'telephone should be a numeric string between 7 and 15 digits.'] @@ -643,7 +643,7 @@ public function testInvalidProcessid_ValidAuthkey_InvalidFamilyname_InvalidEmail public function testInvalidProcessid_ValidAuthkey_InvalidFamilyname_InvalidEmail_ValidTelephone_InvalidCustomtextfield() { $parameters = [ - 'processId' => null, + 'id' => null, 'authKey' => 'fb43', 'familyName' => '', 'email' => 'invalid-email', @@ -655,7 +655,7 @@ public function testInvalidProcessid_ValidAuthkey_InvalidFamilyname_InvalidEmail $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidFamilyName', 'errorMessage' => 'familyName should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidEmail', 'errorMessage' => 'email should be a valid email address.'], ['status' => 400, 'errorCode' => 'invalidCustomTextfield', 'errorMessage' => 'customTextfield should be a string.'] @@ -670,7 +670,7 @@ public function testInvalidProcessid_ValidAuthkey_InvalidFamilyname_InvalidEmail public function testInvalidProcessid_ValidAuthkey_InvalidFamilyname_InvalidEmail_ValidTelephone_ValidCustomtextfield() { $parameters = [ - 'processId' => null, + 'id' => null, 'authKey' => 'fb43', 'familyName' => '', 'email' => 'invalid-email', @@ -682,7 +682,7 @@ public function testInvalidProcessid_ValidAuthkey_InvalidFamilyname_InvalidEmail $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidFamilyName', 'errorMessage' => 'familyName should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidEmail', 'errorMessage' => 'email should be a valid email address.'] ], @@ -696,7 +696,7 @@ public function testInvalidProcessid_ValidAuthkey_InvalidFamilyname_InvalidEmail public function testInvalidProcessid_ValidAuthkey_InvalidFamilyname_ValidEmail_InvalidTelephone_InvalidCustomtextfield() { $parameters = [ - 'processId' => null, + 'id' => null, 'authKey' => 'fb43', 'familyName' => '', 'email' => 'default@example.com', @@ -708,7 +708,7 @@ public function testInvalidProcessid_ValidAuthkey_InvalidFamilyname_ValidEmail_I $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidFamilyName', 'errorMessage' => 'familyName should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidTelephone', 'errorMessage' => 'telephone should be a numeric string between 7 and 15 digits.'], ['status' => 400, 'errorCode' => 'invalidCustomTextfield', 'errorMessage' => 'customTextfield should be a string.'] @@ -723,7 +723,7 @@ public function testInvalidProcessid_ValidAuthkey_InvalidFamilyname_ValidEmail_I public function testInvalidProcessid_ValidAuthkey_InvalidFamilyname_ValidEmail_InvalidTelephone_ValidCustomtextfield() { $parameters = [ - 'processId' => null, + 'id' => null, 'authKey' => 'fb43', 'familyName' => '', 'email' => 'default@example.com', @@ -735,7 +735,7 @@ public function testInvalidProcessid_ValidAuthkey_InvalidFamilyname_ValidEmail_I $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidFamilyName', 'errorMessage' => 'familyName should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidTelephone', 'errorMessage' => 'telephone should be a numeric string between 7 and 15 digits.'] ], @@ -749,7 +749,7 @@ public function testInvalidProcessid_ValidAuthkey_InvalidFamilyname_ValidEmail_I public function testInvalidProcessid_ValidAuthkey_InvalidFamilyname_ValidEmail_ValidTelephone_InvalidCustomtextfield() { $parameters = [ - 'processId' => null, + 'id' => null, 'authKey' => 'fb43', 'familyName' => '', 'email' => 'default@example.com', @@ -761,7 +761,7 @@ public function testInvalidProcessid_ValidAuthkey_InvalidFamilyname_ValidEmail_V $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidFamilyName', 'errorMessage' => 'familyName should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidCustomTextfield', 'errorMessage' => 'customTextfield should be a string.'] ], @@ -775,7 +775,7 @@ public function testInvalidProcessid_ValidAuthkey_InvalidFamilyname_ValidEmail_V public function testInvalidProcessid_ValidAuthkey_InvalidFamilyname_ValidEmail_ValidTelephone_ValidCustomtextfield() { $parameters = [ - 'processId' => null, + 'id' => null, 'authKey' => 'fb43', 'familyName' => '', 'email' => 'default@example.com', @@ -787,7 +787,7 @@ public function testInvalidProcessid_ValidAuthkey_InvalidFamilyname_ValidEmail_V $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidFamilyName', 'errorMessage' => 'familyName should be a non-empty string.'] ], 'status' => 400 @@ -800,7 +800,7 @@ public function testInvalidProcessid_ValidAuthkey_InvalidFamilyname_ValidEmail_V public function testInvalidProcessid_ValidAuthkey_ValidFamilyname_InvalidEmail_InvalidTelephone_InvalidCustomtextfield() { $parameters = [ - 'processId' => null, + 'id' => null, 'authKey' => 'fb43', 'familyName' => 'Smith', 'email' => 'invalid-email', @@ -812,7 +812,7 @@ public function testInvalidProcessid_ValidAuthkey_ValidFamilyname_InvalidEmail_I $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidEmail', 'errorMessage' => 'email should be a valid email address.'], ['status' => 400, 'errorCode' => 'invalidTelephone', 'errorMessage' => 'telephone should be a numeric string between 7 and 15 digits.'], ['status' => 400, 'errorCode' => 'invalidCustomTextfield', 'errorMessage' => 'customTextfield should be a string.'] @@ -827,7 +827,7 @@ public function testInvalidProcessid_ValidAuthkey_ValidFamilyname_InvalidEmail_I public function testInvalidProcessid_ValidAuthkey_ValidFamilyname_InvalidEmail_InvalidTelephone_ValidCustomtextfield() { $parameters = [ - 'processId' => null, + 'id' => null, 'authKey' => 'fb43', 'familyName' => 'Smith', 'email' => 'invalid-email', @@ -839,7 +839,7 @@ public function testInvalidProcessid_ValidAuthkey_ValidFamilyname_InvalidEmail_I $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidEmail', 'errorMessage' => 'email should be a valid email address.'], ['status' => 400, 'errorCode' => 'invalidTelephone', 'errorMessage' => 'telephone should be a numeric string between 7 and 15 digits.'] ], @@ -853,7 +853,7 @@ public function testInvalidProcessid_ValidAuthkey_ValidFamilyname_InvalidEmail_I public function testInvalidProcessid_ValidAuthkey_ValidFamilyname_InvalidEmail_ValidTelephone_InvalidCustomtextfield() { $parameters = [ - 'processId' => null, + 'id' => null, 'authKey' => 'fb43', 'familyName' => 'Smith', 'email' => 'invalid-email', @@ -865,7 +865,7 @@ public function testInvalidProcessid_ValidAuthkey_ValidFamilyname_InvalidEmail_V $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidEmail', 'errorMessage' => 'email should be a valid email address.'], ['status' => 400, 'errorCode' => 'invalidCustomTextfield', 'errorMessage' => 'customTextfield should be a string.'] ], @@ -879,7 +879,7 @@ public function testInvalidProcessid_ValidAuthkey_ValidFamilyname_InvalidEmail_V public function testInvalidProcessid_ValidAuthkey_ValidFamilyname_InvalidEmail_ValidTelephone_ValidCustomtextfield() { $parameters = [ - 'processId' => null, + 'id' => null, 'authKey' => 'fb43', 'familyName' => 'Smith', 'email' => 'invalid-email', @@ -891,7 +891,7 @@ public function testInvalidProcessid_ValidAuthkey_ValidFamilyname_InvalidEmail_V $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidEmail', 'errorMessage' => 'email should be a valid email address.'] ], 'status' => 400 @@ -904,7 +904,7 @@ public function testInvalidProcessid_ValidAuthkey_ValidFamilyname_InvalidEmail_V public function testInvalidProcessid_ValidAuthkey_ValidFamilyname_ValidEmail_InvalidTelephone_InvalidCustomtextfield() { $parameters = [ - 'processId' => null, + 'id' => null, 'authKey' => 'fb43', 'familyName' => 'Smith', 'email' => 'default@example.com', @@ -916,7 +916,7 @@ public function testInvalidProcessid_ValidAuthkey_ValidFamilyname_ValidEmail_Inv $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidTelephone', 'errorMessage' => 'telephone should be a numeric string between 7 and 15 digits.'], ['status' => 400, 'errorCode' => 'invalidCustomTextfield', 'errorMessage' => 'customTextfield should be a string.'] ], @@ -930,7 +930,7 @@ public function testInvalidProcessid_ValidAuthkey_ValidFamilyname_ValidEmail_Inv public function testInvalidProcessid_ValidAuthkey_ValidFamilyname_ValidEmail_InvalidTelephone_ValidCustomtextfield() { $parameters = [ - 'processId' => null, + 'id' => null, 'authKey' => 'fb43', 'familyName' => 'Smith', 'email' => 'default@example.com', @@ -942,7 +942,7 @@ public function testInvalidProcessid_ValidAuthkey_ValidFamilyname_ValidEmail_Inv $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidTelephone', 'errorMessage' => 'telephone should be a numeric string between 7 and 15 digits.'] ], 'status' => 400 @@ -955,7 +955,7 @@ public function testInvalidProcessid_ValidAuthkey_ValidFamilyname_ValidEmail_Inv public function testInvalidProcessid_ValidAuthkey_ValidFamilyname_ValidEmail_ValidTelephone_InvalidCustomtextfield() { $parameters = [ - 'processId' => null, + 'id' => null, 'authKey' => 'fb43', 'familyName' => 'Smith', 'email' => 'default@example.com', @@ -967,7 +967,7 @@ public function testInvalidProcessid_ValidAuthkey_ValidFamilyname_ValidEmail_Val $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidCustomTextfield', 'errorMessage' => 'customTextfield should be a string.'] ], 'status' => 400 @@ -980,7 +980,7 @@ public function testInvalidProcessid_ValidAuthkey_ValidFamilyname_ValidEmail_Val public function testInvalidProcessid_ValidAuthkey_ValidFamilyname_ValidEmail_ValidTelephone_ValidCustomtextfield() { $parameters = [ - 'processId' => null, + 'id' => null, 'authKey' => 'fb43', 'familyName' => 'Smith', 'email' => 'default@example.com', @@ -992,7 +992,7 @@ public function testInvalidProcessid_ValidAuthkey_ValidFamilyname_ValidEmail_Val $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'] + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'] ], 'status' => 400 ]; @@ -1004,7 +1004,7 @@ public function testInvalidProcessid_ValidAuthkey_ValidFamilyname_ValidEmail_Val public function testValidProcessid_InvalidAuthkey_InvalidFamilyname_InvalidEmail_InvalidTelephone_InvalidCustomtextfield() { $parameters = [ - 'processId' => '101002', + 'id' => '101002', 'authKey' => '', 'familyName' => '', 'email' => 'invalid-email', @@ -1032,7 +1032,7 @@ public function testValidProcessid_InvalidAuthkey_InvalidFamilyname_InvalidEmail public function testValidProcessid_InvalidAuthkey_InvalidFamilyname_InvalidEmail_InvalidTelephone_ValidCustomtextfield() { $parameters = [ - 'processId' => '101002', + 'id' => '101002', 'authKey' => '', 'familyName' => '', 'email' => 'invalid-email', @@ -1059,7 +1059,7 @@ public function testValidProcessid_InvalidAuthkey_InvalidFamilyname_InvalidEmail public function testValidProcessid_InvalidAuthkey_InvalidFamilyname_InvalidEmail_ValidTelephone_InvalidCustomtextfield() { $parameters = [ - 'processId' => '101002', + 'id' => '101002', 'authKey' => '', 'familyName' => '', 'email' => 'invalid-email', @@ -1086,7 +1086,7 @@ public function testValidProcessid_InvalidAuthkey_InvalidFamilyname_InvalidEmail public function testValidProcessid_InvalidAuthkey_InvalidFamilyname_InvalidEmail_ValidTelephone_ValidCustomtextfield() { $parameters = [ - 'processId' => '101002', + 'id' => '101002', 'authKey' => '', 'familyName' => '', 'email' => 'invalid-email', @@ -1112,7 +1112,7 @@ public function testValidProcessid_InvalidAuthkey_InvalidFamilyname_InvalidEmail public function testValidProcessid_InvalidAuthkey_InvalidFamilyname_ValidEmail_InvalidTelephone_InvalidCustomtextfield() { $parameters = [ - 'processId' => '101002', + 'id' => '101002', 'authKey' => '', 'familyName' => '', 'email' => 'default@example.com', @@ -1139,7 +1139,7 @@ public function testValidProcessid_InvalidAuthkey_InvalidFamilyname_ValidEmail_I public function testValidProcessid_InvalidAuthkey_InvalidFamilyname_ValidEmail_InvalidTelephone_ValidCustomtextfield() { $parameters = [ - 'processId' => '101002', + 'id' => '101002', 'authKey' => '', 'familyName' => '', 'email' => 'default@example.com', @@ -1165,7 +1165,7 @@ public function testValidProcessid_InvalidAuthkey_InvalidFamilyname_ValidEmail_I public function testValidProcessid_InvalidAuthkey_InvalidFamilyname_ValidEmail_ValidTelephone_InvalidCustomtextfield() { $parameters = [ - 'processId' => '101002', + 'id' => '101002', 'authKey' => '', 'familyName' => '', 'email' => 'default@example.com', @@ -1191,7 +1191,7 @@ public function testValidProcessid_InvalidAuthkey_InvalidFamilyname_ValidEmail_V public function testValidProcessid_InvalidAuthkey_InvalidFamilyname_ValidEmail_ValidTelephone_ValidCustomtextfield() { $parameters = [ - 'processId' => '101002', + 'id' => '101002', 'authKey' => '', 'familyName' => '', 'email' => 'default@example.com', @@ -1216,7 +1216,7 @@ public function testValidProcessid_InvalidAuthkey_InvalidFamilyname_ValidEmail_V public function testValidProcessid_InvalidAuthkey_ValidFamilyname_InvalidEmail_InvalidTelephone_InvalidCustomtextfield() { $parameters = [ - 'processId' => '101002', + 'id' => '101002', 'authKey' => '', 'familyName' => 'Smith', 'email' => 'invalid-email', @@ -1243,7 +1243,7 @@ public function testValidProcessid_InvalidAuthkey_ValidFamilyname_InvalidEmail_I public function testValidProcessid_InvalidAuthkey_ValidFamilyname_InvalidEmail_InvalidTelephone_ValidCustomtextfield() { $parameters = [ - 'processId' => '101002', + 'id' => '101002', 'authKey' => '', 'familyName' => 'Smith', 'email' => 'invalid-email', @@ -1269,7 +1269,7 @@ public function testValidProcessid_InvalidAuthkey_ValidFamilyname_InvalidEmail_I public function testValidProcessid_InvalidAuthkey_ValidFamilyname_InvalidEmail_ValidTelephone_InvalidCustomtextfield() { $parameters = [ - 'processId' => '101002', + 'id' => '101002', 'authKey' => '', 'familyName' => 'Smith', 'email' => 'invalid-email', @@ -1295,7 +1295,7 @@ public function testValidProcessid_InvalidAuthkey_ValidFamilyname_InvalidEmail_V public function testValidProcessid_InvalidAuthkey_ValidFamilyname_InvalidEmail_ValidTelephone_ValidCustomtextfield() { $parameters = [ - 'processId' => '101002', + 'id' => '101002', 'authKey' => '', 'familyName' => 'Smith', 'email' => 'invalid-email', @@ -1320,7 +1320,7 @@ public function testValidProcessid_InvalidAuthkey_ValidFamilyname_InvalidEmail_V public function testValidProcessid_InvalidAuthkey_ValidFamilyname_ValidEmail_InvalidTelephone_InvalidCustomtextfield() { $parameters = [ - 'processId' => '101002', + 'id' => '101002', 'authKey' => '', 'familyName' => 'Smith', 'email' => 'default@example.com', @@ -1346,7 +1346,7 @@ public function testValidProcessid_InvalidAuthkey_ValidFamilyname_ValidEmail_Inv public function testValidProcessid_InvalidAuthkey_ValidFamilyname_ValidEmail_InvalidTelephone_ValidCustomtextfield() { $parameters = [ - 'processId' => '101002', + 'id' => '101002', 'authKey' => '', 'familyName' => 'Smith', 'email' => 'default@example.com', @@ -1371,7 +1371,7 @@ public function testValidProcessid_InvalidAuthkey_ValidFamilyname_ValidEmail_Inv public function testValidProcessid_InvalidAuthkey_ValidFamilyname_ValidEmail_ValidTelephone_InvalidCustomtextfield() { $parameters = [ - 'processId' => '101002', + 'id' => '101002', 'authKey' => '', 'familyName' => 'Smith', 'email' => 'default@example.com', @@ -1396,7 +1396,7 @@ public function testValidProcessid_InvalidAuthkey_ValidFamilyname_ValidEmail_Val public function testValidProcessid_InvalidAuthkey_ValidFamilyname_ValidEmail_ValidTelephone_ValidCustomtextfield() { $parameters = [ - 'processId' => '101002', + 'id' => '101002', 'authKey' => '', 'familyName' => 'Smith', 'email' => 'default@example.com', @@ -1420,7 +1420,7 @@ public function testValidProcessid_InvalidAuthkey_ValidFamilyname_ValidEmail_Val public function testValidProcessid_ValidAuthkey_InvalidFamilyname_InvalidEmail_InvalidTelephone_InvalidCustomtextfield() { $parameters = [ - 'processId' => '101002', + 'id' => '101002', 'authKey' => 'fb43', 'familyName' => '', 'email' => 'invalid-email', @@ -1447,7 +1447,7 @@ public function testValidProcessid_ValidAuthkey_InvalidFamilyname_InvalidEmail_I public function testValidProcessid_ValidAuthkey_InvalidFamilyname_InvalidEmail_InvalidTelephone_ValidCustomtextfield() { $parameters = [ - 'processId' => '101002', + 'id' => '101002', 'authKey' => 'fb43', 'familyName' => '', 'email' => 'invalid-email', @@ -1473,7 +1473,7 @@ public function testValidProcessid_ValidAuthkey_InvalidFamilyname_InvalidEmail_I public function testValidProcessid_ValidAuthkey_InvalidFamilyname_InvalidEmail_ValidTelephone_InvalidCustomtextfield() { $parameters = [ - 'processId' => '101002', + 'id' => '101002', 'authKey' => 'fb43', 'familyName' => '', 'email' => 'invalid-email', @@ -1499,7 +1499,7 @@ public function testValidProcessid_ValidAuthkey_InvalidFamilyname_InvalidEmail_V public function testValidProcessid_ValidAuthkey_InvalidFamilyname_InvalidEmail_ValidTelephone_ValidCustomtextfield() { $parameters = [ - 'processId' => '101002', + 'id' => '101002', 'authKey' => 'fb43', 'familyName' => '', 'email' => 'invalid-email', @@ -1524,7 +1524,7 @@ public function testValidProcessid_ValidAuthkey_InvalidFamilyname_InvalidEmail_V public function testValidProcessid_ValidAuthkey_InvalidFamilyname_ValidEmail_InvalidTelephone_InvalidCustomtextfield() { $parameters = [ - 'processId' => '101002', + 'id' => '101002', 'authKey' => 'fb43', 'familyName' => '', 'email' => 'default@example.com', @@ -1550,7 +1550,7 @@ public function testValidProcessid_ValidAuthkey_InvalidFamilyname_ValidEmail_Inv public function testValidProcessid_ValidAuthkey_InvalidFamilyname_ValidEmail_InvalidTelephone_ValidCustomtextfield() { $parameters = [ - 'processId' => '101002', + 'id' => '101002', 'authKey' => 'fb43', 'familyName' => '', 'email' => 'default@example.com', @@ -1575,7 +1575,7 @@ public function testValidProcessid_ValidAuthkey_InvalidFamilyname_ValidEmail_Inv public function testValidProcessid_ValidAuthkey_InvalidFamilyname_ValidEmail_ValidTelephone_InvalidCustomtextfield() { $parameters = [ - 'processId' => '101002', + 'id' => '101002', 'authKey' => 'fb43', 'familyName' => '', 'email' => 'default@example.com', @@ -1600,7 +1600,7 @@ public function testValidProcessid_ValidAuthkey_InvalidFamilyname_ValidEmail_Val public function testValidProcessid_ValidAuthkey_InvalidFamilyname_ValidEmail_ValidTelephone_ValidCustomtextfield() { $parameters = [ - 'processId' => '101002', + 'id' => '101002', 'authKey' => 'fb43', 'familyName' => '', 'email' => 'default@example.com', @@ -1624,7 +1624,7 @@ public function testValidProcessid_ValidAuthkey_InvalidFamilyname_ValidEmail_Val public function testValidProcessid_ValidAuthkey_ValidFamilyname_InvalidEmail_InvalidTelephone_InvalidCustomtextfield() { $parameters = [ - 'processId' => '101002', + 'id' => '101002', 'authKey' => 'fb43', 'familyName' => 'Smith', 'email' => 'invalid-email', @@ -1650,7 +1650,7 @@ public function testValidProcessid_ValidAuthkey_ValidFamilyname_InvalidEmail_Inv public function testValidProcessid_ValidAuthkey_ValidFamilyname_InvalidEmail_InvalidTelephone_ValidCustomtextfield() { $parameters = [ - 'processId' => '101002', + 'id' => '101002', 'authKey' => 'fb43', 'familyName' => 'Smith', 'email' => 'invalid-email', @@ -1675,7 +1675,7 @@ public function testValidProcessid_ValidAuthkey_ValidFamilyname_InvalidEmail_Inv public function testValidProcessid_ValidAuthkey_ValidFamilyname_InvalidEmail_ValidTelephone_InvalidCustomtextfield() { $parameters = [ - 'processId' => '101002', + 'id' => '101002', 'authKey' => 'fb43', 'familyName' => 'Smith', 'email' => 'invalid-email', @@ -1700,7 +1700,7 @@ public function testValidProcessid_ValidAuthkey_ValidFamilyname_InvalidEmail_Val public function testValidProcessid_ValidAuthkey_ValidFamilyname_InvalidEmail_ValidTelephone_ValidCustomtextfield() { $parameters = [ - 'processId' => '101002', + 'id' => '101002', 'authKey' => 'fb43', 'familyName' => 'Smith', 'email' => 'invalid-email', @@ -1724,7 +1724,7 @@ public function testValidProcessid_ValidAuthkey_ValidFamilyname_InvalidEmail_Val public function testValidProcessid_ValidAuthkey_ValidFamilyname_ValidEmail_InvalidTelephone_InvalidCustomtextfield() { $parameters = [ - 'processId' => '101002', + 'id' => '101002', 'authKey' => 'fb43', 'familyName' => 'Smith', 'email' => 'default@example.com', @@ -1749,7 +1749,7 @@ public function testValidProcessid_ValidAuthkey_ValidFamilyname_ValidEmail_Inval public function testValidProcessid_ValidAuthkey_ValidFamilyname_ValidEmail_InvalidTelephone_ValidCustomtextfield() { $parameters = [ - 'processId' => '101002', + 'id' => '101002', 'authKey' => 'fb43', 'familyName' => 'Smith', 'email' => 'default@example.com', @@ -1773,7 +1773,7 @@ public function testValidProcessid_ValidAuthkey_ValidFamilyname_ValidEmail_Inval public function testValidProcessid_ValidAuthkey_ValidFamilyname_ValidEmail_ValidTelephone_InvalidCustomtextfield() { $parameters = [ - 'processId' => '101002', + 'id' => '101002', 'authKey' => 'fb43', 'familyName' => 'Smith', 'email' => 'default@example.com', From f122e4cbf57a9a52d6ae117c9e5bfe7106e4accd Mon Sep 17 00:00:00 2001 From: Thomas Fink Date: Mon, 16 Dec 2024 14:13:15 +0100 Subject: [PATCH 3/6] feat(MPDZB): Refactor part 1 --- zmsentities/src/Zmsentities/Process.php | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/zmsentities/src/Zmsentities/Process.php b/zmsentities/src/Zmsentities/Process.php index 3d26e61a6..0692bca58 100644 --- a/zmsentities/src/Zmsentities/Process.php +++ b/zmsentities/src/Zmsentities/Process.php @@ -33,25 +33,6 @@ class Process extends Schema\Entity public static $schema = "process.json"; - public static function create(array $data = []): self - { - $instance = new self(); - foreach ($data as $key => $value) { - if (property_exists($instance, $key)) { - $instance->$key = $value; - } - } - - $defaults = $instance->getDefaults(); - foreach ($defaults as $key => $defaultValue) { - if (!isset($instance->$key)) { - $instance->$key = $defaultValue; - } - } - - return $instance; - } - public function getDefaults() { return [ From cd670aaea6c0a948b07db6b8e5fc5d1bb826d62c Mon Sep 17 00:00:00 2001 From: Thomas Fink Date: Mon, 16 Dec 2024 14:35:57 +0100 Subject: [PATCH 4/6] feat(MPDZB-877): revert to processId in parameter --- .../src/Zmscitizenapi/AppointmentGet.php | 2 +- .../src/Zmscitizenapi/AppointmentUpdate.php | 6 +- .../Zmscitizenapi/Helper/UtilityHelper.php | 2 +- .../Services/ValidationService.php | 5 +- .../Services/ZmsApiClientService.php | 2 + .../Services/ZmsApiFacadeService.php | 1 - .../Zmscitizenapi/AppointmentGetTest.php | 18 +- .../Zmscitizenapi/AppointmentReserveTest.php | 2 +- .../Zmscitizenapi/AppointmentUpdateTest.php | 198 +++++++++--------- 9 files changed, 119 insertions(+), 117 deletions(-) diff --git a/zmscitizenapi/src/Zmscitizenapi/AppointmentGet.php b/zmscitizenapi/src/Zmscitizenapi/AppointmentGet.php index e93404f5f..71e29dbd1 100644 --- a/zmscitizenapi/src/Zmscitizenapi/AppointmentGet.php +++ b/zmscitizenapi/src/Zmscitizenapi/AppointmentGet.php @@ -12,7 +12,7 @@ class AppointmentGet extends BaseController public function readResponse(RequestInterface $request, ResponseInterface $response, array $args): ResponseInterface { $queryParams = $request->getQueryParams(); - $processId = isset($queryParams['id']) && is_numeric($queryParams['id']) ? (int)$queryParams['id'] : null; + $processId = isset($queryParams['processId']) && is_numeric($queryParams['processId']) ? (int)$queryParams['processId'] : null; $authKey = isset($queryParams['authKey']) && is_string($queryParams['authKey']) && trim($queryParams['authKey']) !== '' ? $queryParams['authKey'] : null; $result = ZmsApiFacadeService::getProcessById($processId, $authKey); diff --git a/zmscitizenapi/src/Zmscitizenapi/AppointmentUpdate.php b/zmscitizenapi/src/Zmscitizenapi/AppointmentUpdate.php index 967e0672f..e69962e83 100644 --- a/zmscitizenapi/src/Zmscitizenapi/AppointmentUpdate.php +++ b/zmscitizenapi/src/Zmscitizenapi/AppointmentUpdate.php @@ -20,13 +20,13 @@ public function readResponse(RequestInterface $request, ResponseInterface $respo $request = $request instanceof ServerRequestInterface ? $request : null; $body = $request->getParsedBody(); - $processId = $body['id'] ?? null; + $processId = $body['processId'] ?? null; $authKey = $body['authKey'] ?? null; $familyName = $body['familyName'] ?? null; $email = $body['email'] ?? null; $telephone = $body['telephone'] ?? null; $customTextfield = $body['customTextfield'] ?? null; - + $errors = ValidationService::validateUpdateAppointmentInputs($processId, $authKey, $familyName, $email, $telephone, $customTextfield); if (!empty($errors['errors'])) { return $this->createJsonResponse($response, $errors, 400); @@ -39,7 +39,7 @@ public function readResponse(RequestInterface $request, ResponseInterface $respo } $processEntity = new Process(); - $processEntity->id = $reservedProcess['data']['id'] ?? null; + $processEntity->id = $reservedProcess['data']['processId'] ?? null; $processEntity->authKey = $reservedProcess['data']['authKey'] ?? null; $processEntity->appointments = $reservedProcess['data']['appointments'] ?? []; $processEntity->clients = []; diff --git a/zmscitizenapi/src/Zmscitizenapi/Helper/UtilityHelper.php b/zmscitizenapi/src/Zmscitizenapi/Helper/UtilityHelper.php index ea8df4df7..32782e4e3 100644 --- a/zmscitizenapi/src/Zmscitizenapi/Helper/UtilityHelper.php +++ b/zmscitizenapi/src/Zmscitizenapi/Helper/UtilityHelper.php @@ -77,7 +77,7 @@ public static function getThinnedProcessData(Process $myProcess): array } return [ - 'id' => $myProcess->id, + 'processId' => $myProcess->id, 'timestamp' => isset($myProcess->appointments[0]) ? $myProcess->appointments[0]->date : null, 'authKey' => $myProcess->authKey ?? null, 'familyName' => isset($myProcess->clients[0]) ? $myProcess->clients[0]->familyName : null, diff --git a/zmscitizenapi/src/Zmscitizenapi/Services/ValidationService.php b/zmscitizenapi/src/Zmscitizenapi/Services/ValidationService.php index 68866bf29..2b4fe3625 100644 --- a/zmscitizenapi/src/Zmscitizenapi/Services/ValidationService.php +++ b/zmscitizenapi/src/Zmscitizenapi/Services/ValidationService.php @@ -67,7 +67,7 @@ public static function validateGetProcessById(?int $processId, ?string $authKey) $errors[] = [ 'status' => 400, 'errorCode' => 'invalidProcessId', - 'errorMessage' => 'id should be a 32-bit integer.', + 'errorMessage' => 'processId should be a positive 32-bit integer.', ]; } @@ -343,7 +343,8 @@ public static function validateUpdateAppointmentInputs(?int $processId, ?string $errors[] = [ 'status' => 400, 'errorCode' => 'invalidProcessId', - 'errorMessage' => 'id should be a positive 32-bit integer.', + 'errorMessage' => 'processId should be a positive 32-bit integer.', + //'errorMessage' => 'processId should be a positive 32-bit integer.', ]; } diff --git a/zmscitizenapi/src/Zmscitizenapi/Services/ZmsApiClientService.php b/zmscitizenapi/src/Zmscitizenapi/Services/ZmsApiClientService.php index 0dde8f076..4b875be16 100644 --- a/zmscitizenapi/src/Zmscitizenapi/Services/ZmsApiClientService.php +++ b/zmscitizenapi/src/Zmscitizenapi/Services/ZmsApiClientService.php @@ -143,6 +143,8 @@ public static function submitClientData(Process $process): Process|array { $url = "/process/{$process->id}/{$process->authKey}/"; + + error_log($url); try { $result = \App::$http->readPostResult($url, $process); diff --git a/zmscitizenapi/src/Zmscitizenapi/Services/ZmsApiFacadeService.php b/zmscitizenapi/src/Zmscitizenapi/Services/ZmsApiFacadeService.php index a42562185..df530ce03 100644 --- a/zmscitizenapi/src/Zmscitizenapi/Services/ZmsApiFacadeService.php +++ b/zmscitizenapi/src/Zmscitizenapi/Services/ZmsApiFacadeService.php @@ -586,7 +586,6 @@ public static function getProcessById(?int $processId, ?string $authKey): Proces } $responseData = UtilityHelper::getThinnedProcessData($process); - //$responseData = $process; return ['data' => $responseData, 'status' => 200]; diff --git a/zmscitizenapi/tests/Zmscitizenapi/AppointmentGetTest.php b/zmscitizenapi/tests/Zmscitizenapi/AppointmentGetTest.php index bf3771497..f14e31ae2 100644 --- a/zmscitizenapi/tests/Zmscitizenapi/AppointmentGetTest.php +++ b/zmscitizenapi/tests/Zmscitizenapi/AppointmentGetTest.php @@ -24,14 +24,14 @@ public function testRendering() ); $parameters = [ - 'id' => '101002', + 'processId' => '101002', 'authKey' => 'fb43', ]; $response = $this->render([], $parameters, []); $responseBody = json_decode((string) $response->getBody(), true); $expectedResponse = [ - 'id' => '101002', + 'processId' => '101002', 'timestamp' => 1724907600, 'authKey' => 'fb43', 'familyName' => 'Doe', @@ -171,7 +171,7 @@ public function testMissingProcessId() [ 'status' => 400, 'errorCode' => 'invalidProcessId', - 'errorMessage' => 'id should be a 32-bit integer.' + 'errorMessage' => 'processId should be a positive 32-bit integer.' ] ], 'status' => 400 @@ -183,7 +183,7 @@ public function testMissingProcessId() public function testMissingAuthKey() { $parameters = [ - 'id' => '101002', + 'processId' => '101002', ]; $response = $this->render([], $parameters, []); @@ -205,7 +205,7 @@ public function testMissingAuthKey() public function testInvalidProcessId() { $parameters = [ - 'id' => 'invalid', + 'processId' => 'invalid', 'authKey' => 'fb43', ]; @@ -216,7 +216,7 @@ public function testInvalidProcessId() [ 'status' => 400, 'errorCode' => 'invalidProcessId', - 'errorMessage' => 'id should be a 32-bit integer.' + 'errorMessage' => 'processId should be a positive 32-bit integer.' ] ], 'status' => 400 @@ -228,7 +228,7 @@ public function testInvalidProcessId() public function testInvalidAuthKey() { $parameters = [ - 'id' => '101002', + 'processId' => '101002', 'authKey' => 12345, ]; @@ -259,7 +259,7 @@ public function testBothParametersMissing() [ 'status' => 400, 'errorCode' => 'invalidProcessId', - 'errorMessage' => 'id should be a 32-bit integer.', + 'errorMessage' => 'processId should be a positive 32-bit integer.', ], [ 'status' => 400, @@ -290,7 +290,7 @@ public function testAppointmentNotFound() ); $parameters = [ - 'id' => '101002', + 'processId' => '101002', 'authKey' => 'fb43', ]; diff --git a/zmscitizenapi/tests/Zmscitizenapi/AppointmentReserveTest.php b/zmscitizenapi/tests/Zmscitizenapi/AppointmentReserveTest.php index 914b85b86..fa0798672 100644 --- a/zmscitizenapi/tests/Zmscitizenapi/AppointmentReserveTest.php +++ b/zmscitizenapi/tests/Zmscitizenapi/AppointmentReserveTest.php @@ -44,7 +44,7 @@ public function testRendering() $response = $this->render([], $parameters, [], 'POST'); $responseBody = json_decode((string) $response->getBody(), true); $expectedResponse = [ - 'id' => '101002', + 'processId' => '101002', 'timestamp' => 32526616522, 'authKey' => 'fb43', 'familyName' => 'Smith', diff --git a/zmscitizenapi/tests/Zmscitizenapi/AppointmentUpdateTest.php b/zmscitizenapi/tests/Zmscitizenapi/AppointmentUpdateTest.php index 7368dbf2f..057f94b84 100644 --- a/zmscitizenapi/tests/Zmscitizenapi/AppointmentUpdateTest.php +++ b/zmscitizenapi/tests/Zmscitizenapi/AppointmentUpdateTest.php @@ -28,7 +28,7 @@ public function testRendering() ); $parameters = [ - 'id' => '101002', + 'processId' => '101002', 'authKey' => 'fb43', 'familyName' => 'Smith', 'email' => "default@example.com", @@ -39,7 +39,7 @@ public function testRendering() $response = $this->render([], $parameters, [], 'POST'); $responseBody = json_decode((string) $response->getBody(), true); $expectedResponse = [ - "id" => "101002", + "processId" => "101002", "timestamp" => 1727865900, "authKey" => "fb43", "familyName" => "Smith", @@ -88,7 +88,7 @@ public function testTooManyEmailsAtLocation() ); $parameters = [ - 'id' => '101002', + 'processId' => '101002', 'authKey' => 'fb43', 'familyName' => 'Smith', 'email' => "default@example.com", @@ -129,7 +129,7 @@ public function testAppointmentNotFound() ); $parameters = [ - 'id' => '101003', + 'processId' => '101003', 'authKey' => 'fb43', 'familyName' => 'Smith', 'email' => "default@example.com", @@ -156,7 +156,7 @@ public function testAppointmentNotFound() public function testInvalidProcessid_InvalidAuthkey_InvalidFamilyname_InvalidEmail_InvalidTelephone_InvalidCustomtextfield() { $parameters = [ - 'id' => null, + 'processId' => null, 'authKey' => '', 'familyName' => '', 'email' => 'invalid-email', @@ -168,7 +168,7 @@ public function testInvalidProcessid_InvalidAuthkey_InvalidFamilyname_InvalidEma $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidAuthKey', 'errorMessage' => 'authKey should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidFamilyName', 'errorMessage' => 'familyName should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidEmail', 'errorMessage' => 'email should be a valid email address.'], @@ -185,7 +185,7 @@ public function testInvalidProcessid_InvalidAuthkey_InvalidFamilyname_InvalidEma public function testInvalidProcessid_InvalidAuthkey_InvalidFamilyname_InvalidEmail_InvalidTelephone_ValidCustomtextfield() { $parameters = [ - 'id' => null, + 'processId' => null, 'authKey' => '', 'familyName' => '', 'email' => 'invalid-email', @@ -197,7 +197,7 @@ public function testInvalidProcessid_InvalidAuthkey_InvalidFamilyname_InvalidEma $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidAuthKey', 'errorMessage' => 'authKey should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidFamilyName', 'errorMessage' => 'familyName should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidEmail', 'errorMessage' => 'email should be a valid email address.'], @@ -213,7 +213,7 @@ public function testInvalidProcessid_InvalidAuthkey_InvalidFamilyname_InvalidEma public function testInvalidProcessid_InvalidAuthkey_InvalidFamilyname_InvalidEmail_ValidTelephone_InvalidCustomtextfield() { $parameters = [ - 'id' => null, + 'processId' => null, 'authKey' => '', 'familyName' => '', 'email' => 'invalid-email', @@ -225,7 +225,7 @@ public function testInvalidProcessid_InvalidAuthkey_InvalidFamilyname_InvalidEma $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidAuthKey', 'errorMessage' => 'authKey should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidFamilyName', 'errorMessage' => 'familyName should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidEmail', 'errorMessage' => 'email should be a valid email address.'], @@ -241,7 +241,7 @@ public function testInvalidProcessid_InvalidAuthkey_InvalidFamilyname_InvalidEma public function testInvalidProcessid_InvalidAuthkey_InvalidFamilyname_InvalidEmail_ValidTelephone_ValidCustomtextfield() { $parameters = [ - 'id' => null, + 'processId' => null, 'authKey' => '', 'familyName' => '', 'email' => 'invalid-email', @@ -253,7 +253,7 @@ public function testInvalidProcessid_InvalidAuthkey_InvalidFamilyname_InvalidEma $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidAuthKey', 'errorMessage' => 'authKey should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidFamilyName', 'errorMessage' => 'familyName should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidEmail', 'errorMessage' => 'email should be a valid email address.'] @@ -268,7 +268,7 @@ public function testInvalidProcessid_InvalidAuthkey_InvalidFamilyname_InvalidEma public function testInvalidProcessid_InvalidAuthkey_InvalidFamilyname_ValidEmail_InvalidTelephone_InvalidCustomtextfield() { $parameters = [ - 'id' => null, + 'processId' => null, 'authKey' => '', 'familyName' => '', 'email' => 'default@example.com', @@ -280,7 +280,7 @@ public function testInvalidProcessid_InvalidAuthkey_InvalidFamilyname_ValidEmail $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidAuthKey', 'errorMessage' => 'authKey should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidFamilyName', 'errorMessage' => 'familyName should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidTelephone', 'errorMessage' => 'telephone should be a numeric string between 7 and 15 digits.'], @@ -296,7 +296,7 @@ public function testInvalidProcessid_InvalidAuthkey_InvalidFamilyname_ValidEmail public function testInvalidProcessid_InvalidAuthkey_InvalidFamilyname_ValidEmail_InvalidTelephone_ValidCustomtextfield() { $parameters = [ - 'id' => null, + 'processId' => null, 'authKey' => '', 'familyName' => '', 'email' => 'default@example.com', @@ -308,7 +308,7 @@ public function testInvalidProcessid_InvalidAuthkey_InvalidFamilyname_ValidEmail $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidAuthKey', 'errorMessage' => 'authKey should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidFamilyName', 'errorMessage' => 'familyName should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidTelephone', 'errorMessage' => 'telephone should be a numeric string between 7 and 15 digits.'] @@ -323,7 +323,7 @@ public function testInvalidProcessid_InvalidAuthkey_InvalidFamilyname_ValidEmail public function testInvalidProcessid_InvalidAuthkey_InvalidFamilyname_ValidEmail_ValidTelephone_InvalidCustomtextfield() { $parameters = [ - 'id' => null, + 'processId' => null, 'authKey' => '', 'familyName' => '', 'email' => 'default@example.com', @@ -335,7 +335,7 @@ public function testInvalidProcessid_InvalidAuthkey_InvalidFamilyname_ValidEmail $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidAuthKey', 'errorMessage' => 'authKey should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidFamilyName', 'errorMessage' => 'familyName should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidCustomTextfield', 'errorMessage' => 'customTextfield should be a string.'] @@ -350,7 +350,7 @@ public function testInvalidProcessid_InvalidAuthkey_InvalidFamilyname_ValidEmail public function testInvalidProcessid_InvalidAuthkey_InvalidFamilyname_ValidEmail_ValidTelephone_ValidCustomtextfield() { $parameters = [ - 'id' => null, + 'processId' => null, 'authKey' => '', 'familyName' => '', 'email' => 'default@example.com', @@ -362,7 +362,7 @@ public function testInvalidProcessid_InvalidAuthkey_InvalidFamilyname_ValidEmail $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidAuthKey', 'errorMessage' => 'authKey should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidFamilyName', 'errorMessage' => 'familyName should be a non-empty string.'] ], @@ -376,7 +376,7 @@ public function testInvalidProcessid_InvalidAuthkey_InvalidFamilyname_ValidEmail public function testInvalidProcessid_InvalidAuthkey_ValidFamilyname_InvalidEmail_InvalidTelephone_InvalidCustomtextfield() { $parameters = [ - 'id' => null, + 'processId' => null, 'authKey' => '', 'familyName' => 'Smith', 'email' => 'invalid-email', @@ -388,7 +388,7 @@ public function testInvalidProcessid_InvalidAuthkey_ValidFamilyname_InvalidEmail $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidAuthKey', 'errorMessage' => 'authKey should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidEmail', 'errorMessage' => 'email should be a valid email address.'], ['status' => 400, 'errorCode' => 'invalidTelephone', 'errorMessage' => 'telephone should be a numeric string between 7 and 15 digits.'], @@ -404,7 +404,7 @@ public function testInvalidProcessid_InvalidAuthkey_ValidFamilyname_InvalidEmail public function testInvalidProcessid_InvalidAuthkey_ValidFamilyname_InvalidEmail_InvalidTelephone_ValidCustomtextfield() { $parameters = [ - 'id' => null, + 'processId' => null, 'authKey' => '', 'familyName' => 'Smith', 'email' => 'invalid-email', @@ -416,7 +416,7 @@ public function testInvalidProcessid_InvalidAuthkey_ValidFamilyname_InvalidEmail $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidAuthKey', 'errorMessage' => 'authKey should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidEmail', 'errorMessage' => 'email should be a valid email address.'], ['status' => 400, 'errorCode' => 'invalidTelephone', 'errorMessage' => 'telephone should be a numeric string between 7 and 15 digits.'] @@ -431,7 +431,7 @@ public function testInvalidProcessid_InvalidAuthkey_ValidFamilyname_InvalidEmail public function testInvalidProcessid_InvalidAuthkey_ValidFamilyname_InvalidEmail_ValidTelephone_InvalidCustomtextfield() { $parameters = [ - 'id' => null, + 'processId' => null, 'authKey' => '', 'familyName' => 'Smith', 'email' => 'invalid-email', @@ -443,7 +443,7 @@ public function testInvalidProcessid_InvalidAuthkey_ValidFamilyname_InvalidEmail $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidAuthKey', 'errorMessage' => 'authKey should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidEmail', 'errorMessage' => 'email should be a valid email address.'], ['status' => 400, 'errorCode' => 'invalidCustomTextfield', 'errorMessage' => 'customTextfield should be a string.'] @@ -458,7 +458,7 @@ public function testInvalidProcessid_InvalidAuthkey_ValidFamilyname_InvalidEmail public function testInvalidProcessid_InvalidAuthkey_ValidFamilyname_InvalidEmail_ValidTelephone_ValidCustomtextfield() { $parameters = [ - 'id' => null, + 'processId' => null, 'authKey' => '', 'familyName' => 'Smith', 'email' => 'invalid-email', @@ -470,7 +470,7 @@ public function testInvalidProcessid_InvalidAuthkey_ValidFamilyname_InvalidEmail $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidAuthKey', 'errorMessage' => 'authKey should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidEmail', 'errorMessage' => 'email should be a valid email address.'] ], @@ -484,7 +484,7 @@ public function testInvalidProcessid_InvalidAuthkey_ValidFamilyname_InvalidEmail public function testInvalidProcessid_InvalidAuthkey_ValidFamilyname_ValidEmail_InvalidTelephone_InvalidCustomtextfield() { $parameters = [ - 'id' => null, + 'processId' => null, 'authKey' => '', 'familyName' => 'Smith', 'email' => 'default@example.com', @@ -496,7 +496,7 @@ public function testInvalidProcessid_InvalidAuthkey_ValidFamilyname_ValidEmail_I $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidAuthKey', 'errorMessage' => 'authKey should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidTelephone', 'errorMessage' => 'telephone should be a numeric string between 7 and 15 digits.'], ['status' => 400, 'errorCode' => 'invalidCustomTextfield', 'errorMessage' => 'customTextfield should be a string.'] @@ -511,7 +511,7 @@ public function testInvalidProcessid_InvalidAuthkey_ValidFamilyname_ValidEmail_I public function testInvalidProcessid_InvalidAuthkey_ValidFamilyname_ValidEmail_InvalidTelephone_ValidCustomtextfield() { $parameters = [ - 'id' => null, + 'processId' => null, 'authKey' => '', 'familyName' => 'Smith', 'email' => 'default@example.com', @@ -523,7 +523,7 @@ public function testInvalidProcessid_InvalidAuthkey_ValidFamilyname_ValidEmail_I $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidAuthKey', 'errorMessage' => 'authKey should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidTelephone', 'errorMessage' => 'telephone should be a numeric string between 7 and 15 digits.'] ], @@ -537,7 +537,7 @@ public function testInvalidProcessid_InvalidAuthkey_ValidFamilyname_ValidEmail_I public function testInvalidProcessid_InvalidAuthkey_ValidFamilyname_ValidEmail_ValidTelephone_InvalidCustomtextfield() { $parameters = [ - 'id' => null, + 'processId' => null, 'authKey' => '', 'familyName' => 'Smith', 'email' => 'default@example.com', @@ -549,7 +549,7 @@ public function testInvalidProcessid_InvalidAuthkey_ValidFamilyname_ValidEmail_V $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidAuthKey', 'errorMessage' => 'authKey should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidCustomTextfield', 'errorMessage' => 'customTextfield should be a string.'] ], @@ -563,7 +563,7 @@ public function testInvalidProcessid_InvalidAuthkey_ValidFamilyname_ValidEmail_V public function testInvalidProcessid_InvalidAuthkey_ValidFamilyname_ValidEmail_ValidTelephone_ValidCustomtextfield() { $parameters = [ - 'id' => null, + 'processId' => null, 'authKey' => '', 'familyName' => 'Smith', 'email' => 'default@example.com', @@ -575,7 +575,7 @@ public function testInvalidProcessid_InvalidAuthkey_ValidFamilyname_ValidEmail_V $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidAuthKey', 'errorMessage' => 'authKey should be a non-empty string.'] ], 'status' => 400 @@ -588,7 +588,7 @@ public function testInvalidProcessid_InvalidAuthkey_ValidFamilyname_ValidEmail_V public function testInvalidProcessid_ValidAuthkey_InvalidFamilyname_InvalidEmail_InvalidTelephone_InvalidCustomtextfield() { $parameters = [ - 'id' => null, + 'processId' => null, 'authKey' => 'fb43', 'familyName' => '', 'email' => 'invalid-email', @@ -600,7 +600,7 @@ public function testInvalidProcessid_ValidAuthkey_InvalidFamilyname_InvalidEmail $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidFamilyName', 'errorMessage' => 'familyName should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidEmail', 'errorMessage' => 'email should be a valid email address.'], ['status' => 400, 'errorCode' => 'invalidTelephone', 'errorMessage' => 'telephone should be a numeric string between 7 and 15 digits.'], @@ -616,7 +616,7 @@ public function testInvalidProcessid_ValidAuthkey_InvalidFamilyname_InvalidEmail public function testInvalidProcessid_ValidAuthkey_InvalidFamilyname_InvalidEmail_InvalidTelephone_ValidCustomtextfield() { $parameters = [ - 'id' => null, + 'processId' => null, 'authKey' => 'fb43', 'familyName' => '', 'email' => 'invalid-email', @@ -628,7 +628,7 @@ public function testInvalidProcessid_ValidAuthkey_InvalidFamilyname_InvalidEmail $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidFamilyName', 'errorMessage' => 'familyName should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidEmail', 'errorMessage' => 'email should be a valid email address.'], ['status' => 400, 'errorCode' => 'invalidTelephone', 'errorMessage' => 'telephone should be a numeric string between 7 and 15 digits.'] @@ -643,7 +643,7 @@ public function testInvalidProcessid_ValidAuthkey_InvalidFamilyname_InvalidEmail public function testInvalidProcessid_ValidAuthkey_InvalidFamilyname_InvalidEmail_ValidTelephone_InvalidCustomtextfield() { $parameters = [ - 'id' => null, + 'processId' => null, 'authKey' => 'fb43', 'familyName' => '', 'email' => 'invalid-email', @@ -655,7 +655,7 @@ public function testInvalidProcessid_ValidAuthkey_InvalidFamilyname_InvalidEmail $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidFamilyName', 'errorMessage' => 'familyName should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidEmail', 'errorMessage' => 'email should be a valid email address.'], ['status' => 400, 'errorCode' => 'invalidCustomTextfield', 'errorMessage' => 'customTextfield should be a string.'] @@ -670,7 +670,7 @@ public function testInvalidProcessid_ValidAuthkey_InvalidFamilyname_InvalidEmail public function testInvalidProcessid_ValidAuthkey_InvalidFamilyname_InvalidEmail_ValidTelephone_ValidCustomtextfield() { $parameters = [ - 'id' => null, + 'processId' => null, 'authKey' => 'fb43', 'familyName' => '', 'email' => 'invalid-email', @@ -682,7 +682,7 @@ public function testInvalidProcessid_ValidAuthkey_InvalidFamilyname_InvalidEmail $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidFamilyName', 'errorMessage' => 'familyName should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidEmail', 'errorMessage' => 'email should be a valid email address.'] ], @@ -696,7 +696,7 @@ public function testInvalidProcessid_ValidAuthkey_InvalidFamilyname_InvalidEmail public function testInvalidProcessid_ValidAuthkey_InvalidFamilyname_ValidEmail_InvalidTelephone_InvalidCustomtextfield() { $parameters = [ - 'id' => null, + 'processId' => null, 'authKey' => 'fb43', 'familyName' => '', 'email' => 'default@example.com', @@ -708,7 +708,7 @@ public function testInvalidProcessid_ValidAuthkey_InvalidFamilyname_ValidEmail_I $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidFamilyName', 'errorMessage' => 'familyName should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidTelephone', 'errorMessage' => 'telephone should be a numeric string between 7 and 15 digits.'], ['status' => 400, 'errorCode' => 'invalidCustomTextfield', 'errorMessage' => 'customTextfield should be a string.'] @@ -723,7 +723,7 @@ public function testInvalidProcessid_ValidAuthkey_InvalidFamilyname_ValidEmail_I public function testInvalidProcessid_ValidAuthkey_InvalidFamilyname_ValidEmail_InvalidTelephone_ValidCustomtextfield() { $parameters = [ - 'id' => null, + 'processId' => null, 'authKey' => 'fb43', 'familyName' => '', 'email' => 'default@example.com', @@ -735,7 +735,7 @@ public function testInvalidProcessid_ValidAuthkey_InvalidFamilyname_ValidEmail_I $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidFamilyName', 'errorMessage' => 'familyName should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidTelephone', 'errorMessage' => 'telephone should be a numeric string between 7 and 15 digits.'] ], @@ -749,7 +749,7 @@ public function testInvalidProcessid_ValidAuthkey_InvalidFamilyname_ValidEmail_I public function testInvalidProcessid_ValidAuthkey_InvalidFamilyname_ValidEmail_ValidTelephone_InvalidCustomtextfield() { $parameters = [ - 'id' => null, + 'processId' => null, 'authKey' => 'fb43', 'familyName' => '', 'email' => 'default@example.com', @@ -761,7 +761,7 @@ public function testInvalidProcessid_ValidAuthkey_InvalidFamilyname_ValidEmail_V $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidFamilyName', 'errorMessage' => 'familyName should be a non-empty string.'], ['status' => 400, 'errorCode' => 'invalidCustomTextfield', 'errorMessage' => 'customTextfield should be a string.'] ], @@ -775,7 +775,7 @@ public function testInvalidProcessid_ValidAuthkey_InvalidFamilyname_ValidEmail_V public function testInvalidProcessid_ValidAuthkey_InvalidFamilyname_ValidEmail_ValidTelephone_ValidCustomtextfield() { $parameters = [ - 'id' => null, + 'processId' => null, 'authKey' => 'fb43', 'familyName' => '', 'email' => 'default@example.com', @@ -787,7 +787,7 @@ public function testInvalidProcessid_ValidAuthkey_InvalidFamilyname_ValidEmail_V $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidFamilyName', 'errorMessage' => 'familyName should be a non-empty string.'] ], 'status' => 400 @@ -800,7 +800,7 @@ public function testInvalidProcessid_ValidAuthkey_InvalidFamilyname_ValidEmail_V public function testInvalidProcessid_ValidAuthkey_ValidFamilyname_InvalidEmail_InvalidTelephone_InvalidCustomtextfield() { $parameters = [ - 'id' => null, + 'processId' => null, 'authKey' => 'fb43', 'familyName' => 'Smith', 'email' => 'invalid-email', @@ -812,7 +812,7 @@ public function testInvalidProcessid_ValidAuthkey_ValidFamilyname_InvalidEmail_I $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidEmail', 'errorMessage' => 'email should be a valid email address.'], ['status' => 400, 'errorCode' => 'invalidTelephone', 'errorMessage' => 'telephone should be a numeric string between 7 and 15 digits.'], ['status' => 400, 'errorCode' => 'invalidCustomTextfield', 'errorMessage' => 'customTextfield should be a string.'] @@ -827,7 +827,7 @@ public function testInvalidProcessid_ValidAuthkey_ValidFamilyname_InvalidEmail_I public function testInvalidProcessid_ValidAuthkey_ValidFamilyname_InvalidEmail_InvalidTelephone_ValidCustomtextfield() { $parameters = [ - 'id' => null, + 'processId' => null, 'authKey' => 'fb43', 'familyName' => 'Smith', 'email' => 'invalid-email', @@ -839,7 +839,7 @@ public function testInvalidProcessid_ValidAuthkey_ValidFamilyname_InvalidEmail_I $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidEmail', 'errorMessage' => 'email should be a valid email address.'], ['status' => 400, 'errorCode' => 'invalidTelephone', 'errorMessage' => 'telephone should be a numeric string between 7 and 15 digits.'] ], @@ -853,7 +853,7 @@ public function testInvalidProcessid_ValidAuthkey_ValidFamilyname_InvalidEmail_I public function testInvalidProcessid_ValidAuthkey_ValidFamilyname_InvalidEmail_ValidTelephone_InvalidCustomtextfield() { $parameters = [ - 'id' => null, + 'processId' => null, 'authKey' => 'fb43', 'familyName' => 'Smith', 'email' => 'invalid-email', @@ -865,7 +865,7 @@ public function testInvalidProcessid_ValidAuthkey_ValidFamilyname_InvalidEmail_V $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidEmail', 'errorMessage' => 'email should be a valid email address.'], ['status' => 400, 'errorCode' => 'invalidCustomTextfield', 'errorMessage' => 'customTextfield should be a string.'] ], @@ -879,7 +879,7 @@ public function testInvalidProcessid_ValidAuthkey_ValidFamilyname_InvalidEmail_V public function testInvalidProcessid_ValidAuthkey_ValidFamilyname_InvalidEmail_ValidTelephone_ValidCustomtextfield() { $parameters = [ - 'id' => null, + 'processId' => null, 'authKey' => 'fb43', 'familyName' => 'Smith', 'email' => 'invalid-email', @@ -891,7 +891,7 @@ public function testInvalidProcessid_ValidAuthkey_ValidFamilyname_InvalidEmail_V $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidEmail', 'errorMessage' => 'email should be a valid email address.'] ], 'status' => 400 @@ -904,7 +904,7 @@ public function testInvalidProcessid_ValidAuthkey_ValidFamilyname_InvalidEmail_V public function testInvalidProcessid_ValidAuthkey_ValidFamilyname_ValidEmail_InvalidTelephone_InvalidCustomtextfield() { $parameters = [ - 'id' => null, + 'processId' => null, 'authKey' => 'fb43', 'familyName' => 'Smith', 'email' => 'default@example.com', @@ -916,7 +916,7 @@ public function testInvalidProcessid_ValidAuthkey_ValidFamilyname_ValidEmail_Inv $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidTelephone', 'errorMessage' => 'telephone should be a numeric string between 7 and 15 digits.'], ['status' => 400, 'errorCode' => 'invalidCustomTextfield', 'errorMessage' => 'customTextfield should be a string.'] ], @@ -930,7 +930,7 @@ public function testInvalidProcessid_ValidAuthkey_ValidFamilyname_ValidEmail_Inv public function testInvalidProcessid_ValidAuthkey_ValidFamilyname_ValidEmail_InvalidTelephone_ValidCustomtextfield() { $parameters = [ - 'id' => null, + 'processId' => null, 'authKey' => 'fb43', 'familyName' => 'Smith', 'email' => 'default@example.com', @@ -942,7 +942,7 @@ public function testInvalidProcessid_ValidAuthkey_ValidFamilyname_ValidEmail_Inv $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidTelephone', 'errorMessage' => 'telephone should be a numeric string between 7 and 15 digits.'] ], 'status' => 400 @@ -955,7 +955,7 @@ public function testInvalidProcessid_ValidAuthkey_ValidFamilyname_ValidEmail_Inv public function testInvalidProcessid_ValidAuthkey_ValidFamilyname_ValidEmail_ValidTelephone_InvalidCustomtextfield() { $parameters = [ - 'id' => null, + 'processId' => null, 'authKey' => 'fb43', 'familyName' => 'Smith', 'email' => 'default@example.com', @@ -967,7 +967,7 @@ public function testInvalidProcessid_ValidAuthkey_ValidFamilyname_ValidEmail_Val $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'], + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'], ['status' => 400, 'errorCode' => 'invalidCustomTextfield', 'errorMessage' => 'customTextfield should be a string.'] ], 'status' => 400 @@ -980,7 +980,7 @@ public function testInvalidProcessid_ValidAuthkey_ValidFamilyname_ValidEmail_Val public function testInvalidProcessid_ValidAuthkey_ValidFamilyname_ValidEmail_ValidTelephone_ValidCustomtextfield() { $parameters = [ - 'id' => null, + 'processId' => null, 'authKey' => 'fb43', 'familyName' => 'Smith', 'email' => 'default@example.com', @@ -992,7 +992,7 @@ public function testInvalidProcessid_ValidAuthkey_ValidFamilyname_ValidEmail_Val $expectedResponse = [ 'errors' => [ - ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'id should be a positive 32-bit integer.'] + ['status' => 400, 'errorCode' => 'invalidProcessId', 'errorMessage' => 'processId should be a positive 32-bit integer.'] ], 'status' => 400 ]; @@ -1004,7 +1004,7 @@ public function testInvalidProcessid_ValidAuthkey_ValidFamilyname_ValidEmail_Val public function testValidProcessid_InvalidAuthkey_InvalidFamilyname_InvalidEmail_InvalidTelephone_InvalidCustomtextfield() { $parameters = [ - 'id' => '101002', + 'processId' => '101002', 'authKey' => '', 'familyName' => '', 'email' => 'invalid-email', @@ -1032,7 +1032,7 @@ public function testValidProcessid_InvalidAuthkey_InvalidFamilyname_InvalidEmail public function testValidProcessid_InvalidAuthkey_InvalidFamilyname_InvalidEmail_InvalidTelephone_ValidCustomtextfield() { $parameters = [ - 'id' => '101002', + 'processId' => '101002', 'authKey' => '', 'familyName' => '', 'email' => 'invalid-email', @@ -1059,7 +1059,7 @@ public function testValidProcessid_InvalidAuthkey_InvalidFamilyname_InvalidEmail public function testValidProcessid_InvalidAuthkey_InvalidFamilyname_InvalidEmail_ValidTelephone_InvalidCustomtextfield() { $parameters = [ - 'id' => '101002', + 'processId' => '101002', 'authKey' => '', 'familyName' => '', 'email' => 'invalid-email', @@ -1086,7 +1086,7 @@ public function testValidProcessid_InvalidAuthkey_InvalidFamilyname_InvalidEmail public function testValidProcessid_InvalidAuthkey_InvalidFamilyname_InvalidEmail_ValidTelephone_ValidCustomtextfield() { $parameters = [ - 'id' => '101002', + 'processId' => '101002', 'authKey' => '', 'familyName' => '', 'email' => 'invalid-email', @@ -1112,7 +1112,7 @@ public function testValidProcessid_InvalidAuthkey_InvalidFamilyname_InvalidEmail public function testValidProcessid_InvalidAuthkey_InvalidFamilyname_ValidEmail_InvalidTelephone_InvalidCustomtextfield() { $parameters = [ - 'id' => '101002', + 'processId' => '101002', 'authKey' => '', 'familyName' => '', 'email' => 'default@example.com', @@ -1139,7 +1139,7 @@ public function testValidProcessid_InvalidAuthkey_InvalidFamilyname_ValidEmail_I public function testValidProcessid_InvalidAuthkey_InvalidFamilyname_ValidEmail_InvalidTelephone_ValidCustomtextfield() { $parameters = [ - 'id' => '101002', + 'processId' => '101002', 'authKey' => '', 'familyName' => '', 'email' => 'default@example.com', @@ -1165,7 +1165,7 @@ public function testValidProcessid_InvalidAuthkey_InvalidFamilyname_ValidEmail_I public function testValidProcessid_InvalidAuthkey_InvalidFamilyname_ValidEmail_ValidTelephone_InvalidCustomtextfield() { $parameters = [ - 'id' => '101002', + 'processId' => '101002', 'authKey' => '', 'familyName' => '', 'email' => 'default@example.com', @@ -1191,7 +1191,7 @@ public function testValidProcessid_InvalidAuthkey_InvalidFamilyname_ValidEmail_V public function testValidProcessid_InvalidAuthkey_InvalidFamilyname_ValidEmail_ValidTelephone_ValidCustomtextfield() { $parameters = [ - 'id' => '101002', + 'processId' => '101002', 'authKey' => '', 'familyName' => '', 'email' => 'default@example.com', @@ -1216,7 +1216,7 @@ public function testValidProcessid_InvalidAuthkey_InvalidFamilyname_ValidEmail_V public function testValidProcessid_InvalidAuthkey_ValidFamilyname_InvalidEmail_InvalidTelephone_InvalidCustomtextfield() { $parameters = [ - 'id' => '101002', + 'processId' => '101002', 'authKey' => '', 'familyName' => 'Smith', 'email' => 'invalid-email', @@ -1243,7 +1243,7 @@ public function testValidProcessid_InvalidAuthkey_ValidFamilyname_InvalidEmail_I public function testValidProcessid_InvalidAuthkey_ValidFamilyname_InvalidEmail_InvalidTelephone_ValidCustomtextfield() { $parameters = [ - 'id' => '101002', + 'processId' => '101002', 'authKey' => '', 'familyName' => 'Smith', 'email' => 'invalid-email', @@ -1269,7 +1269,7 @@ public function testValidProcessid_InvalidAuthkey_ValidFamilyname_InvalidEmail_I public function testValidProcessid_InvalidAuthkey_ValidFamilyname_InvalidEmail_ValidTelephone_InvalidCustomtextfield() { $parameters = [ - 'id' => '101002', + 'processId' => '101002', 'authKey' => '', 'familyName' => 'Smith', 'email' => 'invalid-email', @@ -1295,7 +1295,7 @@ public function testValidProcessid_InvalidAuthkey_ValidFamilyname_InvalidEmail_V public function testValidProcessid_InvalidAuthkey_ValidFamilyname_InvalidEmail_ValidTelephone_ValidCustomtextfield() { $parameters = [ - 'id' => '101002', + 'processId' => '101002', 'authKey' => '', 'familyName' => 'Smith', 'email' => 'invalid-email', @@ -1320,7 +1320,7 @@ public function testValidProcessid_InvalidAuthkey_ValidFamilyname_InvalidEmail_V public function testValidProcessid_InvalidAuthkey_ValidFamilyname_ValidEmail_InvalidTelephone_InvalidCustomtextfield() { $parameters = [ - 'id' => '101002', + 'processId' => '101002', 'authKey' => '', 'familyName' => 'Smith', 'email' => 'default@example.com', @@ -1346,7 +1346,7 @@ public function testValidProcessid_InvalidAuthkey_ValidFamilyname_ValidEmail_Inv public function testValidProcessid_InvalidAuthkey_ValidFamilyname_ValidEmail_InvalidTelephone_ValidCustomtextfield() { $parameters = [ - 'id' => '101002', + 'processId' => '101002', 'authKey' => '', 'familyName' => 'Smith', 'email' => 'default@example.com', @@ -1371,7 +1371,7 @@ public function testValidProcessid_InvalidAuthkey_ValidFamilyname_ValidEmail_Inv public function testValidProcessid_InvalidAuthkey_ValidFamilyname_ValidEmail_ValidTelephone_InvalidCustomtextfield() { $parameters = [ - 'id' => '101002', + 'processId' => '101002', 'authKey' => '', 'familyName' => 'Smith', 'email' => 'default@example.com', @@ -1396,7 +1396,7 @@ public function testValidProcessid_InvalidAuthkey_ValidFamilyname_ValidEmail_Val public function testValidProcessid_InvalidAuthkey_ValidFamilyname_ValidEmail_ValidTelephone_ValidCustomtextfield() { $parameters = [ - 'id' => '101002', + 'processId' => '101002', 'authKey' => '', 'familyName' => 'Smith', 'email' => 'default@example.com', @@ -1420,7 +1420,7 @@ public function testValidProcessid_InvalidAuthkey_ValidFamilyname_ValidEmail_Val public function testValidProcessid_ValidAuthkey_InvalidFamilyname_InvalidEmail_InvalidTelephone_InvalidCustomtextfield() { $parameters = [ - 'id' => '101002', + 'processId' => '101002', 'authKey' => 'fb43', 'familyName' => '', 'email' => 'invalid-email', @@ -1447,7 +1447,7 @@ public function testValidProcessid_ValidAuthkey_InvalidFamilyname_InvalidEmail_I public function testValidProcessid_ValidAuthkey_InvalidFamilyname_InvalidEmail_InvalidTelephone_ValidCustomtextfield() { $parameters = [ - 'id' => '101002', + 'processId' => '101002', 'authKey' => 'fb43', 'familyName' => '', 'email' => 'invalid-email', @@ -1473,7 +1473,7 @@ public function testValidProcessid_ValidAuthkey_InvalidFamilyname_InvalidEmail_I public function testValidProcessid_ValidAuthkey_InvalidFamilyname_InvalidEmail_ValidTelephone_InvalidCustomtextfield() { $parameters = [ - 'id' => '101002', + 'processId' => '101002', 'authKey' => 'fb43', 'familyName' => '', 'email' => 'invalid-email', @@ -1499,7 +1499,7 @@ public function testValidProcessid_ValidAuthkey_InvalidFamilyname_InvalidEmail_V public function testValidProcessid_ValidAuthkey_InvalidFamilyname_InvalidEmail_ValidTelephone_ValidCustomtextfield() { $parameters = [ - 'id' => '101002', + 'processId' => '101002', 'authKey' => 'fb43', 'familyName' => '', 'email' => 'invalid-email', @@ -1524,7 +1524,7 @@ public function testValidProcessid_ValidAuthkey_InvalidFamilyname_InvalidEmail_V public function testValidProcessid_ValidAuthkey_InvalidFamilyname_ValidEmail_InvalidTelephone_InvalidCustomtextfield() { $parameters = [ - 'id' => '101002', + 'processId' => '101002', 'authKey' => 'fb43', 'familyName' => '', 'email' => 'default@example.com', @@ -1550,7 +1550,7 @@ public function testValidProcessid_ValidAuthkey_InvalidFamilyname_ValidEmail_Inv public function testValidProcessid_ValidAuthkey_InvalidFamilyname_ValidEmail_InvalidTelephone_ValidCustomtextfield() { $parameters = [ - 'id' => '101002', + 'processId' => '101002', 'authKey' => 'fb43', 'familyName' => '', 'email' => 'default@example.com', @@ -1575,7 +1575,7 @@ public function testValidProcessid_ValidAuthkey_InvalidFamilyname_ValidEmail_Inv public function testValidProcessid_ValidAuthkey_InvalidFamilyname_ValidEmail_ValidTelephone_InvalidCustomtextfield() { $parameters = [ - 'id' => '101002', + 'processId' => '101002', 'authKey' => 'fb43', 'familyName' => '', 'email' => 'default@example.com', @@ -1600,7 +1600,7 @@ public function testValidProcessid_ValidAuthkey_InvalidFamilyname_ValidEmail_Val public function testValidProcessid_ValidAuthkey_InvalidFamilyname_ValidEmail_ValidTelephone_ValidCustomtextfield() { $parameters = [ - 'id' => '101002', + 'processId' => '101002', 'authKey' => 'fb43', 'familyName' => '', 'email' => 'default@example.com', @@ -1624,7 +1624,7 @@ public function testValidProcessid_ValidAuthkey_InvalidFamilyname_ValidEmail_Val public function testValidProcessid_ValidAuthkey_ValidFamilyname_InvalidEmail_InvalidTelephone_InvalidCustomtextfield() { $parameters = [ - 'id' => '101002', + 'processId' => '101002', 'authKey' => 'fb43', 'familyName' => 'Smith', 'email' => 'invalid-email', @@ -1650,7 +1650,7 @@ public function testValidProcessid_ValidAuthkey_ValidFamilyname_InvalidEmail_Inv public function testValidProcessid_ValidAuthkey_ValidFamilyname_InvalidEmail_InvalidTelephone_ValidCustomtextfield() { $parameters = [ - 'id' => '101002', + 'processId' => '101002', 'authKey' => 'fb43', 'familyName' => 'Smith', 'email' => 'invalid-email', @@ -1675,7 +1675,7 @@ public function testValidProcessid_ValidAuthkey_ValidFamilyname_InvalidEmail_Inv public function testValidProcessid_ValidAuthkey_ValidFamilyname_InvalidEmail_ValidTelephone_InvalidCustomtextfield() { $parameters = [ - 'id' => '101002', + 'processId' => '101002', 'authKey' => 'fb43', 'familyName' => 'Smith', 'email' => 'invalid-email', @@ -1700,7 +1700,7 @@ public function testValidProcessid_ValidAuthkey_ValidFamilyname_InvalidEmail_Val public function testValidProcessid_ValidAuthkey_ValidFamilyname_InvalidEmail_ValidTelephone_ValidCustomtextfield() { $parameters = [ - 'id' => '101002', + 'processId' => '101002', 'authKey' => 'fb43', 'familyName' => 'Smith', 'email' => 'invalid-email', @@ -1724,7 +1724,7 @@ public function testValidProcessid_ValidAuthkey_ValidFamilyname_InvalidEmail_Val public function testValidProcessid_ValidAuthkey_ValidFamilyname_ValidEmail_InvalidTelephone_InvalidCustomtextfield() { $parameters = [ - 'id' => '101002', + 'processId' => '101002', 'authKey' => 'fb43', 'familyName' => 'Smith', 'email' => 'default@example.com', @@ -1749,7 +1749,7 @@ public function testValidProcessid_ValidAuthkey_ValidFamilyname_ValidEmail_Inval public function testValidProcessid_ValidAuthkey_ValidFamilyname_ValidEmail_InvalidTelephone_ValidCustomtextfield() { $parameters = [ - 'id' => '101002', + 'processId' => '101002', 'authKey' => 'fb43', 'familyName' => 'Smith', 'email' => 'default@example.com', @@ -1773,7 +1773,7 @@ public function testValidProcessid_ValidAuthkey_ValidFamilyname_ValidEmail_Inval public function testValidProcessid_ValidAuthkey_ValidFamilyname_ValidEmail_ValidTelephone_InvalidCustomtextfield() { $parameters = [ - 'id' => '101002', + 'processId' => '101002', 'authKey' => 'fb43', 'familyName' => 'Smith', 'email' => 'default@example.com', From 263afa73328092c5be4e35e98c524147e16d0ca6 Mon Sep 17 00:00:00 2001 From: Thomas Fink Date: Mon, 16 Dec 2024 16:11:55 +0100 Subject: [PATCH 5/6] feat(MPDZBS-877): refactor thinned process to object --- .../public/doc/partials/definitions.yaml | 2 +- zmscitizenapi/routing.php | 12 +- .../src/Zmscitizenapi/AppointmentGet.php | 24 +++- .../src/Zmscitizenapi/AppointmentReserve.php | 9 +- .../src/Zmscitizenapi/AppointmentUpdate.php | 58 ++++----- .../Zmscitizenapi/Helper/UtilityHelper.php | 111 ++++++++++++++---- .../Models/AppointmentCancel.php | 19 +++ .../Models/AppointmentConfirm.php | 19 +++ .../Models/AppointmentPreConfirm.php | 19 +++ .../Models/AppointmentReserve.php | 19 +++ .../Models/AppointmentUpdate.php | 19 +++ .../Models/AvailableAppointments.php | 19 +++ .../Zmscitizenapi/Models/AvailableDays.php | 19 +++ .../Zmscitizenapi/Models/CaptchaDetails.php | 19 +++ .../Models/{Appointment.php => Offices.php} | 4 +- .../Models/OfficesAndServices.php | 19 +++ .../Zmscitizenapi/Models/OfficesByService.php | 19 +++ .../src/Zmscitizenapi/Models/Scope.php | 19 +++ .../src/Zmscitizenapi/Models/Scopes.php | 19 +++ .../src/Zmscitizenapi/Models/Services.php | 19 +++ .../Zmscitizenapi/Models/ServicesByOffice.php | 19 +++ .../Zmscitizenapi/Models/ThinnedProcess.php | 36 ++++++ .../Services/ZmsApiClientService.php | 2 - .../Services/ZmsApiFacadeService.php | 8 +- .../{appointment.json => thinnedProcess.json} | 0 25 files changed, 454 insertions(+), 78 deletions(-) create mode 100644 zmscitizenapi/src/Zmscitizenapi/Models/AppointmentCancel.php create mode 100644 zmscitizenapi/src/Zmscitizenapi/Models/AppointmentConfirm.php create mode 100644 zmscitizenapi/src/Zmscitizenapi/Models/AppointmentPreConfirm.php create mode 100644 zmscitizenapi/src/Zmscitizenapi/Models/AppointmentReserve.php create mode 100644 zmscitizenapi/src/Zmscitizenapi/Models/AppointmentUpdate.php create mode 100644 zmscitizenapi/src/Zmscitizenapi/Models/AvailableAppointments.php create mode 100644 zmscitizenapi/src/Zmscitizenapi/Models/AvailableDays.php create mode 100644 zmscitizenapi/src/Zmscitizenapi/Models/CaptchaDetails.php rename zmscitizenapi/src/Zmscitizenapi/Models/{Appointment.php => Offices.php} (70%) create mode 100644 zmscitizenapi/src/Zmscitizenapi/Models/OfficesAndServices.php create mode 100644 zmscitizenapi/src/Zmscitizenapi/Models/OfficesByService.php create mode 100644 zmscitizenapi/src/Zmscitizenapi/Models/Scope.php create mode 100644 zmscitizenapi/src/Zmscitizenapi/Models/Scopes.php create mode 100644 zmscitizenapi/src/Zmscitizenapi/Models/Services.php create mode 100644 zmscitizenapi/src/Zmscitizenapi/Models/ServicesByOffice.php create mode 100644 zmscitizenapi/src/Zmscitizenapi/Models/ThinnedProcess.php rename zmsentities/schema/citizenapi/{appointment.json => thinnedProcess.json} (100%) diff --git a/zmscitizenapi/public/doc/partials/definitions.yaml b/zmscitizenapi/public/doc/partials/definitions.yaml index 170621445..05902804f 100644 --- a/zmscitizenapi/public/doc/partials/definitions.yaml +++ b/zmscitizenapi/public/doc/partials/definitions.yaml @@ -1,6 +1,6 @@ definitions: appointment: - $ref: "schema/citizenapi/appointment.json" + $ref: "schema/citizenapi/thinnedProcess.json" appointmentCancel: $ref: "schema/citizenapi/appointmentCancel.json" appointmentConfirm: diff --git a/zmscitizenapi/routing.php b/zmscitizenapi/routing.php index 0c8d5fe44..7e71a09a1 100644 --- a/zmscitizenapi/routing.php +++ b/zmscitizenapi/routing.php @@ -294,7 +294,7 @@ * meta: * $ref: "schema/metaresult.json" * data: - * $ref: "schema/citizenapi/appointment.json" + * $ref: "schema/citizenapi/thinnedProcess.json" * 400: * description: Invalid input * schema: @@ -369,7 +369,7 @@ * meta: * $ref: "schema/metaresult.json" * data: - * $ref: "schema/citizenapi/appointment.json" + * $ref: "schema/citizenapi/thinnedProcess.json" * 400: * description: Invalid input * schema: @@ -420,7 +420,7 @@ * meta: * $ref: "schema/metaresult.json" * data: - * $ref: "schema/citizenapi/appointment.json" + * $ref: "schema/citizenapi/thinnedProcess.json" * 400: * description: Invalid input * schema: @@ -471,7 +471,7 @@ * meta: * $ref: "schema/metaresult.json" * data: - * $ref: "schema/citizenapi/appointment.json" + * $ref: "schema/citizenapi/thinnedProcess.json" * 400: * description: Invalid input * schema: @@ -522,7 +522,7 @@ * meta: * $ref: "schema/metaresult.json" * data: - * $ref: "schema/citizenapi/appointment.json" + * $ref: "schema/citizenapi/thinnedProcess.json" * 400: * description: Invalid input * schema: @@ -573,7 +573,7 @@ * meta: * $ref: "schema/metaresult.json" * data: - * $ref: "schema/citizenapi/appointment.json" + * $ref: "schema/citizenapi/thinnedProcess.json" * 400: * description: Invalid input * schema: diff --git a/zmscitizenapi/src/Zmscitizenapi/AppointmentGet.php b/zmscitizenapi/src/Zmscitizenapi/AppointmentGet.php index 71e29dbd1..62a34b691 100644 --- a/zmscitizenapi/src/Zmscitizenapi/AppointmentGet.php +++ b/zmscitizenapi/src/Zmscitizenapi/AppointmentGet.php @@ -3,9 +3,10 @@ namespace BO\Zmscitizenapi; use \BO\Zmscitizenapi\BaseController; -use Psr\Http\Message\RequestInterface; -use Psr\Http\Message\ResponseInterface; use \BO\Zmscitizenapi\Services\ZmsApiFacadeService; +use \BO\Zmscitizenapi\Models\ThinnedProcess; +use \Psr\Http\Message\RequestInterface; +use \Psr\Http\Message\ResponseInterface; class AppointmentGet extends BaseController { @@ -14,10 +15,21 @@ public function readResponse(RequestInterface $request, ResponseInterface $respo $queryParams = $request->getQueryParams(); $processId = isset($queryParams['processId']) && is_numeric($queryParams['processId']) ? (int)$queryParams['processId'] : null; $authKey = isset($queryParams['authKey']) && is_string($queryParams['authKey']) && trim($queryParams['authKey']) !== '' ? $queryParams['authKey'] : null; - - $result = ZmsApiFacadeService::getProcessById($processId, $authKey); - - return $this->createJsonResponse($response, $result['data'] ?? $result, $result['status']); + + $result = ZmsApiFacadeService::getThinnedProcessById($processId, $authKey); + + if (!empty($result['errors'])) { + $errorCodes = array_column($result['errors'], 'errorCode'); + $statusCode = in_array('appointmentNotFound', $errorCodes) ? 404 : 400; + return $this->createJsonResponse($response, $result, $statusCode); + } + + if (isset($result) && $result instanceof ThinnedProcess) { + $appointment = $result; + return $this->createJsonResponse($response, $appointment->toArray(), 200); + } + + return $this->createJsonResponse($response, $result, 400); } } diff --git a/zmscitizenapi/src/Zmscitizenapi/AppointmentReserve.php b/zmscitizenapi/src/Zmscitizenapi/AppointmentReserve.php index ace057fbb..43491109d 100644 --- a/zmscitizenapi/src/Zmscitizenapi/AppointmentReserve.php +++ b/zmscitizenapi/src/Zmscitizenapi/AppointmentReserve.php @@ -9,6 +9,7 @@ use \BO\Zmscitizenapi\Services\MapperService; use \BO\Zmscitizenapi\Services\ValidationService; use \BO\Zmscitizenapi\Services\ZmsApiFacadeService; +use \BO\Zmscitizenapi\Models\ThinnedProcess; use \BO\Zmsentities\Process; use \BO\Zmsentities\Scope; use \BO\Zmsentities\Collection\ProcessList; @@ -105,10 +106,12 @@ public function readResponse(RequestInterface $request, ResponseInterface $respo } } - $thinnedProcessData = UtilityHelper::getThinnedProcessData($reservedProcess); - $thinnedProcessData = array_merge($thinnedProcessData, ['officeId' => $officeId]); + $appointment = new ThinnedProcess(); + $appointment = UtilityHelper::processToThinnedProcess($reservedProcess); - return $this->createJsonResponse($response, $thinnedProcessData, 200); + $appointment = array_merge($appointment->toArray(), ['officeId' => $officeId]); + + return $this->createJsonResponse($response, $appointment, 200); } catch (\Exception $e) { return $this->createJsonResponse($response, [ diff --git a/zmscitizenapi/src/Zmscitizenapi/AppointmentUpdate.php b/zmscitizenapi/src/Zmscitizenapi/AppointmentUpdate.php index e69962e83..f9f077011 100644 --- a/zmscitizenapi/src/Zmscitizenapi/AppointmentUpdate.php +++ b/zmscitizenapi/src/Zmscitizenapi/AppointmentUpdate.php @@ -3,10 +3,11 @@ namespace BO\Zmscitizenapi; use \BO\Zmscitizenapi\BaseController; -use \BO\Zmscitizenapi\Services\ZmsApiFacadeService; -use \BO\Zmscitizenapi\Services\ValidationService; use \BO\Zmscitizenapi\Helper\UtilityHelper; -use BO\Zmscitizenapi\Services\ExceptionService; +use \BO\Zmscitizenapi\Models\ThinnedProcess; +use \BO\Zmscitizenapi\Services\ExceptionService; +use \BO\Zmscitizenapi\Services\ValidationService; +use \BO\Zmscitizenapi\Services\ZmsApiFacadeService; use \BO\Zmsentities\Client; use \BO\Zmsentities\Process; use Psr\Http\Message\RequestInterface; @@ -18,7 +19,7 @@ class AppointmentUpdate extends BaseController public function readResponse(RequestInterface $request, ResponseInterface $response, array $args): ResponseInterface { $request = $request instanceof ServerRequestInterface ? $request : null; - + $body = $request->getParsedBody(); $processId = $body['processId'] ?? null; $authKey = $body['authKey'] ?? null; @@ -26,51 +27,38 @@ public function readResponse(RequestInterface $request, ResponseInterface $respo $email = $body['email'] ?? null; $telephone = $body['telephone'] ?? null; $customTextfield = $body['customTextfield'] ?? null; - + $errors = ValidationService::validateUpdateAppointmentInputs($processId, $authKey, $familyName, $email, $telephone, $customTextfield); if (!empty($errors['errors'])) { return $this->createJsonResponse($response, $errors, 400); } - + try { - $reservedProcess = ZmsApiFacadeService::getProcessById($processId, $authKey); + $reservedProcess = new ThinnedProcess(); + $reservedProcess = ZmsApiFacadeService::getThinnedProcessById($processId, $authKey); if (!empty($reservedProcess['errors'])) { return $this->createJsonResponse($response, $reservedProcess, 404); } - - $processEntity = new Process(); - $processEntity->id = $reservedProcess['data']['processId'] ?? null; - $processEntity->authKey = $reservedProcess['data']['authKey'] ?? null; - $processEntity->appointments = $reservedProcess['data']['appointments'] ?? []; - $processEntity->clients = []; - $client = new \stdClass(); - $client->familyName = $familyName ?? $reservedProcess['data']['familyName'] ?? null; - $client->email = $email ?? $reservedProcess['data']['email'] ?? null; - $client->telephone = $telephone ?? $reservedProcess['data']['telephone'] ?? null; - $client->customTextfield = $customTextfield ?? $reservedProcess['data']['customTextfield'] ?? null; - $processEntity->clients[0] = $client; - $processEntity->scope = $reservedProcess['data']['scope'] ?? null; - $processEntity->lastChange = $reservedProcess['data']['lastChange'] ?? time(); - - if (isset($reservedProcess['data']['queue'])) { - $processEntity->queue = $reservedProcess['data']['queue']; - } - - $processEntity->createIP = $_SERVER['REMOTE_ADDR'] ?? '127.0.0.1'; - $processEntity->createTimestamp = time(); - - + + $reservedProcess->familyName = $familyName ?? $reservedProcess->familyName ?? null; + $reservedProcess->email = $email ?? $reservedProcess->email ?? null; + $reservedProcess->telephone = $telephone ?? $reservedProcess->telephone ?? null; + $reservedProcess->customTextfield = $customTextfield ?? $reservedProcess->customTextfield ?? null; + + $processEntity = UtilityHelper::thinnedProcessToProcess($reservedProcess); + $updatedProcess = ZmsApiFacadeService::updateClientData($processEntity); - + if (isset($updatedProcess['error']) && $updatedProcess['error'] === 'tooManyAppointmentsWithSameMail') { return $this->createJsonResponse($response, ExceptionService::tooManyAppointmentsWithSameMail(), 406); } - - $thinnedProcessData = UtilityHelper::getThinnedProcessData($updatedProcess); - return $this->createJsonResponse($response, $thinnedProcessData, 200); - + + $appointment = UtilityHelper::processToThinnedProcess($updatedProcess); + return $this->createJsonResponse($response, $appointment->toArray(), 200); + } catch (\Exception $e) { throw $e; } } + } \ No newline at end of file diff --git a/zmscitizenapi/src/Zmscitizenapi/Helper/UtilityHelper.php b/zmscitizenapi/src/Zmscitizenapi/Helper/UtilityHelper.php index 32782e4e3..339d2f8ef 100644 --- a/zmscitizenapi/src/Zmscitizenapi/Helper/UtilityHelper.php +++ b/zmscitizenapi/src/Zmscitizenapi/Helper/UtilityHelper.php @@ -2,8 +2,14 @@ namespace BO\Zmscitizenapi\Helper; -use \BO\Zmscitizenapi\Models\Appointment; +use \BO\Zmscitizenapi\Models\ThinnedProcess; +use \BO\Zmsentities\Appointment; +use \BO\Zmsentities\Client; +use \BO\Zmsentities\Contact; use \BO\Zmsentities\Process; +use \BO\Zmsentities\Provider; +use \BO\Zmsentities\Request; +use \BO\Zmsentities\Scope; class UtilityHelper { @@ -45,16 +51,16 @@ public static function uniqueElementsFilter($value, $index, $self): bool return array_search($value, $self) === $index; } - public static function getThinnedProcessData(Process $myProcess): array + public static function processToThinnedProcess(Process $myProcess): ThinnedProcess { if (!$myProcess || !isset($myProcess->id)) { - return []; + return null; } - + $subRequestCounts = []; $mainServiceId = null; $mainServiceCount = 0; - + $requests = $myProcess->requests ?? []; if ($requests) { $requests = is_array($requests) ? $requests : iterator_to_array($requests); @@ -75,22 +81,87 @@ public static function getThinnedProcessData(Process $myProcess): array } } } + + // Populate ThinnedProcess object + $appointment = new ThinnedProcess(); + $appointment->processId = $myProcess->id; + $appointment->timestamp = isset($myProcess->appointments[0]) ? $myProcess->appointments[0]->date : null; + $appointment->authKey = $myProcess->authKey ?? null; + $appointment->familyName = isset($myProcess->clients[0]) ? $myProcess->clients[0]->familyName : null; + $appointment->customTextfield = $myProcess->customTextfield ?? null; + $appointment->email = isset($myProcess->clients[0]) ? $myProcess->clients[0]->email : null; + $appointment->telephone = isset($myProcess->clients[0]) ? $myProcess->clients[0]->telephone : null; + $appointment->officeName = $myProcess->scope->contact->name ?? null; + $appointment->officeId = $myProcess->scope->provider->id ?? null; + $appointment->scope = $myProcess->scope ?? null; + $appointment->subRequestCounts = array_values($subRequestCounts); + $appointment->serviceId = $mainServiceId; + $appointment->serviceCount = $mainServiceCount; + + return $appointment; + } - return [ - 'processId' => $myProcess->id, - 'timestamp' => isset($myProcess->appointments[0]) ? $myProcess->appointments[0]->date : null, - 'authKey' => $myProcess->authKey ?? null, - 'familyName' => isset($myProcess->clients[0]) ? $myProcess->clients[0]->familyName : null, - 'customTextfield' => $myProcess->customTextfield ?? null, - 'email' => isset($myProcess->clients[0]) ? $myProcess->clients[0]->email : null, - 'telephone' => isset($myProcess->clients[0]) ? $myProcess->clients[0]->telephone : null, - 'officeName' => $myProcess->scope->contact->name ?? null, - 'officeId' => $myProcess->scope->provider->id ?? null, - 'scope' => $myProcess->scope ?? null, - 'subRequestCounts' => array_values($subRequestCounts), - 'serviceId' => $mainServiceId, - 'serviceCount' => $mainServiceCount, - ]; + public static function thinnedProcessToProcess(ThinnedProcess $thinnedProcess): Process + { + if (!$thinnedProcess || !isset($thinnedProcess->processId)) { + return null; + } + + $processEntity = new Process(); + $processEntity->id = $thinnedProcess->processId; + $processEntity->authKey = $thinnedProcess->authKey ?? null; + + $client = new Client(); + $client->familyName = $thinnedProcess->familyName ?? null; + $client->email = $thinnedProcess->email ?? null; + $client->telephone = $thinnedProcess->telephone ?? null; + $client->customTextfield = $thinnedProcess->customTextfield ?? null; + + $processEntity->clients = [$client]; + + $appointment = new Appointment(); + $appointment->date = $thinnedProcess->timestamp ?? null; + $processEntity->appointments = [$appointment]; + + $scope = new Scope(); + if (isset($thinnedProcess->officeName)) { + $scope->contact = new Contact(); + $scope->contact->name = $thinnedProcess->officeName; + } + if (isset($thinnedProcess->officeId)) { + $scope->provider = new Provider(); + $scope->provider->id = $thinnedProcess->officeId; + $scope->provider->source = \App::$source_name; + } + $processEntity->scope = $scope; + + $mainServiceId = $thinnedProcess->serviceId ?? null; + $mainServiceCount = $thinnedProcess->serviceCount ?? 0; + $subRequestCounts = $thinnedProcess->subRequestCounts ?? []; + + $requests = []; + for ($i = 0; $i < $mainServiceCount; $i++) { + $request = new Request(); + $request->id = $mainServiceId; + $request->source = \App::$source_name; + $requests[] = $request; + } + foreach ($subRequestCounts as $subRequest) { + for ($i = 0; $i < ($subRequest['count'] ?? 0); $i++) { + $request = new Request(); + $request->id = $subRequest['id']; + $request->source = \App::$source_name; + $requests[] = $request; + } + } + $processEntity->requests = $requests; + + $processEntity->lastChange = time(); + $processEntity->createIP = $_SERVER['REMOTE_ADDR'] ?? '127.0.0.1'; + $processEntity->createTimestamp = time(); + + return $processEntity; } + } diff --git a/zmscitizenapi/src/Zmscitizenapi/Models/AppointmentCancel.php b/zmscitizenapi/src/Zmscitizenapi/Models/AppointmentCancel.php new file mode 100644 index 000000000..ca905eff3 --- /dev/null +++ b/zmscitizenapi/src/Zmscitizenapi/Models/AppointmentCancel.php @@ -0,0 +1,19 @@ + $this->processId ?? null, + 'timestamp' => $this->timestamp ?? null, + 'authKey' => $this->authKey ?? null, + 'familyName' => $this->familyName ?? null, + 'customTextfield' => $this->customTextfield ?? null, + 'email' => $this->email ?? null, + 'telephone' => $this->telephone ?? null, + 'officeName' => $this->officeName ?? null, + 'officeId' => $this->officeId ?? null, + 'scope' => $this->scope ?? null, + 'subRequestCounts' => $this->subRequestCounts ?? [], + 'serviceId' => $this->serviceId ?? null, + 'serviceCount' => $this->serviceCount ?? 0, + ]; + } +} diff --git a/zmscitizenapi/src/Zmscitizenapi/Services/ZmsApiClientService.php b/zmscitizenapi/src/Zmscitizenapi/Services/ZmsApiClientService.php index 4b875be16..4e8560671 100644 --- a/zmscitizenapi/src/Zmscitizenapi/Services/ZmsApiClientService.php +++ b/zmscitizenapi/src/Zmscitizenapi/Services/ZmsApiClientService.php @@ -144,8 +144,6 @@ public static function submitClientData(Process $process): Process|array $url = "/process/{$process->id}/{$process->authKey}/"; - error_log($url); - try { $result = \App::$http->readPostResult($url, $process); return $result->getEntity(); diff --git a/zmscitizenapi/src/Zmscitizenapi/Services/ZmsApiFacadeService.php b/zmscitizenapi/src/Zmscitizenapi/Services/ZmsApiFacadeService.php index df530ce03..ed3ff109e 100644 --- a/zmscitizenapi/src/Zmscitizenapi/Services/ZmsApiFacadeService.php +++ b/zmscitizenapi/src/Zmscitizenapi/Services/ZmsApiFacadeService.php @@ -3,6 +3,7 @@ namespace BO\Zmscitizenapi\Services; use \BO\Zmscitizenapi\Helper\UtilityHelper; +use \BO\Zmscitizenapi\Models\ThinnedProcess; use \BO\Zmscitizenapi\Services\ZmsApiClientService; use \BO\Zmsentities\Process; use \BO\Zmsentities\Scope; @@ -569,7 +570,7 @@ public static function reserveTimeslot(Process $appointmentProcess, array $servi return ZmsApiClientService::reserveTimeslot($appointmentProcess, $serviceIds, $serviceCounts); } - public static function getProcessById(?int $processId, ?string $authKey): Process|array + public static function getThinnedProcessById(?int $processId, ?string $authKey): ThinnedProcess|array { $errors = ValidationService::validateGetProcessById($processId, $authKey); if (!empty($errors['errors'])) { @@ -585,9 +586,10 @@ public static function getProcessById(?int $processId, ?string $authKey): Proces return $errors; } - $responseData = UtilityHelper::getThinnedProcessData($process); + $appointment = new ThinnedProcess(); + $appointment = UtilityHelper::processToThinnedProcess($process); - return ['data' => $responseData, 'status' => 200]; + return $appointment; } catch (\Exception $e) { if (strpos($e->getMessage(), 'kein Termin gefunden') !== false) { diff --git a/zmsentities/schema/citizenapi/appointment.json b/zmsentities/schema/citizenapi/thinnedProcess.json similarity index 100% rename from zmsentities/schema/citizenapi/appointment.json rename to zmsentities/schema/citizenapi/thinnedProcess.json From cd12ed2668ce9d680b1a0a17f3009b1738d26d7c Mon Sep 17 00:00:00 2001 From: Thomas Fink Date: Mon, 16 Dec 2024 16:40:26 +0100 Subject: [PATCH 6/6] feat(MPDZB-877): refactor thinned process and rename controllers --- zmscitizenapi/bootstrap.php | 5 --- zmscitizenapi/package.json | 2 +- zmscitizenapi/routing.php | 12 +++--- ...AppointmentGet.php => AppointmentById.php} | 6 +-- .../{CaptchaGet.php => Captcha.php} | 2 +- .../Zmscitizenapi/Helper/UtilityHelper.php | 39 +++++++++---------- .../{ScopeByIdGet.php => ScopeById.php} | 2 +- .../Services/ZmsApiFacadeService.php | 6 +-- ...entGetTest.php => AppointmentByIdTest.php} | 6 +-- .../{CaptchaGetTest.php => CaptchaTest.php} | 4 +- ...ScopeByIdGetTest.php => ScopeByIdTest.php} | 4 +- 11 files changed, 41 insertions(+), 47 deletions(-) rename zmscitizenapi/src/Zmscitizenapi/{AppointmentGet.php => AppointmentById.php} (88%) rename zmscitizenapi/src/Zmscitizenapi/{CaptchaGet.php => Captcha.php} (92%) rename zmscitizenapi/src/Zmscitizenapi/{ScopeByIdGet.php => ScopeById.php} (96%) rename zmscitizenapi/tests/Zmscitizenapi/{AppointmentGetTest.php => AppointmentByIdTest.php} (98%) rename zmscitizenapi/tests/Zmscitizenapi/{CaptchaGetTest.php => CaptchaTest.php} (95%) rename zmscitizenapi/tests/Zmscitizenapi/{ScopeByIdGetTest.php => ScopeByIdTest.php} (99%) diff --git a/zmscitizenapi/bootstrap.php b/zmscitizenapi/bootstrap.php index 5599065f2..a4c3de3c1 100644 --- a/zmscitizenapi/bootstrap.php +++ b/zmscitizenapi/bootstrap.php @@ -1,9 +1,4 @@ get( '/scope-by-id/', - '\BO\Zmscitizenapi\ScopeByIdGet' + '\BO\Zmscitizenapi\ScopeById' ) - ->setName("ScopeByIdGet"); + ->setName("ScopeById"); /** * @swagger @@ -318,9 +318,9 @@ */ \App::$slim->get( '/appointment/', - '\BO\Zmscitizenapi\AppointmentGet' + '\BO\Zmscitizenapi\AppointmentById' ) - ->setName("AppointmentGet"); + ->setName("AppointmentById"); /** * @swagger @@ -342,9 +342,9 @@ */ \App::$slim->get( '/captcha-details/', - '\BO\Zmscitizenapi\CaptchaGet' + '\BO\Zmscitizenapi\Captcha' ) - ->setName("CaptchaGet"); + ->setName("Captcha"); /** * @swagger diff --git a/zmscitizenapi/src/Zmscitizenapi/AppointmentGet.php b/zmscitizenapi/src/Zmscitizenapi/AppointmentById.php similarity index 88% rename from zmscitizenapi/src/Zmscitizenapi/AppointmentGet.php rename to zmscitizenapi/src/Zmscitizenapi/AppointmentById.php index 62a34b691..01a099a1c 100644 --- a/zmscitizenapi/src/Zmscitizenapi/AppointmentGet.php +++ b/zmscitizenapi/src/Zmscitizenapi/AppointmentById.php @@ -8,7 +8,7 @@ use \Psr\Http\Message\RequestInterface; use \Psr\Http\Message\ResponseInterface; -class AppointmentGet extends BaseController +class AppointmentById extends BaseController { public function readResponse(RequestInterface $request, ResponseInterface $response, array $args): ResponseInterface { @@ -25,8 +25,8 @@ public function readResponse(RequestInterface $request, ResponseInterface $respo } if (isset($result) && $result instanceof ThinnedProcess) { - $appointment = $result; - return $this->createJsonResponse($response, $appointment->toArray(), 200); + $thinnedProcess = $result; + return $this->createJsonResponse($response, $thinnedProcess->toArray(), 200); } return $this->createJsonResponse($response, $result, 400); diff --git a/zmscitizenapi/src/Zmscitizenapi/CaptchaGet.php b/zmscitizenapi/src/Zmscitizenapi/Captcha.php similarity index 92% rename from zmscitizenapi/src/Zmscitizenapi/CaptchaGet.php rename to zmscitizenapi/src/Zmscitizenapi/Captcha.php index 9d5818ecb..671e06a26 100644 --- a/zmscitizenapi/src/Zmscitizenapi/CaptchaGet.php +++ b/zmscitizenapi/src/Zmscitizenapi/Captcha.php @@ -7,7 +7,7 @@ use Psr\Http\Message\ResponseInterface; use \BO\Zmscitizenapi\Services\FriendlyCaptchaService; -class CaptchaGet extends BaseController +class Captcha extends BaseController { public function readResponse(RequestInterface $request, ResponseInterface $response, array $args): ResponseInterface { diff --git a/zmscitizenapi/src/Zmscitizenapi/Helper/UtilityHelper.php b/zmscitizenapi/src/Zmscitizenapi/Helper/UtilityHelper.php index 339d2f8ef..b18d176a6 100644 --- a/zmscitizenapi/src/Zmscitizenapi/Helper/UtilityHelper.php +++ b/zmscitizenapi/src/Zmscitizenapi/Helper/UtilityHelper.php @@ -81,24 +81,23 @@ public static function processToThinnedProcess(Process $myProcess): ThinnedProce } } } + + $thinnedProcess = new ThinnedProcess(); + $thinnedProcess->processId = $myProcess->id; + $thinnedProcess->timestamp = isset($myProcess->appointments[0]) ? $myProcess->appointments[0]->date : null; + $thinnedProcess->authKey = $myProcess->authKey ?? null; + $thinnedProcess->familyName = isset($myProcess->clients[0]) ? $myProcess->clients[0]->familyName : null; + $thinnedProcess->customTextfield = $myProcess->customTextfield ?? null; + $thinnedProcess->email = isset($myProcess->clients[0]) ? $myProcess->clients[0]->email : null; + $thinnedProcess->telephone = isset($myProcess->clients[0]) ? $myProcess->clients[0]->telephone : null; + $thinnedProcess->officeName = $myProcess->scope->contact->name ?? null; + $thinnedProcess->officeId = $myProcess->scope->provider->id ?? null; + $thinnedProcess->scope = $myProcess->scope ?? null; + $thinnedProcess->subRequestCounts = array_values($subRequestCounts); + $thinnedProcess->serviceId = $mainServiceId; + $thinnedProcess->serviceCount = $mainServiceCount; - // Populate ThinnedProcess object - $appointment = new ThinnedProcess(); - $appointment->processId = $myProcess->id; - $appointment->timestamp = isset($myProcess->appointments[0]) ? $myProcess->appointments[0]->date : null; - $appointment->authKey = $myProcess->authKey ?? null; - $appointment->familyName = isset($myProcess->clients[0]) ? $myProcess->clients[0]->familyName : null; - $appointment->customTextfield = $myProcess->customTextfield ?? null; - $appointment->email = isset($myProcess->clients[0]) ? $myProcess->clients[0]->email : null; - $appointment->telephone = isset($myProcess->clients[0]) ? $myProcess->clients[0]->telephone : null; - $appointment->officeName = $myProcess->scope->contact->name ?? null; - $appointment->officeId = $myProcess->scope->provider->id ?? null; - $appointment->scope = $myProcess->scope ?? null; - $appointment->subRequestCounts = array_values($subRequestCounts); - $appointment->serviceId = $mainServiceId; - $appointment->serviceCount = $mainServiceCount; - - return $appointment; + return $thinnedProcess; } public static function thinnedProcessToProcess(ThinnedProcess $thinnedProcess): Process @@ -119,9 +118,9 @@ public static function thinnedProcessToProcess(ThinnedProcess $thinnedProcess): $processEntity->clients = [$client]; - $appointment = new Appointment(); - $appointment->date = $thinnedProcess->timestamp ?? null; - $processEntity->appointments = [$appointment]; + $thinnedProcess = new Appointment(); + $thinnedProcess->date = $thinnedProcess->timestamp ?? null; + $processEntity->appointments = [$thinnedProcess]; $scope = new Scope(); if (isset($thinnedProcess->officeName)) { diff --git a/zmscitizenapi/src/Zmscitizenapi/ScopeByIdGet.php b/zmscitizenapi/src/Zmscitizenapi/ScopeById.php similarity index 96% rename from zmscitizenapi/src/Zmscitizenapi/ScopeByIdGet.php rename to zmscitizenapi/src/Zmscitizenapi/ScopeById.php index 415be20a6..36159a456 100644 --- a/zmscitizenapi/src/Zmscitizenapi/ScopeByIdGet.php +++ b/zmscitizenapi/src/Zmscitizenapi/ScopeById.php @@ -8,7 +8,7 @@ use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; -class ScopeByIdGet extends BaseController +class ScopeById extends BaseController { public function readResponse(RequestInterface $request, ResponseInterface $response, array $args): ResponseInterface { diff --git a/zmscitizenapi/src/Zmscitizenapi/Services/ZmsApiFacadeService.php b/zmscitizenapi/src/Zmscitizenapi/Services/ZmsApiFacadeService.php index ed3ff109e..21d955753 100644 --- a/zmscitizenapi/src/Zmscitizenapi/Services/ZmsApiFacadeService.php +++ b/zmscitizenapi/src/Zmscitizenapi/Services/ZmsApiFacadeService.php @@ -586,10 +586,10 @@ public static function getThinnedProcessById(?int $processId, ?string $authKey): return $errors; } - $appointment = new ThinnedProcess(); - $appointment = UtilityHelper::processToThinnedProcess($process); + $thinnedProcess = new ThinnedProcess(); + $thinnedProcess = UtilityHelper::processToThinnedProcess($process); - return $appointment; + return $thinnedProcess; } catch (\Exception $e) { if (strpos($e->getMessage(), 'kein Termin gefunden') !== false) { diff --git a/zmscitizenapi/tests/Zmscitizenapi/AppointmentGetTest.php b/zmscitizenapi/tests/Zmscitizenapi/AppointmentByIdTest.php similarity index 98% rename from zmscitizenapi/tests/Zmscitizenapi/AppointmentGetTest.php rename to zmscitizenapi/tests/Zmscitizenapi/AppointmentByIdTest.php index f14e31ae2..26254a690 100644 --- a/zmscitizenapi/tests/Zmscitizenapi/AppointmentGetTest.php +++ b/zmscitizenapi/tests/Zmscitizenapi/AppointmentByIdTest.php @@ -2,11 +2,11 @@ namespace BO\Zmscitizenapi\Tests; -use BO\Zmscitizenapi\AppointmentGet; +use BO\Zmscitizenapi\AppointmentById; -class AppointmentGetTest extends Base +class AppointmentByIdTest extends Base { - protected $classname = "AppointmentGet"; + protected $classname = "AppointmentById"; public function testRendering() { diff --git a/zmscitizenapi/tests/Zmscitizenapi/CaptchaGetTest.php b/zmscitizenapi/tests/Zmscitizenapi/CaptchaTest.php similarity index 95% rename from zmscitizenapi/tests/Zmscitizenapi/CaptchaGetTest.php rename to zmscitizenapi/tests/Zmscitizenapi/CaptchaTest.php index 140dd9eca..a64141acb 100644 --- a/zmscitizenapi/tests/Zmscitizenapi/CaptchaGetTest.php +++ b/zmscitizenapi/tests/Zmscitizenapi/CaptchaTest.php @@ -4,9 +4,9 @@ use \BO\Zmscitizenapi\Application; -class CaptchaGetTest extends Base +class CaptchaTest extends Base { - protected $classname = "CaptchaGet"; + protected $classname = "Captcha"; public function setUp(): void { diff --git a/zmscitizenapi/tests/Zmscitizenapi/ScopeByIdGetTest.php b/zmscitizenapi/tests/Zmscitizenapi/ScopeByIdTest.php similarity index 99% rename from zmscitizenapi/tests/Zmscitizenapi/ScopeByIdGetTest.php rename to zmscitizenapi/tests/Zmscitizenapi/ScopeByIdTest.php index 10557ec2e..2651f3241 100644 --- a/zmscitizenapi/tests/Zmscitizenapi/ScopeByIdGetTest.php +++ b/zmscitizenapi/tests/Zmscitizenapi/ScopeByIdTest.php @@ -4,10 +4,10 @@ use BO\Slim\Render; -class ScopeByIdGetTest extends Base +class ScopeByIdTest extends Base { - protected $classname = "ScopeByIdGet"; + protected $classname = "ScopeById"; public function testRendering() {