Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDK-2377 added failure reasons to idv #356

Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
d679d8f
SDK-2265 Retrieve Receipt
LuborRod Mar 21, 2023
3806985
Add several tests to SDK-2265
LuborRod Apr 10, 2023
3dcc7a7
SDK-2265 Retrieve Receipt Fix Decryption (#353)
saurabh-yoti May 7, 2024
a6d34f6
Sdk 2265 examples (#354)
mehmet-yoti Jun 18, 2024
b8b963a
SDK-2265 added test FetchShareReceipt and updated ReceiptItemKeyTest,…
mehmet-yoti Jun 19, 2024
a46dd7e
SDK-2265 added test FetchShareReceipt DigitalIdentityClient
mehmet-yoti Jun 19, 2024
5ad4d8b
SDK-2265 php 7.4 type hint remove
mehmet-yoti Jun 20, 2024
6748e2d
SDK-2377 added failure reasons to idv
mehmet-yoti Jun 20, 2024
2cb05e6
SDK-2377 added failure reasons to idv
mehmet-yoti Jun 20, 2024
3bb1f1b
SDK-2377 update naming
mehmet-yoti Jun 20, 2024
0901194
SDK-2265 merge conflicts resolve
mehmet-yoti Jun 20, 2024
7e4c333
SDK-2265 added missing test
mehmet-yoti Jun 20, 2024
0931fc9
SDK-2265 added missing tests
mehmet-yoti Jun 20, 2024
3adf06c
SDK-2265 added missing tests
mehmet-yoti Jun 20, 2024
d61b0cd
SDK-2265 added missing tests
mehmet-yoti Jun 20, 2024
1c8629c
SDK-2265 added missing features
mehmet-yoti Jun 20, 2024
e1fdcd5
SDK-2265 removed digital identity examples from profile example
mehmet-yoti Jun 21, 2024
8271c28
Merge branch 'SDK-2265' into SDK-2377-php-add-failure-reason-info-to-…
mehmet-yoti Jun 21, 2024
438786f
Merge branch 'development' into SDK-2377-php-add-failure-reason-info-…
mehmet-yoti Jun 21, 2024
47e15f4
SDK-2377 added validations to classes
mehmet-yoti Jun 24, 2024
80251fd
Sdk 2357 php failure receipt error details (#355)
mehmet-yoti Jun 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .php-cs-fixer.cache

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,32 @@ class FailureReasonResponse
/**
* @var string
*/
private $stringCode;

private $reasonCode;
/**
* @var RequirementNotMetDetails
*/
private $requirementsNotMetDetails;
/**
* @param string $stringCode
* @param array<string, mixed> $data
*/
public function __construct(string $stringCode)
public function __construct(array $data)
{
$this->stringCode = $stringCode;
$this->reasonCode = $data["reason_code"];
$this->requirementsNotMetDetails = new RequirementNotMetDetails($data["requirements_not_met_details"]);
}

/**
* @return string
*/
public function getStringCode(): string
public function getReasonCode(): string
{
return $this->reasonCode;
}
/**
* @return RequirementNotMetDetails
*/
public function getRequirementNotMetDetails(): RequirementNotMetDetails
{
return $this->stringCode;
return $this->requirementsNotMetDetails;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?php

namespace Yoti\DocScan\Session\Retrieve\IdentityProfile;

class RequirementNotMetDetails
{
/**
* @var string
*/
private $failureType;
/**
* @var string
*/
private $documentType;
/**
* @var string
*/
private $documentCountryIsoCode;
/**
* @var string
*/
private $auditId;
/**
* @var string
*/
private $details;

/**
* @param array<int, array<string, string>> $data
*/
public function __construct(array $data)
{
$this->failureType = $data[0]["failure_type"];
$this->details = $data[0]["details"];
$this->auditId = $data[0]["audit_id"];
$this->documentCountryIsoCode = $data[0]["document_country_iso_code"];
$this->documentType = $data[0]["document_type"];
}

/**
* @return string
*/
public function getFailureType(): string
{
return $this->failureType;
}
/**
* @return string
*/
public function getDetails(): string
{
return $this->details;
}
/**
* @return string
*/
public function getAuditId(): string
{
return $this->auditId;
}
/**
* @return string
*/
public function getDocumentCountryIsoCode(): string
{
return $this->documentCountryIsoCode;
}
/**
* @return string
*/
public function getDocumentType(): string
{
return $this->documentType;
}
}
2 changes: 1 addition & 1 deletion src/DocScan/Session/Retrieve/IdentityProfileResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function __construct(array $sessionData)
$this->result = $sessionData['result'];

if (isset($sessionData['failure_reason'])) {
$this->failureReason = new FailureReasonResponse($sessionData['failure_reason']['reason_code']);
$this->failureReason = new FailureReasonResponse($sessionData['failure_reason']);
}

if (isset($sessionData['identity_profile_report'])) {
Expand Down
2 changes: 1 addition & 1 deletion tests/DocScan/DocScanClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ public function testParseIdentityProfileResponse()
$this->assertEquals('someStringHere', $sessionResult->getIdentityProfile()->getSubjectId());
$this->assertEquals(
'MANDATORY_DOCUMENT_COULD_NOT_BE_PROVIDED',
$sessionResult->getIdentityProfile()->getFailureReason()->getStringCode()
$sessionResult->getIdentityProfile()->getFailureReason()->getReasonCode()
);

$this->assertEquals(
Expand Down
10 changes: 10 additions & 0 deletions tests/DocScan/Session/Retrieve/GetSessionResultTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@ class GetSessionResultTest extends TestCase
'result' => 'SOME_ANOTHER_STRING',
'failure_reason' => [
'reason_code' => 'ANOTHER_STRING',
'requirements_not_met_details' => [
0 => [
'failure_type' => 'ANOTHER_STRING',
'document_type' => 'ANOTHER_STRING',
'document_country_iso_code' => 'ANOTHER_STRING',
'audit_id' => 'ANOTHER_STRING',
'details' => 'ANOTHER_STRING'
]

]
],
'identity_profile_report' => [],
];
Expand Down
23 changes: 20 additions & 3 deletions tests/DocScan/Session/Retrieve/IdentityProfileResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ class IdentityProfileResponseTest extends TestCase
{
private const RESULT = 'DONE';
private const SUBJECT_ID = 'someStringHere';
private const FAILURE_TYPE = 'someStringHere';
private const DOCUMENT_TYPE = 'someStringHere';
private const DOCUMENT_COUNTRY_ISO_CODE = 'someStringHere';
private const AUDIT_ID = 'someStringHere';
private const DETAILS = 'someStringHere';
private const REASON_CODE = 'MANDATORY_DOCUMENT_COULD_NOT_BE_PROVIDED';
private const IDENTITY_PROFILE_REPORT = [
'trust_framework' => 'UK_TFIDA',
Expand Down Expand Up @@ -47,17 +52,29 @@ public function shouldCreatedCorrectly(): void
'result' => self::RESULT,
'failure_reason' => [
'reason_code' => self::REASON_CODE,
'requirements_not_met_details' => [
0 => [
'failure_type' => self::FAILURE_TYPE,
'document_type' => self::DOCUMENT_TYPE,
'document_country_iso_code' => self::DOCUMENT_COUNTRY_ISO_CODE,
'audit_id' => self::AUDIT_ID,
'details' => self::DETAILS
]
]
],
'identity_profile_report' => self::IDENTITY_PROFILE_REPORT,
];

$result = new IdentityProfileResponse($testData);

$this->assertEquals(self::RESULT, $result->getResult());
$this->assertEquals(self::SUBJECT_ID, $result->getSubjectId());
$this->assertEquals((object)self::IDENTITY_PROFILE_REPORT, $result->getIdentityProfileReport());

$this->assertInstanceOf(FailureReasonResponse::class, $result->getFailureReason());
$this->assertEquals(self::REASON_CODE, $result->getFailureReason()->getStringCode());
$this->assertEquals(self::REASON_CODE, $result->getFailureReason()->getReasonCode());
$requriementNotMetDetailsResponse = $result->getFailureReason()->getRequirementNotMetDetails();
$this->assertEquals(self::FAILURE_TYPE, $requriementNotMetDetailsResponse->getFailureType());
$this->assertEquals(self::DOCUMENT_TYPE, $requriementNotMetDetailsResponse->getDocumentType());
$this->assertEquals(self::AUDIT_ID, $requriementNotMetDetailsResponse->getAuditId());
$this->assertEquals(self::DETAILS, $requriementNotMetDetailsResponse->getDetails());
}
}
13 changes: 11 additions & 2 deletions tests/sample-data/sessionResultIdentityProfileResult.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,16 @@
"subject_id": "someStringHere",
"result": "DONE",
"failure_reason": {
"reason_code": "MANDATORY_DOCUMENT_COULD_NOT_BE_PROVIDED"
"reason_code": "MANDATORY_DOCUMENT_COULD_NOT_BE_PROVIDED",
"requirements_not_met_details": [
{
"failure_type": "someStringHere",
"document_type": "someStringHere",
"document_country_iso_code": "someStringHere",
"audit_id": "someStringHere",
"details": "someStringHere"
}
]
},
"identity_profile_report": {
"trust_framework": "UK_TFIDA",
Expand All @@ -31,4 +40,4 @@
}
}
}
}
}
Loading