diff --git a/app/miniapi/service/VisaApplication/VisaApplicationService.php b/app/miniapi/service/VisaApplication/VisaApplicationService.php index 398fbce..11f38fa 100644 --- a/app/miniapi/service/VisaApplication/VisaApplicationService.php +++ b/app/miniapi/service/VisaApplication/VisaApplicationService.php @@ -21,7 +21,7 @@ final class VisaApplicationService public function endpoint(string $userUrl, string $action): string { if (!in_array($action, self::ACTIONS, true)) return ''; - $endpoint = preg_replace('#/users/[^/?]+(?:\?.*)?$#i', '/visa_application/' . $action, rtrim(trim($userUrl), '/')); + $endpoint = preg_replace('#/users/[^/?]+(?:\?.*)?$#i', '/visa_service/' . $action, rtrim(trim($userUrl), '/')); return is_string($endpoint) && $endpoint !== rtrim(trim($userUrl), '/') ? $endpoint : ''; } public function dataSource(string $type, array $filters): array diff --git a/tests/visa_application_facade_self_check.php b/tests/visa_application_facade_self_check.php index 867adef..790bb83 100644 --- a/tests/visa_application_facade_self_check.php +++ b/tests/visa_application_facade_self_check.php @@ -9,8 +9,8 @@ require dirname(__DIR__) . '/app/miniapi/service/VisaApplication/VisaApplication use app\miniapi\service\VisaApplication\VisaApplicationService; $service = new VisaApplicationService(); -if ($service->endpoint('https://user.example.com/users/list', 'start') !== 'https://user.example.com/visa_application/start') throw new RuntimeException('endpoint construction failed'); -if ($service->endpoint('https://user.example.com/users/list', 'dataSource') !== 'https://user.example.com/visa_application/dataSource') throw new RuntimeException('data source forwarding endpoint failed'); +if ($service->endpoint('https://user.example.com/users/list', 'start') !== 'https://user.example.com/visa_service/start') throw new RuntimeException('endpoint construction failed'); +if ($service->endpoint('https://user.example.com/users/list', 'dataSource') !== 'https://user.example.com/visa_service/dataSource') throw new RuntimeException('data source forwarding endpoint failed'); if ($service->endpoint('https://user.example.com/users/list', 'invalid') !== '') throw new RuntimeException('action allowlist failed'); $payload = $service->payload(9, ['order_source' => 'jnwxmini']); if (isset($payload['user_id']) || (json_decode((string)($payload['user_token'] ?? ''), true) !== ['purpose' => 'visa_api', 'user_id' => 9, 'order_source' => 'jnwxmini'])) throw new RuntimeException('trusted token payload failed');