Skip to content

Commit d4cc170

Browse files
authored
Release/4.5.1 (#412)
* Sdk 2791 php add support for retrieving the extraction image ids field from the idv pages * Update README.md * SDK-2742-php-expose-idv-breakdown-process-property * SDK-2793-php-task-response-recommandation added (#404) * SDK-2215 allow rb to supply an applicant profile for identity profile sessions * SDK-2296 added allow rb to fetch application profile from get sessions * update examples * updated version number * updated examples on controller * Add process field rendering to breakdown view in doc-scan example
1 parent 136176e commit d4cc170

32 files changed

Lines changed: 1618 additions & 7 deletions

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ Please feel free to reach out
3030
* PHP ^8.1
3131
* CURL PHP extension (must support TLSv1.2)
3232

33+
> **Breaking change:** this SDK release supports PHP 8.1 and above only.
34+
> Support for PHP 7.4 and PHP 8.0 has been removed.
35+
> If you are still running on PHP 7.4/8.0, please remain on an earlier SDK version until you can upgrade your runtime.
3336
### Recommended (optional)
3437
- [Protobuf C extension](https://github.com/protocolbuffers/protobuf/tree/master/php) (PHP package will be used by default)
3538

@@ -42,13 +45,13 @@ Add the Yoti SDK dependency:
4245

4346
```json
4447
"require": {
45-
"yoti/yoti-php-sdk" : "^4.5.0"
48+
"yoti/yoti-php-sdk" : "^4.5.1"
4649
}
4750
```
4851

4952
Or run this Composer command
5053
```console
51-
$ composer require yoti/yoti-php-sdk "^4.5.0"
54+
$ composer require yoti/yoti-php-sdk "^4.5.1"
5255
```
5356

5457
## Setup

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "yoti/yoti-php-sdk",
33
"description": "Yoti SDK for quickly integrating your PHP backend with Yoti",
4-
"version": "4.5.0",
4+
"version": "4.5.1",
55
"keywords": [
66
"yoti",
77
"sdk"

examples/doc-scan/app/Http/Controllers/HomeController.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,19 @@ public function show(Request $request, DocScanClient $client)
152152
->withPrivacyPolicyUrl(config('app.url') . '/privacy-policy')
153153
->withBiometricConsentFlow('EARLY')
154154
//->withBrandId('brand_id')
155+
// Suppress specific screens to shorten the flow.
156+
// Available screen identifiers:
157+
// 'IDENTITY_DOCUMENT_EDUCATION'
158+
// 'IDENTITY_DOCUMENT_REQUIREMENTS'
159+
// 'SUPPLEMENTARY_DOCUMENT_REQUIREMENTS'
160+
// 'ZOOM_LIVENESS_EDUCATION'
161+
// 'STATIC_LIVENESS_EDUCATION'
162+
// 'FACE_CAPTURE_EDUCATION'
163+
// 'FLOW_COMPLETION'
164+
// ->withSuppressedScreens(['IDENTITY_DOCUMENT_EDUCATION', 'IDENTITY_DOCUMENT_REQUIREMENTS'])
165+
// Or add screens individually:
166+
// ->withSuppressedScreen('IDENTITY_DOCUMENT_EDUCATION')
167+
// ->withSuppressedScreen('IDENTITY_DOCUMENT_REQUIREMENTS')
155168
->build()
156169
)
157170
->withRequiredDocument(

examples/doc-scan/resources/views/partial/check.blade.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@
6767
<td>Result</td>
6868
<td>{{ $breakdown->getResult() }}</td>
6969
</tr>
70+
@if ($breakdown->getProcess())
71+
<tr>
72+
<td>Process</td>
73+
<td>{{ $breakdown->getProcess() }}</td>
74+
</tr>
75+
@endif
7076
@if (count($breakdown->getDetails()) > 0)
7177
<tr>
7278
<td>Details</td>

examples/doc-scan/resources/views/success.blade.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,23 @@ class="badge badge-primary">{{ $document->getIssuingCountry() }}</span></h3>
562562
</div>
563563
@endif
564564

565+
@if (count($page->getExtractionImageIds()) > 0)
566+
<div class="card-group">
567+
<div class="card" style="width: 18rem;">
568+
<div class="card-body">
569+
<h6 class="card-title">Extraction Image IDs</h6>
570+
<ul class="list-unstyled mb-0">
571+
@foreach ($page->getExtractionImageIds() as $extractionImageId)
572+
<li>
573+
<a href="/media/{{ $extractionImageId }}" target="_blank">{{ $extractionImageId }}</a>
574+
</li>
575+
@endforeach
576+
</ul>
577+
</div>
578+
</div>
579+
</div>
580+
@endif
581+
565582
</div>
566583
</div>
567584
@endforeach
@@ -743,6 +760,23 @@ class="badge badge-primary">{{ $document->getIssuingCountry() }}</span></h3>
743760
</div>
744761
@endif
745762

763+
@if (count($page->getExtractionImageIds()) > 0)
764+
<div class="card-group">
765+
<div class="card" style="width: 18rem;">
766+
<div class="card-body">
767+
<h6 class="card-title">Extraction Image IDs</h6>
768+
<ul class="list-unstyled mb-0">
769+
@foreach ($page->getExtractionImageIds() as $extractionImageId)
770+
<li>
771+
<a href="/media/{{ $extractionImageId }}" target="_blank">{{ $extractionImageId }}</a>
772+
</li>
773+
@endforeach
774+
</ul>
775+
</div>
776+
</div>
777+
</div>
778+
@endif
779+
746780
</div>
747781
</div>
748782
@endforeach

src/Constants.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class Constants
3737
public const SDK_IDENTIFIER = 'PHP';
3838

3939
/** Default SDK version */
40-
public const SDK_VERSION = '4.5.0';
40+
public const SDK_VERSION = '4.5.1';
4141

4242
/** Base url for connect page (user will be redirected to this page eg. baseurl/app-id) */
4343
public const CONNECT_BASE_URL = 'https://www.yoti.com/connect';
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Yoti\DocScan\Session\Create;
6+
7+
use JsonSerializable;
8+
use stdClass;
9+
use Yoti\Util\Json;
10+
11+
class ApplicantProfile implements JsonSerializable
12+
{
13+
/**
14+
* @var string|null
15+
*/
16+
private $fullName;
17+
18+
/**
19+
* @var string|null
20+
*/
21+
private $dateOfBirth;
22+
23+
/**
24+
* @var string|null
25+
*/
26+
private $namePrefix;
27+
28+
/**
29+
* @var StructuredPostalAddress|null
30+
*/
31+
private $structuredPostalAddress;
32+
33+
/**
34+
* @param string|null $fullName
35+
* @param string|null $dateOfBirth
36+
* @param string|null $namePrefix
37+
* @param StructuredPostalAddress|null $structuredPostalAddress
38+
*/
39+
public function __construct(
40+
?string $fullName,
41+
?string $dateOfBirth,
42+
?string $namePrefix,
43+
?StructuredPostalAddress $structuredPostalAddress
44+
) {
45+
$this->fullName = $fullName;
46+
$this->dateOfBirth = $dateOfBirth;
47+
$this->namePrefix = $namePrefix;
48+
$this->structuredPostalAddress = $structuredPostalAddress;
49+
}
50+
51+
/**
52+
* @return stdClass
53+
*/
54+
public function jsonSerialize(): stdClass
55+
{
56+
return (object) Json::withoutNullValues([
57+
'full_name' => $this->fullName,
58+
'date_of_birth' => $this->dateOfBirth,
59+
'name_prefix' => $this->namePrefix,
60+
'structured_postal_address' => $this->structuredPostalAddress,
61+
]);
62+
}
63+
64+
/**
65+
* @return string|null
66+
*/
67+
public function getFullName(): ?string
68+
{
69+
return $this->fullName;
70+
}
71+
72+
/**
73+
* @return string|null
74+
*/
75+
public function getDateOfBirth(): ?string
76+
{
77+
return $this->dateOfBirth;
78+
}
79+
80+
/**
81+
* @return string|null
82+
*/
83+
public function getNamePrefix(): ?string
84+
{
85+
return $this->namePrefix;
86+
}
87+
88+
/**
89+
* @return StructuredPostalAddress|null
90+
*/
91+
public function getStructuredPostalAddress(): ?StructuredPostalAddress
92+
{
93+
return $this->structuredPostalAddress;
94+
}
95+
}
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Yoti\DocScan\Session\Create;
6+
7+
class ApplicantProfileBuilder
8+
{
9+
/**
10+
* @var string|null
11+
*/
12+
private $fullName;
13+
14+
/**
15+
* @var string|null
16+
*/
17+
private $dateOfBirth;
18+
19+
/**
20+
* @var string|null
21+
*/
22+
private $namePrefix;
23+
24+
/**
25+
* @var StructuredPostalAddress|null
26+
*/
27+
private $structuredPostalAddress;
28+
29+
/**
30+
* @param string $fullName
31+
* @return $this
32+
*/
33+
public function withFullName(string $fullName): self
34+
{
35+
$this->fullName = $fullName;
36+
return $this;
37+
}
38+
39+
/**
40+
* @param string $dateOfBirth
41+
* @return $this
42+
*/
43+
public function withDateOfBirth(string $dateOfBirth): self
44+
{
45+
$this->dateOfBirth = $dateOfBirth;
46+
return $this;
47+
}
48+
49+
/**
50+
* @param string $namePrefix
51+
* @return $this
52+
*/
53+
public function withNamePrefix(string $namePrefix): self
54+
{
55+
$this->namePrefix = $namePrefix;
56+
return $this;
57+
}
58+
59+
/**
60+
* @param StructuredPostalAddress $structuredPostalAddress
61+
* @return $this
62+
*/
63+
public function withStructuredPostalAddress(StructuredPostalAddress $structuredPostalAddress): self
64+
{
65+
$this->structuredPostalAddress = $structuredPostalAddress;
66+
return $this;
67+
}
68+
69+
/**
70+
* @return ApplicantProfile
71+
*/
72+
public function build(): ApplicantProfile
73+
{
74+
return new ApplicantProfile(
75+
$this->fullName,
76+
$this->dateOfBirth,
77+
$this->namePrefix,
78+
$this->structuredPostalAddress
79+
);
80+
}
81+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Yoti\DocScan\Session\Create;
6+
7+
use JsonSerializable;
8+
use stdClass;
9+
use Yoti\Util\Json;
10+
11+
class ResourceCreationContainer implements JsonSerializable
12+
{
13+
/**
14+
* @var ApplicantProfile|null
15+
*/
16+
private $applicantProfile;
17+
18+
/**
19+
* @param ApplicantProfile|null $applicantProfile
20+
*/
21+
public function __construct(?ApplicantProfile $applicantProfile)
22+
{
23+
$this->applicantProfile = $applicantProfile;
24+
}
25+
26+
/**
27+
* @return stdClass
28+
*/
29+
public function jsonSerialize(): stdClass
30+
{
31+
return (object) Json::withoutNullValues([
32+
'applicant_profile' => $this->applicantProfile,
33+
]);
34+
}
35+
36+
/**
37+
* @return ApplicantProfile|null
38+
*/
39+
public function getApplicantProfile(): ?ApplicantProfile
40+
{
41+
return $this->applicantProfile;
42+
}
43+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Yoti\DocScan\Session\Create;
6+
7+
class ResourceCreationContainerBuilder
8+
{
9+
/**
10+
* @var ApplicantProfile|null
11+
*/
12+
private $applicantProfile;
13+
14+
/**
15+
* @param ApplicantProfile $applicantProfile
16+
* @return $this
17+
*/
18+
public function withApplicantProfile(ApplicantProfile $applicantProfile): self
19+
{
20+
$this->applicantProfile = $applicantProfile;
21+
return $this;
22+
}
23+
24+
/**
25+
* @return ResourceCreationContainer
26+
*/
27+
public function build(): ResourceCreationContainer
28+
{
29+
return new ResourceCreationContainer(
30+
$this->applicantProfile
31+
);
32+
}
33+
}

0 commit comments

Comments
 (0)