SDK-2750: PHP - Add Enforce Handoff to SDKs for IDV Create Session - php - #422
mehmet-yoti wants to merge 2 commits into
Conversation
Adds support for the new boolean `enforce_handoff` property in the IDV Create Session `sdk_config`. Mirrors the existing `allow_handoff` implementation: nullable optional field, `withEnforceHandoff()` builder method, serialized as `enforce_handoff` in the JSON payload (omitted when unset). Compatibility validation between `enforce_handoff=true` and `allow_handoff=false` is delegated to the IDV API per the ticket spec. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
🤖 Claude Code ReviewCode Review FindingsMinortests/DocScan/Session/Create/SdkConfigBuilderTest.php — No test for All three new serialization tests only exercise Suggested addition: /**
* @test
* @covers ::withEnforceHandoff
* @covers \Yoti\DocScan\Session\Create\SdkConfig::jsonSerialize
*/
public function shouldIncludeEnforceHandoffFalseInJsonSerialization(): void
{
$result = (new SdkConfigBuilder())
->withEnforceHandoff(false)
->build();
$jsonData = $result->jsonSerialize();
$this->assertTrue(property_exists($jsonData, 'enforce_handoff'));
$this->assertFalse($jsonData->enforce_handoff);
}Nittests/DocScan/Session/Create/SdkConfigBuilderTest.php:505–516 — Dead variable
$expected = ['enforce_handoff' => true];…but never uses it in any assertion. The assertions are written inline instead, making src/DocScan/Session/Create/SdkConfigBuilder.php:169 — Missing PHPDoc on The new /**
* @param bool $enforceHandoff
* @return $this
*/
public function withEnforceHandoff(bool $enforceHandoff): selfNone (Critical / Major)The core implementation is correct: the Reviewed by Claude (claude-sonnet-4-6). 3 findings total: 1 Minor, 2 Nit. |
Summary
Adds
enforce_handoffboolean property to the IDV (Identity Document Verification) session SDK configuration, mirroring the existingallow_handoffimplementation. The field is optional/nullable, serializes to the JSON keyenforce_handoff(omitted when null/unset), and is exposed via awithEnforceHandoff()builder method andgetEnforceHandoff()getter onSdkConfig.Changes
src/DocScan/Session/Create/SdkConfig.php: Added$enforceHandoffprivate nullable bool property, added parameter to constructor, assigned in constructor body, included injsonSerialize()output, and addedgetEnforceHandoff(): ?boolgetter method.src/DocScan/Session/Create/SdkConfigBuilder.php: Added$enforceHandoffprivate nullable bool property andwithEnforceHandoff(bool $enforceHandoff): selffluent builder method; passes the value through toSdkConfigconstructor inbuild().tests/DocScan/Session/Create/SdkConfigBuilderTest.php: Added four new PHPUnit tests covering: setting the value via builder, null default, JSON serialization when set, and JSON serialization absence when not set..php-cs-fixer.cache: Updated cache file after running PHP CS Fixer (no style issues found).QA Test Steps
websdk-auto/SDK-2750-php-add-enforce-handoff-to-sdks-for-idv-create-session, runcomposer install.vendor/bin/phpunit— all 1002 tests should pass with 2418 assertions.SdkConfigor useSdkConfigBuilderwithout callingwithEnforceHandoff(); verifygetEnforceHandoff()returnsnull.withEnforceHandoff(); verify the serialized JSON either omitsenforce_handoffor has it asnull(current behavior matchesallow_handoff— key is present with null value, filtered by the API consumer).withAllowHandoff()still works correctly and is unaffected.vendor/bin/php-cs-fixer fix --dry-run— should report no changes needed.Notes
allow_handoffto maintain consistency across the SDK.enforce_handoffkey will appear in JSON output asnullwhen not set (consistent with other nullable fields injsonSerialize()); server-side null handling is assumed to be a no-op.null, preserving backward compatibility.Related Jira: SDK-2750
Auto-generated by Claude dynamic workflow