Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ Please feel free to reach out
* PHP ^8.1
* CURL PHP extension (must support TLSv1.2)

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

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

```json
"require": {
"yoti/yoti-php-sdk" : "^4.5.0"
"yoti/yoti-php-sdk" : "^4.5.1"
}
```

Or run this Composer command
```console
$ composer require yoti/yoti-php-sdk "^4.5.0"
$ composer require yoti/yoti-php-sdk "^4.5.1"
```

## Setup
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "yoti/yoti-php-sdk",
"description": "Yoti SDK for quickly integrating your PHP backend with Yoti",
"version": "4.5.0",
"version": "4.5.1",
"keywords": [
"yoti",
"sdk"
Expand Down
13 changes: 13 additions & 0 deletions examples/doc-scan/app/Http/Controllers/HomeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,19 @@ public function show(Request $request, DocScanClient $client)
->withPrivacyPolicyUrl(config('app.url') . '/privacy-policy')
->withBiometricConsentFlow('EARLY')
//->withBrandId('brand_id')
// Suppress specific screens to shorten the flow.
// Available screen identifiers:
// 'IDENTITY_DOCUMENT_EDUCATION'
// 'IDENTITY_DOCUMENT_REQUIREMENTS'
// 'SUPPLEMENTARY_DOCUMENT_REQUIREMENTS'
// 'ZOOM_LIVENESS_EDUCATION'
// 'STATIC_LIVENESS_EDUCATION'
// 'FACE_CAPTURE_EDUCATION'
// 'FLOW_COMPLETION'
// ->withSuppressedScreens(['IDENTITY_DOCUMENT_EDUCATION', 'IDENTITY_DOCUMENT_REQUIREMENTS'])
// Or add screens individually:
// ->withSuppressedScreen('IDENTITY_DOCUMENT_EDUCATION')
// ->withSuppressedScreen('IDENTITY_DOCUMENT_REQUIREMENTS')
->build()
Comment thread
mehmet-yoti marked this conversation as resolved.
)
->withRequiredDocument(
Expand Down
6 changes: 6 additions & 0 deletions examples/doc-scan/resources/views/partial/check.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@
<td>Result</td>
<td>{{ $breakdown->getResult() }}</td>
</tr>
@if ($breakdown->getProcess())
<tr>
<td>Process</td>
<td>{{ $breakdown->getProcess() }}</td>
</tr>
@endif
@if (count($breakdown->getDetails()) > 0)
<tr>
<td>Details</td>
Expand Down
34 changes: 34 additions & 0 deletions examples/doc-scan/resources/views/success.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,23 @@ class="badge badge-primary">{{ $document->getIssuingCountry() }}</span></h3>
</div>
@endif

@if (count($page->getExtractionImageIds()) > 0)
<div class="card-group">
<div class="card" style="width: 18rem;">
<div class="card-body">
<h6 class="card-title">Extraction Image IDs</h6>
<ul class="list-unstyled mb-0">
@foreach ($page->getExtractionImageIds() as $extractionImageId)
<li>
<a href="/media/{{ $extractionImageId }}" target="_blank">{{ $extractionImageId }}</a>
</li>
@endforeach
</ul>
</div>
</div>
</div>
@endif

</div>
</div>
@endforeach
Expand Down Expand Up @@ -743,6 +760,23 @@ class="badge badge-primary">{{ $document->getIssuingCountry() }}</span></h3>
</div>
@endif

@if (count($page->getExtractionImageIds()) > 0)
<div class="card-group">
<div class="card" style="width: 18rem;">
<div class="card-body">
<h6 class="card-title">Extraction Image IDs</h6>
<ul class="list-unstyled mb-0">
@foreach ($page->getExtractionImageIds() as $extractionImageId)
<li>
<a href="/media/{{ $extractionImageId }}" target="_blank">{{ $extractionImageId }}</a>
</li>
@endforeach
</ul>
</div>
</div>
</div>
@endif

</div>
</div>
@endforeach
Expand Down
2 changes: 1 addition & 1 deletion src/Constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Constants
public const SDK_IDENTIFIER = 'PHP';

/** Default SDK version */
public const SDK_VERSION = '4.5.0';
public const SDK_VERSION = '4.5.1';

Comment thread
mehmet-yoti marked this conversation as resolved.
/** Base url for connect page (user will be redirected to this page eg. baseurl/app-id) */
public const CONNECT_BASE_URL = 'https://www.yoti.com/connect';
Expand Down
95 changes: 95 additions & 0 deletions src/DocScan/Session/Create/ApplicantProfile.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<?php

declare(strict_types=1);

namespace Yoti\DocScan\Session\Create;

use JsonSerializable;
use stdClass;
use Yoti\Util\Json;

class ApplicantProfile implements JsonSerializable
{
/**
* @var string|null
*/
private $fullName;

/**
* @var string|null
*/
private $dateOfBirth;

/**
* @var string|null
*/
private $namePrefix;

/**
* @var StructuredPostalAddress|null
*/
private $structuredPostalAddress;

/**
* @param string|null $fullName
* @param string|null $dateOfBirth
* @param string|null $namePrefix
* @param StructuredPostalAddress|null $structuredPostalAddress
*/
public function __construct(
?string $fullName,
?string $dateOfBirth,
?string $namePrefix,
?StructuredPostalAddress $structuredPostalAddress
) {
$this->fullName = $fullName;
$this->dateOfBirth = $dateOfBirth;
$this->namePrefix = $namePrefix;
$this->structuredPostalAddress = $structuredPostalAddress;
}

/**
* @return stdClass
*/
public function jsonSerialize(): stdClass
{
return (object) Json::withoutNullValues([
'full_name' => $this->fullName,
'date_of_birth' => $this->dateOfBirth,
'name_prefix' => $this->namePrefix,
'structured_postal_address' => $this->structuredPostalAddress,
]);
}

/**
* @return string|null
*/
public function getFullName(): ?string
{
return $this->fullName;
}

/**
* @return string|null
*/
public function getDateOfBirth(): ?string
{
return $this->dateOfBirth;
}

/**
* @return string|null
*/
public function getNamePrefix(): ?string
{
return $this->namePrefix;
}

/**
* @return StructuredPostalAddress|null
*/
public function getStructuredPostalAddress(): ?StructuredPostalAddress
{
return $this->structuredPostalAddress;
}
}
81 changes: 81 additions & 0 deletions src/DocScan/Session/Create/ApplicantProfileBuilder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?php

declare(strict_types=1);

namespace Yoti\DocScan\Session\Create;

class ApplicantProfileBuilder
{
/**
* @var string|null
*/
private $fullName;

/**
* @var string|null
*/
private $dateOfBirth;

/**
* @var string|null
*/
private $namePrefix;

/**
* @var StructuredPostalAddress|null
*/
private $structuredPostalAddress;

/**
* @param string $fullName
* @return $this
*/
public function withFullName(string $fullName): self
{
$this->fullName = $fullName;
return $this;
}

/**
* @param string $dateOfBirth
* @return $this
*/
public function withDateOfBirth(string $dateOfBirth): self
{
$this->dateOfBirth = $dateOfBirth;
return $this;
}

/**
* @param string $namePrefix
* @return $this
*/
public function withNamePrefix(string $namePrefix): self
{
$this->namePrefix = $namePrefix;
return $this;
}

/**
* @param StructuredPostalAddress $structuredPostalAddress
* @return $this
*/
public function withStructuredPostalAddress(StructuredPostalAddress $structuredPostalAddress): self
{
$this->structuredPostalAddress = $structuredPostalAddress;
return $this;
}

/**
* @return ApplicantProfile
*/
public function build(): ApplicantProfile
{
return new ApplicantProfile(
$this->fullName,
$this->dateOfBirth,
$this->namePrefix,
$this->structuredPostalAddress
);
}
}
43 changes: 43 additions & 0 deletions src/DocScan/Session/Create/ResourceCreationContainer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

declare(strict_types=1);

namespace Yoti\DocScan\Session\Create;

use JsonSerializable;
use stdClass;
use Yoti\Util\Json;

class ResourceCreationContainer implements JsonSerializable
{
/**
* @var ApplicantProfile|null
*/
private $applicantProfile;

/**
* @param ApplicantProfile|null $applicantProfile
*/
public function __construct(?ApplicantProfile $applicantProfile)
{
$this->applicantProfile = $applicantProfile;
}

/**
* @return stdClass
*/
public function jsonSerialize(): stdClass
{
return (object) Json::withoutNullValues([
'applicant_profile' => $this->applicantProfile,
]);
}

/**
* @return ApplicantProfile|null
*/
public function getApplicantProfile(): ?ApplicantProfile
{
return $this->applicantProfile;
}
}
33 changes: 33 additions & 0 deletions src/DocScan/Session/Create/ResourceCreationContainerBuilder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

declare(strict_types=1);

namespace Yoti\DocScan\Session\Create;

class ResourceCreationContainerBuilder
{
/**
* @var ApplicantProfile|null
*/
private $applicantProfile;

/**
* @param ApplicantProfile $applicantProfile
* @return $this
*/
public function withApplicantProfile(ApplicantProfile $applicantProfile): self
{
$this->applicantProfile = $applicantProfile;
return $this;
}

/**
* @return ResourceCreationContainer
*/
public function build(): ResourceCreationContainer
{
return new ResourceCreationContainer(
$this->applicantProfile
);
}
}
Loading
Loading