Skip to content

SDK-2780: PHP - Add support for new capture_type property on Static Liveness resources - php#416

Open
mehmet-yoti wants to merge 1 commit into
developmentfrom
websdk-auto/SDK-2780-php-add-support-for-new-capture-type-property-on-static-liveness-resources
Open

SDK-2780: PHP - Add support for new capture_type property on Static Liveness resources - php#416
mehmet-yoti wants to merge 1 commit into
developmentfrom
websdk-auto/SDK-2780-php-add-support-for-new-capture-type-property-on-static-liveness-resources

Conversation

@mehmet-yoti

Copy link
Copy Markdown
Contributor

Summary

Adds support for the new capture_type property returned on STATIC liveness resources when a Relying Business fetches a Doc Scan session. The property is exposed via a nullable getter on StaticLivenessResourceResponse and is backward compatible with older sessions that omit the field. The ZOOM liveness resource is intentionally left unchanged.

Changes

  • src/DocScan/Session/Retrieve/StaticLivenessResourceResponse.php
    • Added a private ?string $captureType property mapped from the JSON key capture_type in the constructor, defaulting to null when absent (?? null).
    • Added a documented public getter getCaptureType(): ?string noting the field is STATIC-specific and may be null/absent for older sessions.
  • tests/DocScan/Session/Retrieve/StaticLivenessResourceResponseTest.php
    • Asserts getCaptureType() returns the expected value when capture_type is present.
    • Asserts getCaptureType() returns null when the field is absent.

QA Test Steps

  1. Setup: from the repo root run composer install to ensure dev dependencies are present.
  2. Happy path: run vendor/bin/phpunit tests/DocScan/Session/Retrieve/StaticLivenessResourceResponseTest.php and confirm both test cases pass.
  3. Happy path (manual): construct new StaticLivenessResourceResponse(['liveness_type' => 'STATIC', 'capture_type' => 'someCaptureType', ...]) and verify getCaptureType() returns 'someCaptureType'.
  4. Edge case: construct new StaticLivenessResourceResponse([]) and verify getCaptureType() returns null and no exception is thrown.
  5. Regression: run the full suite vendor/bin/phpunit and confirm all tests pass (997 tests, 2414 assertions). Confirm the ZOOM liveness resource behaviour is unchanged.
  6. Quality gates: run vendor/bin/phpcs, vendor/bin/phpstan analyse, and vendor/bin/php-cs-fixer fix --dry-run and confirm all are clean.

Notes

  • The getter is nullable to remain backward compatible with sessions created before this property existed.
  • No CHANGELOG file exists in the repo, so no changelog entry was added.
  • The ZOOM liveness resource (ZoomLivenessResourceResponse.php) was deliberately left unchanged as capture_type is specific to STATIC resources.

Related Jira: SDK-2780
Auto-generated by Claude dynamic workflow

@mehmet-yoti

Copy link
Copy Markdown
Contributor Author

🤖 Claude Code Review

Code Review Findings

The change adds a captureType property + getCaptureType() getter to StaticLivenessResourceResponse, mirroring the existing livenessType/image handling. The implementation is correct, null-safe, and well-tested (both populated and missing-value cases). Findings below are minor/non-blocking.

Critical

None

Major

None

Minor

  • .php-cs-fixer.cache committed in this PR (.php-cs-fixer.cache:1). This file is listed in .gitignore (line 20) yet is tracked and re-committed by this PR, adding unrelated noise (machine-specific temp paths, PHP version 8.1.27) to the diff. It was already tracked on development, so the underlying issue is pre-existing, but ideally this commit should not modify it. Suggested fix: git rm --cached .php-cs-fixer.cache and remove the change from this PR so the diff contains only the two intended source/test files.

Nit

  • Double blank line between the $captureType property and the constructor docblock (src/DocScan/Session/Retrieve/StaticLivenessResourceResponse.php:24). Cosmetic only — php-cs-fixer does not flag it under the current ruleset. Suggested fix: collapse to a single blank line for consistency with the rest of the file.
  • The property docblock and the getter docblock (StaticLivenessResourceResponse.php:14-23 and :50-58) are near-duplicates of the same prose. Not a problem, just slightly redundant; one could be trimmed.

Verification

  • ./vendor/bin/phpunit --filter StaticLivenessResourceResponseTest → OK (2 tests, 8 assertions).
  • ./vendor/bin/php-cs-fixer fix <file> --dry-run → 0 style violations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant